This is a test version of Biostars. For the public version, visit https://www.biostars.org.
VCF keep only genotyped positions

Hi,

I am working with a VCF (See screenshot) created from a gam file. In my case I am using an option that would call every covered position but as you can see in position "565982" some of them don't have a genotype. I would like to know if there is an easy way to filter my VCF recovering only my position with a genotype called ? I was thinking about doing my own script that would parse the VCF but pretty sure something is already out there doing it, but I can't find it.

Thanks a lot

PS: without using this option I would have "normal" VCF but the call 0/0 are not reported and I want to recover those aswell in my case.

Scren

vcf genotype snp

1 answer

So if a GT isn't called then it is present as a zero? If so, then you can remove them by something like bcftools view -e'GT=="0"' in.bcf > out.bcf(not tested).

Thanks a lot for your quick tips. It worked as expected and way quicker than coding my own one ! Thank you !

Log in to answer this question.