Skip to content

v3.17.1 — the D walk shares its prefixes

Choose a tag to compare

@mikessh mikessh released this 26 Sep 15:14
· 272 commits to master since this release

The Pgen block you cannot decline. 3.16.0 let a caller skip vsig:pgen entirely, but --preset classify and --preset transfer — the two recommended presets — both keep all seven loci of it and paid the full bill. The native D DP is now 2.4–3.6x cheaper on the D-bearing loci, and no Pgen value it returns changes.

The change

pgen_aa_vdj enumerated (D allele, ndel5, ndel3) states and re-threaded the surviving germline through the 25-state codon DP from scratch for each one. The emission at idx3 is a prefix of the emission at idx3 - 1 — the trims of one (D, 5' cut) are nested — so one forward pass now covers every 3' trim of that chain and the len(D) factor leaves the cost. best_vdj, the argmax mirror, has always done this; the sum never did.

locus D states, p > 0 (D, 5' trim) chains before, all cores after
IGH 9,212 767 2,557 µs/junction 703 µs 3.6x
TRD 455 45 155.3 µs 64.8 µs 2.4x
TRB 297 38 79.6 µs 27.6 µs 2.9x

The four D-less loci (TRA, TRG, IGK, IGL) do not move, which is the control.

End to end on 120 synthetic seven-locus samples at the real cohort shape, --preset classify, vsig half: 198.5 s → 64.6 s, 1,654 → 539 ms/sample (3.1x).

The output does not move

The walk records each join and a second pass adds them into the total in the original (ndel3, position) order. Summing straight out of the walk would reassociate, and vsig:pgen:*:frac_atypical is compared against a pgen_q05 frozen outside the block, where a last-bit move is a silent data bug.

  • 1,708 of 1,708 float64 values bit-for-bit identical on one platform, 3.16.0 against this build, across 7 loci × uncollapsed and collapsed models × pgen_nt / pgen_aa / pgen_aa(mismatches=1), agnostic and V/J-restricted.
  • 7-locus OLGA concordance reproduces r(log10 Pgen) = 1.00000; IGH at max relative error 1.0e-13 (nt) / 7.9e-14 (aa).

New: the first stored Pgen reference

tests/python/fixtures/pgen_golden.json — 276 hex-float64 values over IGH/TRB/TRD, compared at a max relative error of 1e-9. A tolerance-based oracle measurably does not catch this bug class: stopping the walk one nucleotide short moves IGH Pgen by a median 7.9e-7 relative, under the rtol=1e-6 OLGA comparisons here use, though the worst junction moves 4.3%.

The same file closes a longer-standing gap: IGH had no OLGA comparison anywhere in the suite, though it is the 9,212-state locus and ~96% of the signature bill.

v3.17.0 was tagged with this change and never published — its pre-publish CI compared the new fixture with ==, which asserts bit-identity across compilers rather than across versions. Nothing reached PyPI under that version.

See CHANGELOG.md for the full entry.