code wiki / (root) / nx_variant.nx

nx_variant.nx

buildroot/runtime/nx_variant.nx

12924 B326 linesdepth 5pulls 7 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_variant.nx -- first SNV caller from pileup base counts. license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/li-2009-samtools-mpileup + depristo-2011-gatk G2.2 of NISHI_GENOMICS_SUBSTRATE_ROADMAP.md. The first variant- calling primitive: given a reference base and a pileup-base-count histogram, classify the position as no-variant / heterozygous / homozygous and identify the alt allele. Decision logic (G2.2 reference impl): total_acgt = counts[A] + counts[C] + counts[G] + counts[T] (excludes N and DEL -- the canonical "informative coverage" used by most callers) if total_acgt < min_coverage: NONE (insufficient evidence) alt_code = argmax over c != ref of counts[c] (leftmost-max wins on tie for determinism) if counts[alt_code] == 0: NONE alt_freq_pct = counts[alt_code] * 100 / total_acgt if alt_freq_pct < min_alt_freq_pct: NONE (below threshold) if alt_freq_pct >= min_hom_freq_pct: HOM else: HET Why this simple rule first: Real SNV callers (HaplotypeCaller, Mutect2, FreeBayes) use genotype likelihoods + Bayesian priors + strand-bias filters + base-quality recalibration + indel-realignment + ML scoring. All require log/exp + nx_phred Q->P conversion + statistical distributions -- queued for G2.2b through G2.5. G2.2 ships the IRREDUCIBLE COUNT-BASED LOGIC that every fancy caller's threshold step ultimately reduces to. Composable; sufficient for high-coverage clean data; honest about its limits. What G2.2 does NOT do (deferred): - Quality-weighted counts (Phred-aware) -- G2.2b - Genotype likelihoods + Bayesian posteriors -- G2.2c - Strand-bias filters (skew between fwd + rev reads) -- G2.2d - Indel calling (insertions / deletions vs reference) -- G2.3 - Multi-allelic site reporting (2+ alt alleles) -- G2.4 - Phasing (linking variants across reads) -- G2.5

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_const.nx nx_pileup.nx nx_variant.nx nx_variant_test.nx

imports: nx_syscalls.nxnx_const.nxnx_pileup.nx

imported by: nx_variant_test.nx

structs

none

consts

none

functions

122func indel_call(ins_hist: *i64,
called by 2: del_callmain
184func snv_call_multi(ref_code: i64,
called by 1: main calls 1: sys_mmap
267func del_call(del_hist: *i64,
called by 1: main calls 1: indel_call
284func snv_call(ref_code: i64,
called by 1: main