Remove variants in VCF with the same call in all but the reference
I have a VCF file with individuals mapped to a reference. In many cases, all of the individuals have the same allele call (although it is different from the reference). What I want to do is filter this VCF so I only have allele calls that are variable within my samples. Is there a straightforward way to do this? In the example below I want to keep Chromosome 3416, but get rid of all others:
Chromosome 72 . T G . PASS . GT 1 1 1 1 1
Chromosome 1993 . T C . PASS . GT 1 1 1 1 1
Chromosome 3416 . C T . PASS . GT 0 0 1 1 0
Chromosome 4190 . G T . PASS . GT 1 1 1 1 1
• 1,338 views
•
link
2 answers
You can achieve that with SnpSift filter : http://snpeff.sourceforge.net/SnpSift.html
For example if you want to filter out all positions where all your 5 samples are variants :
cat variants.vcf | java -jar SnpSift.jar filter "!(isVariant( GEN[0] ) & isVariant( GEN[1] ) & isVariant( GEN[2] ) & isVariant( GEN[3] ) & isVariant( GEN[4] ) )" > filtered.vcf
• 0 views
•
link
bcftools view -i 'AC!=5' input.Vcf
• 0 views
•
link
Log in to answer this question.