bcftools annotate doesn't liftover fields from VCF with symbolic alleles if END in only one file.

Open
#2,507 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
c

Research direction

Reproduce the command with matching VCFs containing symbolic alleles and compare behavior with and without --pair-logic any/all. Then inspect the matching logic around bcf_sr_sort.c lines 400-416 in the referenced htslib revision. Done means symbolic-allele records match when END is present in only one file, while other requested annotation fields are transferred correctly.

Written by the indexing model from the issue text.

Description

requires-test-case

Hi,

I'm using bcftools annotate -c INFO -a variant_calls.vcf.gz imputed.vcf.gz to liftover annotations from a variant-call VCF (with meaningful INFO tags) into an imputed VCF (exact same variants, but removes the original INFO tags with other tags). Critically, the two files have the exact same number and order of variants, and POS/ID/REF/ALT are untouched. This works well for SNPs and most SVs, but seems to ignore symbolic alleles. Adding --pair-logic any/all does then carry over all the INFO annotation for all variants, but not the other options like id even though the symbolic allele variant has a unique ID.

It seems like the issue is that the symbolic alleles have their END info stripped by imputation, so the variants are no longer matched, since one is ID/end_pos and the other is just ID.

https://github.com/samtools/htslib/blob/acc28ac1e52efcdd9a06706aaf0021e1082ef1ba/bcf_sr_sort.c#L400C16-L416C22

I guess this is an extreme edge-case as it is complex and probably fragile to only append END if both files have END, otherwise don't use it for either. I guess the most elegant/ugly solution would be to strip/rename the END tag, merge INFOs, and then rename END or recalculate from POS+SVLEN.

The versions are

bcftools 1.23-3-g34a49760-dirty
Using htslib 1.23-9-gacc28ac1-dirty

Best,
Alex

Dominant language
C
Stars
891
Forks
277
Avg merge
2d 23h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/bcftools

All issues in samtools/bcftools

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.