Question: Filter SNPs on depth
gravatar for Covux
21 months ago by
Covux10 wrote:


I have a vcf file with some snps. the vcf file contains multiple samples.

I used freebayes, BCFtools and GATK.

I would like to Filter on Quality and depth.

For Quality i use MINQ in vcftools.

vcftools --gzvcf raw.vcf.gz --minQ 30 --recode --recode-INFO-all --out filtered_MINQ_30

When using this filter i encounter no problem with any vcf file. Everything goes fine. All sites that have a quality less than 30 are filtered out.

However when I want to filter on Depth(DP) not a single variant gets filtered out. even when i think they should.

i use the following command line:

vcftools --gzvcf raw.vcf.gz --minDP 200 --recode --recode-INFO-all --out raw.dp200

the numbers of sites i have before and after are the same.

This is how one site looks like in my VCF file.

CG_Chr01    307 .   C   T   96.3    .   AC=5;AF=0.192;AN=26;BaseQRankSum=0.739;ClippingRankSum=0.000;DP=73;ExcessHet=0.0570;FS=0.000;InbreedingCoeff=0.4884;MLEAC=3;MLEAF=0.115;MQ=34.29;MQRankSum=0.335;QD=34.24;ReadPosRankSum=-0.904;SOR=0.340   GT:AD:DP:GQ:PL  0/0:5,0:5:15:0,15,225   0/0:3,0:3:9:0,9,135 0/0:3,0:3:9:0,9,127 0/1:3,1:4:25:25,0,103   0/0:3,0:3:12:0,12,171   ./.:.:.:.:../.:.:.:.:.  ./.:0,1:1:3:36,3,0  0/0:7,0:7:21:0,21,278   ./.:.:.:.:. ./.:.:.:.:. 0/0:7,0:7:24:0,24,360   0/0:9,0:9:27:0,27,398   0/0:8,0:8:24:0,24,326   ./.:0,2:2:6:90,6,0  ./.:.:.:.:. 0/0:10,0:10:30:0,30,430 ./.:.:.:.:. ./.:2,0:2:6:0,6,79

this particular example is from a vcf file created using GATK HaplotypeCaller. but i have the same problem with vcf files created from Freebayes and BCFtools.

Can someone tell me what i am doing wrong or i am overlooking?



mindp snp vcftools depth filter • 1.5k views
ADD COMMENTlink modified 21 months ago by Istvan Albert ♦♦ 79k • written 21 months ago by Covux10

I don't know why it doesn't work well, but maybe you could try another tool to filter on depth (ex : snpSift )

ADD REPLYlink written 21 months ago by guillaume.rbt530

Thank you, I'll look into it.

in the mean time i for the problem solved by using vcffilter

ADD REPLYlink modified 21 months ago • written 21 months ago by Covux10
gravatar for Istvan Albert
21 months ago by
Istvan Albert ♦♦ 79k
University Park, USA
Istvan Albert ♦♦ 79k wrote:

Use the bcftools query or bcftools filter command as seen in

the command will look like this

bcftools query -i 'DP>200' input.vcf

there are different ways to achieve the same action.

ADD COMMENTlink written 21 months ago by Istvan Albert ♦♦ 79k

Thank you for the tip.

i did not manage to get bcftools working.

However vcffilter did the trick.

I used vcffilter -f 'DP > 150' file.vcf.gz > out.vcf and vcffilter -f 'QUAL > 60' file.vcf.gz > out.vcf.

ADD REPLYlink written 21 months ago by Covux10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1235 users visited in the last hour