Skip to content

Rename PhaseAmbiguousEffect -> PhaseCandidateSet#376

Merged
iskandr merged 3 commits into
mainfrom
rename-phase-candidate-set
May 13, 2026
Merged

Rename PhaseAmbiguousEffect -> PhaseCandidateSet#376
iskandr merged 3 commits into
mainfrom
rename-phase-candidate-set

Conversation

@iskandr
Copy link
Copy Markdown
Contributor

@iskandr iskandr commented May 13, 2026

Summary

Renames the public class returned by germline-aware effect prediction when somatic + germline share a codon and phase is unknown:

  • Before: PhaseAmbiguousEffect (singular, describes the cause).
  • After: PhaseCandidateSet (plural-flavored, describes the contents — a set of phase-hypothesis candidates).

The class wraps .candidates (a tuple of per-hypothesis classified effects) and exposes .outcomes (same candidates plus per-haplotype evidence metadata). The plural name reads better at call sites:

if isinstance(eff, PhaseCandidateSet):
    for c in eff.candidates:
        ...

This is a hard rename — no deprecation alias. The class was only accessible via varcode.effects.effect_classes.PhaseCandidateSet (never re-exported from varcode/__init__.py), so the blast radius is limited to external code that imported the old name directly.

Bumps to 4.23.0 (breaking).

Docs rewrite

docs/germline.md was rewritten to be substantially clearer and to demonstrate the resolver-injection pattern with concrete output. It now leads with three side-by-side scenarios on the same CFTR test-fixture coordinates (7:117531100 T>A somatic + 7:117531101 T>C germline, same codon):

  1. No germline (default)Substitution p.L159M.
  2. Germline + unknown phasePhaseCandidateSet ?p.L159M, with .outcomes listing both haplotypes (B: ref-relative L->M; A: cis-germline S->T).
  3. Germline + phase_resolver forcing cis or trans → single Substitution (p.S159T for cis, p.L159M for trans).

This makes the "varcode enumerates, an external phase source collapses" design explicit instead of buried prose.

Files touched

  • varcode/effects/effect_classes.py — class rename + comment update.
  • varcode/germline.py — three internal references.
  • varcode/variant.py, varcode/effects/effect_prediction.py — docstrings.
  • tests/test_germline_effects.py — class import + isinstance assertions (8 references).
  • docs/germline.md — full rewrite with the three-scenario demo.
  • varcode/version.py — 4.22.1 -> 4.23.0.

Test plan

  • pytest tests/test_germline_effects.py — 34/34.
  • pytest tests/ — 1185/1187 (2 skipped, same as before).
  • Manual: ran the doc's three scenarios in a REPL and confirmed the output matches the comments verbatim.

Out of scope

  • Did not touch .candidates / .outcomes attribute names. .outcomes is part of the MultiOutcomeEffect contract shared with SpliceOutcomeSet and SV machinery; renaming there would cascade.
  • No deprecation alias. If anyone files an issue, we can add PhaseAmbiguousEffect = PhaseCandidateSet in a follow-up patch.

iskandr added 3 commits May 13, 2026 15:24
The class wraps a set of phase-hypothesis candidates, so a plural-
flavored name reads better at call sites:

    if isinstance(eff, PhaseCandidateSet):
        for c in eff.candidates:
            ...

Hard rename (no alias). The class is only exported via
varcode.effects.effect_classes, so this affects only callers that
imported the name directly.

docs/germline.md rewritten to lead with three concrete scenarios:
1. no germline (reference-relative)
2. germline + unknown phase -> PhaseCandidateSet
3. germline + phase_resolver -> single MutationEffect

Capturing real CFTR test-fixture output throughout.
Mirror the worker-cap logic from trufflepig/hitlist/tsarina/vaxrank
so concurrent test runs across sibling repos can't fork-bomb the
laptop. Picks min(cpu_reserve, available_RAM / PER_WORKER_GB),
reserves 1-2 cores, falls back to serial pytest when xdist isn't
installed, logs inputs so the chosen worker count is auditable.
@iskandr iskandr merged commit 3515508 into main May 13, 2026
8 checks passed
@iskandr iskandr deleted the rename-phase-candidate-set branch May 13, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant