This is a test version of Biostars. For the public version, visit https://www.biostars.org.
finding unique mutations from a multi-sample VCF

Hi all,

I have gone through many posts and couldnt find my answer. I have a vcf file of 4 samples. What I want to reach from it is the list of unique mutations among samples. Example, at position N their genotypes are as ; 0/1 0/0 0/0 0/0. In such case, this is a unique mutation for sample1 at position N. I have gathered an R script where it does what I want at the end but it is not a very useful way of doing such trivial thing. Any recommendation would be helpful.

snp vcf

2 answers

Why not filter on minor allele frequency using vcftools?

Using for example --max-maf you can set the maximum in this case you have 8 alleles so max allele frequency would be 0.125

http://vcftools.sourceforge.net/man_latest.html

using vcfilterjs

 java -jar  dist/vcffilterjs.jar  -e 'function accept(v) { var i,n=0;for(i=0;i< v.getNSamples();++i) { var g=v.getGenotype(i); n+=(g.isHomVar() || g.isHet() ?1:0);} return n==1;} accept(variant);' input.vcf > output.vcf

Log in to answer this question.