This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to filter out failed SNVs to create new files using bcftools isec.

So I figured out a way to use bcftools isec and filter out the passed SNVs at the same time. Here is the command I used:

bcftools isec -f 'PASS,.' --types 'snps' [file1.vcf.gz] [file2.vcf.gz] -p dir

But now I want to filter out the failed SNVs. How can I approach this? Thanks!

bcftools

So I figured out a way to use bcftools isec and filter out the passed SNVs at the same time. bcftools isec -f 'PASS,.' --types 'snps'

no, you're already filterting-out failing variant here.

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

For example, to include only sites which have no filters set, use -f .,PASS.

Sorry I didn't phrase it properly. I need to filter out the PASSED SNVs, such that only the failed ones remain.

1 answer

 bcftools view -e 'FILTER="." || FILTER="PASS"' in.vcf

Thanks Pierre!

Although that wasn't exactly what I was looking for, it still gave me just enough hint to figure it out on my own.

bcftools isec -e 'TYPE!="snp" || FILTER="PASS"' [file1] [file2] -p dir

I appreciate what you do in this forum.

:-)

Log in to answer this question.