Trim unsupported alleles off the sites filterAC0 keeps - #1982
Open
glennhickey wants to merge 2 commits into
Open
Trim unsupported alleles off the sites filterAC0 keeps#1982glennhickey wants to merge 2 commits into
glennhickey wants to merge 2 commits into
Conversation
filterAC0 is a record-level filter: `bcftools view -e MAX(AC)=0` decides whether to emit a row, never what is in it. So a bubble carrying 200 traversals of which one is genotyped comes through with all 200 alleles and all 200 AT strings attached. Dropping the whole site instead is what the plain `AC=0` form used to do, and that was worse -- the point here is that neither end of the record-level choice is what the option is for. Add `bcftools view -a` behind it. vg declares AC/AF Number=A and AT Number=R, so bcftools subsets all three in step with ALT and renumbers the GT indices; AN and NS need no fixup pass, since trimming changes which alleles ALT lists, not which samples are called. Order is load-bearing. `-a` first would trim every allele off a site nothing carries, leaving ALT=. with no AC at all, and MAX(AC)=0 does not match a missing tag -- the empty record would then survive the filter that exists to remove it. chunked_vcfwave is deliberately untouched: it runs `norm -m -any` ahead of its own AC=0, so the split already makes that a per-allele decision. .raw.vcf.gz never goes through vcfbub() and still keeps every traversal. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
filterAC0 is a record-level filter:
bcftools view -e MAX(AC)=0decides whether to emit a row, never what is in it. So a bubble carrying 200 traversals of which one is genotyped comes through with all 200 alleles and all 200 AT strings attached. Dropping the whole site instead is what the plainAC=0form used to do, and that was worse -- the point here is that neither end of the record-level choice is what the option is for.Add
bcftools view -abehind it. vg declares AC/AF Number=A and AT Number=R, so bcftools subsets all three in step with ALT and renumbers the GT indices; AN and NS need no fixup pass, since trimming changes which alleles ALT lists, not which samples are called.Order is load-bearing.
-afirst would trim every allele off a site nothing carries, leaving ALT=. with no AC at all, and MAX(AC)=0 does not match a missing tag -- the empty record would then survive the filter that exists to remove it.chunked_vcfwave is deliberately untouched: it runs
norm -m -anyahead of its own AC=0, so the split already makes that a per-allele decision. .raw.vcf.gz never goes through vcfbub() and still keeps every traversal.