How to filter out failed SNVs to create new files using bcftools isec.
1
0
Entering edit mode
23 months ago
addamyeo • 0

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 • 745 views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
23 months ago
 bcftools view -e 'FILTER="." || FILTER="PASS"' in.vcf
ADD COMMENT
0
Entering edit mode

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.

:-)

ADD REPLY

Login before adding your answer.

Traffic: 2711 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6