Skip to content

Trim unsupported alleles off the sites filterAC0 keeps - #1982

Open
glennhickey wants to merge 2 commits into
masterfrom
allele-cleanup
Open

Trim unsupported alleles off the sites filterAC0 keeps#1982
glennhickey wants to merge 2 commits into
masterfrom
allele-cleanup

Conversation

@glennhickey

Copy link
Copy Markdown
Collaborator

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.

glennhickey and others added 2 commits August 14, 2026 14:31
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant