How can I filter a vcf filter a VCF file on minimum genotype depth and genotype quality for each sample.
I am looking for a way to filter variants from a VCF file by checking that all samples for a site pass 2 critera
sample.DP > 10
sample.GQ > 15
I thought I could do this using bcftools
bcftools view -i 'MIN(FMT/DP>10) && MIN(FMT/GQ>15)' my.vcf.gz
Somehow this include expression does not seem to be applied.
In my output are still lots of variants with genotypes likes
GT:AO:DP:GQ:PL:QA:QR:RO
0|0:0:16:3:0,48,502:0:554:16 (=depth 16, quality 3)
1|1:1:1:3:21,3,0:37:0:0 (=depth 1, quality 3)
I tried putting the include commands in two different bcftools commands
bcftools view -i 'MIN(FMT/DP>10)' | bcftools view -i 'MIN(FMT/GQ>15)' my.vcf.gz
And I tried without the FMT prefix for the genotype quality
bcftools view -i 'MIN(FMT/DP>10) && MIN(GQ>15)' my.vcf.gz
Still I get variants back with genotypes that don't match the criteria.
Am I misunderstanding the bcftools include expression documentation?
https://samtools.github.io/bcftools/bcftools.html#expressions
Or is there another way that I can achieve this filtering step?
Don't forget to pipe the stdout into a new file.
bcftools view --include 'MIN(FMT/DP)>=10 & MIN(FMT/GQ)>=15' my.vcf > my_output.vcf
There should also be a difference if you use "&" or "&&" according to https://samtools.github.io/bcftools/howtos/filtering.html and bcftools documentation.