geno_lewm.data.variant_identity¶
variant_identity
¶
Canonical, content-addressed genomic variant identities.
The v0.3 data contract uses one identity spelling everywhere: GRCh38,
canonical chromosome names without a chr prefix, 1-based coordinates,
and uppercase explicit A/C/G/T alleles. Human-friendly input spellings are
normalized at construction time; serialized keys are validated strictly by
CanonicalVariant.from_key so artifacts cannot drift silently.
This module removes redundant context from an allele pair, but it deliberately does not perform reference-aware left alignment across repeats. Dataset preparation must perform and receipt-bind that upstream transformation before constructing these identities; the reference sequence is intentionally not an implicit dependency of this pure value object.
SUPPORTED_ASSEMBLIES
module-attribute
¶
Reference assemblies accepted by the v0.3 identity contract.
CANONICAL_CHROMOSOMES
module-attribute
¶
Canonical primary chromosome spellings, in genomic sort order.
CanonicalVariant
dataclass
¶
One parsimonious assembly-qualified variant with a stable key and digest.
Shared allele context is trimmed deterministically. Repeat-aware left alignment requires a reference sequence and remains an upstream, receipt-bound dataset-preparation responsibility.
from_key
classmethod
¶
Parse an already-canonical variant key, rejecting spelling drift.
Source code in geno_lewm/data/variant_identity.py
to_dict
¶
Return the canonical JSON-native identity payload.
canonicalize_assembly
¶
Return the canonical assembly spelling accepted by v0.3.
Source code in geno_lewm/data/variant_identity.py
canonicalize_chromosome
¶
Return a primary chromosome without a chr prefix.