bcftools variant filteration
1
0
Entering edit mode
5.7 years ago

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 • 8.6k views
ADD COMMENT
0
Entering edit mode

Be attentive in using && and &. Inquisitive8995

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode
5.7 years ago

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

ADD COMMENT
0
Entering edit mode

Thanks a lot. It works fine now.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 2592 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6