bcftools filter applied to specific sample column
3
2
Entering edit mode
8.0 years ago
skanterakis ▴ 130

Hello, I'd like to filter for sites that have a DP>5 in my normal sample and DP>10 in the tumor. My vcf has two samples columns, TUMOR NORMAL. How do I do that with a bcftools expression? I see in the documentation how to apply the filter for one or all samples in a vcf row but I couldn't find a way to specify the sample name. Thanks a lot.

bcftools filter view • 4.7k views
ADD COMMENT
3
Entering edit mode
8.0 years ago
skanterakis ▴ 130

Actually bcftools supports this also. This worked for me:

bcftools filter -s MY_FILTER -m + -e "FMT/DP[0] <= 5 || FMT/DP[1] <= 10" my.vcf

which appends MY_FILTER based on the exclusion criteria

ADD COMMENT
2
Entering edit mode
8.0 years ago
William ★ 5.3k

Hava a look at SnpSift filter.

With SnpSift you can build any expression that evaluates to TRUE / FALSE using the attributes of the variant and or the attributes of one or more specific samples.

http://snpeff.sourceforge.net/SnpSift.html#filter

cat my.vcf | java -jar SnpSift.jar filter "GEN[0].DP > 5 && GEN[1].DP > 10"
ADD COMMENT
0
Entering edit mode

thanks that worked brilliantly!

ADD REPLY
0
Entering edit mode
8.0 years ago

not using bcftools but picard http://broadinstitute.github.io/picard/command-line-overview.html and FilterVcf with a javascript file or vcffilterjs https://github.com/lindenb/jvarkit/wiki/VCFFilterJS

variant.getGenotype("NORMAL").getDP() > 5 && variant.getGenotype("TUMOR").getDP() > 10
ADD COMMENT

Login before adding your answer.

Traffic: 1992 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