This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to Get only one annotation with the SnpEff annotation?

Dear All,

As you know when annotationg a vcf file each line might have more than one annotation but I would like to get only one annotation for a line? the first one only if possible.

So thanks in advance.

snp annotation snpeff variation

a variant can overlap multiple transcripts with different consequences; So why would you want to do this ?

Yeah you are right but for some reason I only would like to get only the first annotation. :)

1 answer

using vcffilterjdk: http://lindenb.github.io/jvarkit/VcfFilterJdk.html

 java -jar dist/vcffilterjdk.jar -e 'final String ann="ANN";List<Object> atts = variant.getAttributeAsList(ann); return atts.size()<=1 ? variant : new VariantContextBuilder(variant).attribute(ann,atts.get(0)).make();' input1.vcf

Log in to answer this question.