This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bcftools consensus overlapped variant

Recently I ran into an issue with 'bcftools consensus' as I kept getting overlapped variant.

putty

When I checked the vcf file, I noticed something like this.

putty2

So can anyone give some advice on this? Thanks.

Fyi, the command I've used was:

bcftools mpileup -Ou -f ref.fasta output.all.bam | bcftools call -Ou -mv | bcftools norm -f ref.fasta -m +any -Oz -o output.vcf.gz 
tabix output.vcf.gz
bcftools consensus -f ref.fasta output.vcf.gz > output.consensus.fasta
bcftools variant

1 answer

Since those 2 indels are overlapping (overlapping positions), bcf consensus cannot decide which one to use to reconstruct the fasta sequence.

One option is to parse the vcf before running consensus and treat the overlapping variants with one of the following criteria:

  1. Remove all the overlapping variants.
  2. Keep the first or last variant of the overlapping variants
  3. Keep the variant called with highest confidence of the overlapping variants.

I would recommend the option 3. For example, for the case you have posted, I would discard the first indel (position 2104), and keep the second (position 2105), since it has a higher IVD and IMF.

Thanks for the suggestions! Definitely would want to try option 3. But do you know the command for me to do so? As I have about 2000 of these overlapping variant

Log in to answer this question.