This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter SNPs on depth

Hey,

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?

Regards,

Covux

snp filter depth vcftools mindp

Thank you, I'll look into it.

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

1 answer

Use the bcftools query or bcftools filter command as seen in

https://samtools.github.io/bcftools/bcftools.html

the command will look like this

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

there are different ways to achieve the same action.

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.

Log in to answer this question.