filter multi-sample vcf with SnpSift filter
2
2
Entering edit mode
10.0 years ago
guillaume.rbt ★ 1.0k

Hi,

I am currently trying to filter a multi-sample vcf file obtained with samtools mpileup. I would like to keep the positions with all samples depths > 4.

I found a way with SnpSift filter, but I have to specify each sample one by one:

cat test.vcf | java -jar SnpSift.jar filter "(GEN[0].DP>4) & (GEN[1].DP>4) & ... &(GEN[66].DP>4)" > filtered.vcf

(I've got 66 samples ... )

Does anyone know how to apply this filtering option to all samples without specifying each samples one by one? (GEN[*] does not seem to work)

Moreover I would like to apply others genotype calling filters on subsets of my samples, is there a way to apply a filter to a specific subset?

Thanks

SNP next-gen • 5.4k views
ADD COMMENT
3
Entering edit mode
10.0 years ago

How about generating the script?

cat test.vcf | java -jar SnpSift.jar filter `seq 1 66 | awk '{ printf("%s (GEN[%d].DP>4) ",(NR==1?"":" & "), $1);}'`

See also my tool : https://github.com/lindenb/jvarkit/wiki/VCFFilterJS to filter with javascript.

ADD COMMENT
0
Entering edit mode

Good idea, thanks!

ADD REPLY
2
Entering edit mode
10.0 years ago
Ram 44k

The -minDP option in vcftools might help. Reference link: http://vcftools.sourceforge.net/man_latest.html#GENOTYPE%20FILTERING%20OPTIONS

ADD COMMENT

Login before adding your answer.

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