Thanks a lot. It works fine now.
Hi,
I am trying to filter variants using "bcftools filter". I want to get the lines which contain SNPs and not INDELs. I have been trying to use the "TYPE" option along with other filter expressions but I am getting an error saying - [filter.c:1963 filters_init1] Error: the tag "snp" is not defined in the VCF header. What is the correct way to do this ?
The command which I have used is
bcftools filter -i "TYPE="snp" && MIN(DP)>5 && QUAL>10" input.vcf > output.vcf
Thanks for your help.
1 answer
Hello,
you have to use single quotes around your expression:
$ bcftools filter -i 'TYPE="snp" && MIN(DP)>5 && QUAL>10' input.vcf > output.vcf
Furthermore in newer versions bcftools might ask you:
Both INFO/DP and FORMAT/DP exist, which one do you want?
fin swimmer
Hi finswimmer
do you know how to get rid of this error/warning?
Both INFO/DP and FORMAT/DP exist, which one do you want?
I indeed have DP in INFO and the FORMAT columns in my vcf file
Hello,
the DP value in the INFO is the sum of the DP value over all samples in your vcf at this position. The DP value in the FORMAT column in the read depth for the given sample at this position. If you just have one sample this value should be equal.
You have to decide which one you need in whatever bcftools command you use and use the right one :)
fin swimmer
Log in to answer this question.

Be attentive in using
&&and&. Inquisitive8995Hi, Which one would you prefer to be a better option ? Using "&&" , "&" or " ||"
Hello,
have a look at this thread: Difference between | and || in filtering expressions by bcftools
The difference between
&&and&is quite clear. What exactly is the difference between|and||and when to use what, it seems nobody knows or can explain :(fin swimmer