Combine cis SNVs into MNVs without losing transcript or phase interpretations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- bioinformatics
Research direction
Start with docs/transforms.md and the varcode.transforms module docstring, then read the transform shape from #367 and the phase-resolver infrastructure in #269. Review #364 for conventions around reducing variants, provenance, and metadata. Done means the listed cis, trans, phase-unknown, codon-boundary, and three-SNV cases are covered, with clean composition after pair_breakends.
Written by the indexing model from the issue text.
Description
Current status (2026-10-26; Varcode 10.20.2)
Phase-aware/haplotype annotation already models combined coding consequences, but the cardinality-reducing combine_cis_snvs collection transform is still only a planned entry in the transforms module. Keep the request open for that optional normalization/provenance operation; it is not required merely to obtain a combined haplotype consequence.
Corrections to the older draft plan
- Codon membership must be relative to the annotated CDS start on each transcript, not
transcript.spliced_offset(position) // 3, which includes the 5′ UTR. - A shared PS label alone does not establish that alternate alleles are in cis; use the resolver's allele/sample-aware phase result, preserving unknown or contradictory evidence.
- A codon can cross an exon junction. A contiguous genomic MNV must not absorb the intervening intron just because the edited bases share a spliced codon.
- Do not pick the lexically first transcript when transcripts imply incompatible grouping choices. Preserve the ambiguity or decline the reduction.
Remaining acceptance
Retain all source variants and metadata provenance; require an explicit sample/phase scope and reference-validated gap bases; preserve unchanged behavior for trans/unknown phase, same-position alternatives and incompatible transcript interpretations. Test both strands, nonzero UTR lengths, codon boundaries, split codons, differing transcript CDS frames, multi-sample phase conflicts and idempotence. Demonstrate consequence equivalence against the current haplotype path for every eligible combination.
The original proposed shape is retained below; the older comment's algorithm is a draft, not the current implementation or an accepted shortcut around these constraints.
Original request
Follow-up from #364 / #367 (the varcode.transforms module shape). One of four planned transforms enumerated in docs/transforms.md and the module docstring.
Scope
Reduce two or more adjacent SNVs that share a phase set (or are otherwise determined cis) into a single MNV. Removes the need for HaplotypeEffect/PhaseAmbiguousEffect wrapping in the common case where two SNVs sit in the same codon on the same haplotype and can be classified as one combined codon substitution.
Signature:
def combine_cis_snvs(vc, phase_resolver) -> VariantCollection:
"""Combine adjacent in-codon SNVs sharing a phase set into MNVs.
Cardinality: reduces.
"""
Contract (per transforms module conventions)
- Cardinality: reduces.
- Provenance: combined MNV carries
source_variants=(snv1, snv2, ...). - Metadata behavior: GT must agree across all source SNVs (raises on mismatch — same rule as
pair_breakends); other FORMAT fields taken from the lex-earlier source.
Pairing rule
Two SNVs are combined when all of:
- Both share a phase set (the
phase_resolveranswersin_cis(a, b) is True), OR both are homozygous-alt for the same sample at distinct positions within a single codon. - They sit within a transcript codon window (3 bp at the same codon position).
- They're on the same contig.
Tests
- Two SNVs at codon positions 1+2 of the same codon, in cis -> single MNV; effect prediction emits one
Substitutioninstead of two adjacent ones. - Two SNVs in cis but spanning a codon boundary -> not combined (out of codon window).
- Two SNVs in trans -> not combined.
- Phase unknown -> not combined; existing
PhaseAmbiguousEffectpath still handles them. - Three SNVs in cis within one codon -> one MNV with
source_variants=(a, b, c).
Composition
Should compose cleanly after pair_breakends (separate scopes; both reduce; both idempotent).
See also
- #364 — BND mate pairing (the first transform).
- #367 — varcode.transforms module shape PR.
- #269 — phase resolver infrastructure.
- Dominant language
- Python
- Stars
- 88
- Forks
- 28
- Avg merge
- 3h 17m
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openvax/varcode
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
fritzprix/libr-agent#2612 ·
Maintainers usually reply within 1 day
-
needs-triage presubmit-gate
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
gke-labs/kube-agents#5001 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
simonw/sqlite-utils#928 ·
Maintainers usually reply within 3 days
-
colorado
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
freelawproject/juriscraper#2405 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
cline/mcp-marketplace#3576 ·