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

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.

variant analysis bcftools filteration

Hi, Which one would you prefer to be a better option ? Using "&&" , "&" or " ||"

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

vcf

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.