staar: strip FORMAT column in GenotypeWriter::push#135
Merged
Conversation
…push
noodles exposes `Samples<'_>` as everything after the INFO field, which
for VCF includes the FORMAT column ("GT" or "GT:AD:DP"). push was
running its memchr loop over the full string, so the FORMAT bytes
landed in sample[0]'s slot, every real sample shifted by one, and the
last sample was dropped. MAF and dosages were wrong on every ingested
variant.
Fix: skip past the first tab before entering the sample-parsing loop.
Three tests added: correct 3-sample mapping with a bare "GT" format,
multi-field "GT:AD:DP" format, and the missing-samples-field case.
Invariance and ground-truth-vs-R tests unaffected (they feed U/K/MAF
directly from JSON fixtures; neither exercises the VCF→MAF path).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
noodles_vcf::Record::samples()returns everything after INFO, whichin VCF includes the FORMAT column (
"GT"or"GT:AD:DP").pushwas running its memchr loop over the full string, so sample[0]'s slot
got the FORMAT bytes, every real sample shifted by one, and the last
sample was silently dropped. MAF and dosages were wrong on every real
variant.
Fix: skip past the first tab in
samples_strbefore the sample loop.Three tests cover the bare-
GTcase, multi-fieldGT:AD:DP, and themissing-samples case.
Invariance golden and all ground-truth-vs-R tests unaffected. They
feed
U,K,mafsdirectly from the JSON fixture intorun_staar_from_sumstats; neither path touchesGenotypeWriter::push.Nothing to regenerate. 341/341 cargo test, clippy clean.
Surfaced while writing the
VariantReaderunit test in #134.