Fix vcfstats per-sample statistics using wrong FORMAT column index#2534
Closed
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Closed
Fix vcfstats per-sample statistics using wrong FORMAT column index#2534sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6 wants to merge 1 commit intosamtools:developfrom
Conversation
When --samples-file/-S is used and the sample order differs from the VCF, calc_sample_depth(), get_ad(), and get_iad() were called with the sample-list index (is) instead of the VCF column index (reader->samples[is]). This caused depth and allele depth values to be read from the wrong sample's FORMAT fields, producing incorrect per-sample statistics (PSC, PSI, VAF) while the sample names followed the file order. bcf_gt_type() was already correctly using reader->samples[is]. Now all FORMAT field accesses consistently use the VCF column index, while stats arrays remain indexed by the sample-list position. Fixes samtools#2469
5eafaa9 to
637ce89
Compare
Member
|
This is now added, with a test. Thank you |
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.
Summary
--samples-fileis used and sample order differs from the VCF, FORMAT field accessors (calc_sample_depth,get_ad,get_iad) used the subset indexisinstead of the VCF column indexreader->samples[is]ismpl = reader->samples[is]and used it consistently for all FORMAT data accessFixes #2469
Test plan
bcftools stats -s sample_listwith reordered sample list