This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Select A Private Snp With Gatk From A Multisample Vcf File

I ran in to the situation now a couple of times that I need to extract a set of private SNPs from a multisample VCF file.

It is possible with vcf-contrast from vcf-tools:

vcf-contrast +sample1 -sample2 -sample3 -n input.vcf > private sample1.vcf

vcf-contrast -sample1 +sample2 -sample3 -n input.vcf > private sample2.vcf

vcf-contrast -sample1 -sample2 +sample3 -n input.vcf > private sample3.vcf

Surely this must be possible with GATK. Does anyone know how to do this with GATK. I ask because I would like to stay with 1 tool package.

Maybe it is somewhere in the SelectVariants? The --discordance option looked promissing but there is something about that the samples should be the same? Or is it possible to write another variant walker or a JEXL expression?

http://www.broadinstitute.org/gatk/gatkdocs/org_broadinstitute_sting_gatk_walkers_variantutils_SelectVariants.html#--concordance

http://gatkforums.broadinstitute.org/discussion/1255/what-are-jexl-expressions-and-how-can-i-use-them-with-the-gatk

gatk snp

3 answers

I think you'll have to use SelectVariants with a JEXL expression: see http://gatkforums.broadinstitute.org/discussion/1255/what-are-jexl-expressions-and-how-can-i-use-them-with-the-gatk

someting like (not tested)

java -Xmx4g -jar GenomeAnalysisTK.jar -T SelectVariants -R seq.fasta --variant my.vcf -select '
 vc.getGenotype("sampel1")!=null &&
 vc.getGenotype("sample2")==null &&
 vc.getGenotype("sample3")==null  
'

I got the answer on the GATK forum:

With the SelectVariants walker you have to restrict to biAllelic SNPs and then select with a JEXL expression for all the SNPs were AC==1. AC equals the times that the alternative allele is found in all the samples.

java -jar GenomeAnalysisTK-2.3-9-ge5ebf34/GenomeAnalysisTK.jar -T SelectVariants -R reference.fa -V input.vcf -o biAllelicPrivate.vcf --restrictAllelesTo BIALLELIC -select "AC==1"

Hi,

I am trying to do the same analyses and I want to know the significance f Bi-allelic SNPs??

Hi Pierre,

I have posted a question in the forum regarding the same. Could you have a look at it.?

Log in to answer this question.