Question: bcftools filter applied to specific sample column
2
gravatar for skanterakis
3.4 years ago by
skanterakis100
United Kingdom
skanterakis100 wrote:

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.

view bcftools filter • 2.4k views
ADD COMMENTlink modified 3.4 years ago • written 3.4 years ago by skanterakis100
2
gravatar for William
3.4 years ago by
William4.5k
Europe
William4.5k wrote:

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 COMMENTlink written 3.4 years ago by William4.5k

thanks that worked brilliantly!

ADD REPLYlink written 3.4 years ago by skanterakis100
2
gravatar for skanterakis
3.4 years ago by
skanterakis100
United Kingdom
skanterakis100 wrote:

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 COMMENTlink modified 3.4 years ago • written 3.4 years ago by skanterakis100
0
gravatar for Pierre Lindenbaum
3.4 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum123k wrote:

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 COMMENTlink written 3.4 years ago by Pierre Lindenbaum123k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1979 users visited in the last hour