1 package org.broadinstitute.hellbender.tools.walkers.annotator; 2 3 import htsjdk.variant.variantcontext.Allele; 4 import htsjdk.variant.variantcontext.VariantContext; 5 import htsjdk.variant.vcf.VCFInfoHeaderLine; 6 import org.broadinstitute.hellbender.engine.ReferenceContext; 7 import org.broadinstitute.hellbender.utils.genotyper.AlleleLikelihoods; 8 import org.broadinstitute.hellbender.utils.read.GATKRead; 9 import org.broadinstitute.hellbender.utils.variant.GATKVCFHeaderLines; 10 11 import java.util.ArrayList; 12 import java.util.List; 13 import java.util.Map; 14 15 /** 16 * Annotations relevant to the INFO field of the variant file (ie annotations for sites). 17 */ 18 public abstract class InfoFieldAnnotation extends VariantAnnotation{ 19 20 /** 21 * Computes the annotation for the given variant and the likelihoods per read. 22 * Returns a map from annotation keys to values (may be empty if no annotation is to be added). 23 * 24 * @param ref Reference context, may be null 25 * @param vc Variant to be annotated. Not null. 26 * @param likelihoods likelihoods indexed by sample, allele, and read within sample 27 */ annotate(final ReferenceContext ref, final VariantContext vc, final AlleleLikelihoods<GATKRead, Allele> likelihoods)28 public abstract Map<String, Object> annotate(final ReferenceContext ref, 29 final VariantContext vc, 30 final AlleleLikelihoods<GATKRead, Allele> likelihoods); 31 32 /** 33 * Returns the descriptions used for the VCF INFO meta field. 34 * Subclasses must ensure that this list is not null and does not contain null. 35 */ getDescriptions()36 public List<VCFInfoHeaderLine> getDescriptions() { 37 final List<VCFInfoHeaderLine> lines = new ArrayList<>(getKeyNames().size()); 38 for (final String key : getKeyNames()) { 39 lines.add(GATKVCFHeaderLines.getInfoLine(key)); 40 } 41 return lines; 42 } 43 }