Hello RobertUt ,
thanks for sharing. I took a closer look into that and this is what I've found out: Whenever you have two variants of different type with equal starting position, bcftools consensus is throwing the error you've posted. If you have two variants of the same type with equal starting position, bcftools skippes the later one. That there is a different behavior, is in my opinion a bug and should be reported to bcftools.
There is a way to go around this problem. bcftools norm has in option to join multiallelic sites. bcftools consensus have then an option to decide which allel you want to use in the consensus sequence.
I recommend using bcftools normin general, because then you can make sure you have the same variant description between all files. This is useful for annotation, comparison, and so on.
$ bcftools norm -f genome.fa -m +any -Oz -o output.vcf.gz input.vcf
This would create a normalized version of your vcf and collapse all multiallelic site :
#CHROM POS ID REF ALT QUAL FILTER INFO
chr1 1298836 . CAG GAG,C 145 . .
chr1 1298838 . G C 155 . .
In your bcftools consensus command use then one of values for the -H parameter:
-H, --haplotype <which> choose which allele to use from the FORMAT/GT field, note
the codes are case-insensitive:
1: first allele from GT
2: second allele
R: REF allele in het genotypes
A: ALT allele
LR,LA: longer allele and REF/ALT if equal length
SR,SA: shorter allele and REF/ALT if equal length
fin swimmer
Hello RobertUt ,
was the same
reference.faused for alignment?This doesn't explain your problem. But before creating the consensus, I strongly recommend to normalize your vcf file, by using
bcftools norm.fin swimmer
Hi fin,
might be a curious question: What do you normalize your
vcf filefor? Because I don't see how normalizing would have helped to solve my problem.Ut