just_dna_enricher.enrich.build_declaration¶
just_dna_enricher.enrich.build_declaration ¶
The genome build a spec declares, read without compiling it: spec_genome_build and
source_build_mismatch (RM260 split this out of the former single-file enrich.py).
spec_genome_build ¶
The build the module itself declares, which is the only build enrichment may resolve against.
enrich() took genome_build as a plain parameter defaulting to "GRCh38" and nothing ever
passed it — no CLI flag, no caller — so the GRCh38 gate on every link below was unreachable and a
genome_build: GRCh37 module was resolved against GRCh38 Ensembl, its GRCh38 coordinates written
into resolution.csv labelled GRCh38, and GRCh38 VRS ids minted for them. The compiler then
(correctly) refused to use any of it. The guard existed; the value never arrived — the same shape as
the VariantRow re-stamp bug, where a build parameter and its fall-through both existed and were
never reached.
A spec with no module_spec.yaml gets the format's own default. That is not a guess: enrich is
routinely pointed at a bare table directory in tests and by hand, and ModuleSpecConfig.genome_build
defaults to "GRCh38", so this returns what compiling that directory would assume. A spec whose
yaml is present but unreadable is a different case and raises — enrichment writes facts into that
directory, and picking a build for a module whose declaration cannot be read is exactly the
invention this function exists to remove.
Source code in enricher/src/just_dna_enricher/enrich/build_declaration.py
source_build_mismatch ¶
A warning when a drafting provider is about to write source_build coordinates into a module
that declares a different one — or None when the builds agree.
The gap this closes is that spec_genome_build had exactly one caller. It was written for the
bug where "the guard existed; the value never arrived", and then draft, draft-panel and
draft-clinpgx all shipped without asking it. Every source these providers read serves GRCh38 —
CPIC's allele_definitions, the ClinVar snapshot, the ClinPGx annotations — so drafting into a
genome_build: GRCh37 module writes 10,94942290 for rs1799853, whose GRCh37 position is
96702047, and nothing anywhere says a word. The compiler cannot catch it: a coordinate is legal
on either build, it is simply a different place. The whole point of reference_examples/grch37_build
is that this family of defect is silent by construction, and this is its ninth instance.
Reported, not repaired, and not refused. The provider still writes the row: refusing would make the three drafting commands unusable on a non-GRCh38 module rather than merely unhelpful, and stripping the coordinate to leave an rsid-only row is a different row than the author asked for — both are design decisions with real trade-offs, and the enricher's standing rule is that a pass which finds a disagreement says so and changes nothing. Which of the two the providers should eventually do is filed rather than decided here.
Returns None for the agreeing case, which is nearly every call — the house tri-state applies to
the answer, and "the builds agree" is not a finding.