Skip to content

Fix merge -m none incorrectly merging records with different allele sets#2521

Open
sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6:fix/merge-none-exact-match
Open

Fix merge -m none incorrectly merging records with different allele sets#2521
sirus20x6 wants to merge 1 commit intosamtools:developfrom
sirus20x6:fix/merge-none-exact-match

Conversation

@sirus20x6
Copy link
Copy Markdown

Summary

  • In types_compatible(), COLLAPSE_NONE mode checked if the incoming record's alleles were a subset of the merged alleles, but not the reverse — a record with ALT=T would merge with ALT=T,G
  • Add rec->n_allele != maux->nals check to require exact allele count match

Fixes #2498

Test plan

  • Existing test suite passes (added merge.multiallelics.1.none.out and merge.12.none.out, updated merge.2.none.out)
  • Verify bcftools merge -m none keeps records with different ALT sets separate

…ele sets (samtools#2498)

When using `bcftools merge -m none`, records at the same position with
overlapping but non-identical allele sets (e.g., ALT=T vs ALT=T,G) were
incorrectly merged because types_compatible() only checked that the new
record's alleles were a subset of the existing merged alleles.

Add an explicit check that the number of alleles must match exactly in
COLLAPSE_NONE mode, ensuring only records with identical allele sets are
merged together.
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.

bcftools merge -m none can merge SNP variants with different sets of alternate alleles

1 participant