Variant resolution and allele-aware design

Variant input is resolved by data/variant_resolver.py. The supported public inputs are rsIDs, explicit chr:position:ref:alt coordinates, transcript HGVS, and local VCF records. Resolution is strict: records must identify one exact GRCh38 allele, and ambiguous IDs, unsupported contigs, assembly mismatches, or incomplete allele evidence are not guessed. The identity checks shared by the service adapters live in data/variant_resolution_helpers.py; AF and ClinVar filtering happen in the resolver before records reach design. The run writes the retained records and filter settings to logs/resolved_variants.json.

Design integration lives in workflow.py and data/variant_helpers.py. It requires genomic annotations from TranscriptAnnotation with a GRCh38 reference choice, an explicit strand, and exon intervals for every retrieved transcript. The genomic SNV is mapped through those exons in transcript order. Negative-strand alleles are reverse-complemented into cDNA orientation, and the mapped reference base must match the transcript sequence. Missing annotations, unsupported assemblies, unmapped variants, or reference mismatches stop allele-aware design with an explicit error. Genomic coordinates are never used as cDNA offsets.

Only single-nucleotide substitutions are currently supported for allele-aware design. Indels may resolve and appear in the resolution report, but design rejects them because they can shift every downstream cDNA position and need a separate coordinate-aware candidate implementation.

The modes operate on candidates whose transcript interval overlaps the mapped variant:

Mode

Candidate pool

avoid

Reference-sequence candidates with every mapped variant-overlapping guide removed.

target

Alternate-sequence candidates that overlap a mapped variant; generic reference guides are excluded.

both

Overlapping reference candidates annotated as ref, plus alternate candidates annotated as alt.

Alternate guides are generated by calling the actual designer on a full transcript with one variant applied, then filtering its scored results to guides overlapping that SNV. Each SNV is designed separately; nearby variants do not imply a combined haplotype. Candidate records retain the source transcript ID and record variant details in overlapped_variants, targeted_alleles, and variant_mode. Candidate-to-variant links are also written to logs/candidate_variants.json.

When a run also declares target intent, an alternate-allele candidate is checked against the GRCh38-mapped alternate cDNA sequence for each annotated target transcript. Missing annotations leave allele-specific intent unknown; the reference sequence is not used to reject an alternate guide as though it were the designed allele. The same edited sequence is used to check required and excluded isoforms when the variant maps to their exons.

In target or both mode, an empty resolved variant set is an error: otherwise a targeting run could silently emit ordinary reference guides. In avoid mode, zero retained variants leaves the reference candidate pool unchanged. If a variant is resolved but cannot map to any annotated exon, the design step fails rather than silently treating it as irrelevant.