This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Question on SnpSift Filter

I've have been trying to filter a vcf to pull out the first annotation from the ANN field but it keeps returning the whole thing.

This is the code I have been using:

java -jar SnpSift.jar filter "ANN[0]" input.vcf

The extractfield command works fine so the program is able to identify the first ANN.

snp software error

1 answer

I think the correct way should be:

java -jar SnpSift.jar filter "ANN[0]=="xxx"" input.vcf

You didn't set the value to ANN[0], therefore, it always return all the SNPs. check this example:

java -jar  ~/hpc/tools/snpEff/SnpSift.jar filter "ANN[0].EFFECT has 'missense_variant'" All_samples_Exome_QC.DG5.clean.vcf.recode.ANN.vcf > All_samples_Exome_QC.DG5.clean.vcf.recode.ANN.missense.vcf

If you want to select 'High' impact variants, the following command should works:

java -jar  ~/hpc/tools/snpEff/SnpSift.jar filter "ANN[0].IMPACT has 'HIGH'" All_samples_Exome_QC.DG5.clean.vcf.recode.ANN.vcf > All_samples_Exome_QC.DG5.clean.vcf.recode.ANN.HIGH.vcf

if you want to select "High" + "AF<0.2", you can try the following script:

java -jar /gpfs/home/guosa/hpc/tools/snpEff/SnpSift.jar filter "(ANN[0].IMPACT has 'HIGH')&& (AF< 0.2)" All_samples_Exome_QC.chr21.vcf.DR2L0.8.DG.snpEff.vcf > All_samples_Exome_QC.chr21.vcf.DR2L0.8.DG.snpEff.High.vcf

So what would you set ANN[0] to if you want the first annotation?

The first annotation is changeable. You can set ANN[0].ALLELE, ANN[0].EFFECT, ...

Log in to answer this question.