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.apache.logging.log4j.LogManager; 7 import org.apache.logging.log4j.Logger; 8 import org.broadinstitute.hellbender.engine.ReferenceContext; 9 import org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_StrandBiasTest; 10 import org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AlleleSpecificAnnotation; 11 import org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AlleleSpecificAnnotationData; 12 import org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.StrandBiasUtils; 13 import org.broadinstitute.hellbender.utils.Utils; 14 import org.broadinstitute.hellbender.utils.genotyper.AlleleLikelihoods; 15 import org.broadinstitute.hellbender.utils.read.GATKRead; 16 import org.broadinstitute.hellbender.utils.variant.GATKVCFConstants; 17 18 import java.util.Collections; 19 import java.util.List; 20 import java.util.Map; 21 22 /** 23 * Adds the strand bias table annotation for use in mutect filters 24 */ 25 public class AS_StrandBiasMutectAnnotation extends InfoFieldAnnotation implements StandardMutectAnnotation, AlleleSpecificAnnotation { 26 private final static Logger logger = LogManager.getLogger(StrandBiasBySample.class); 27 28 @Override annotate(ReferenceContext ref, VariantContext vc, AlleleLikelihoods<GATKRead, Allele> likelihoods)29 public Map<String, Object> annotate(ReferenceContext ref, VariantContext vc, AlleleLikelihoods<GATKRead, Allele> likelihoods) { 30 Utils.nonNull(vc); 31 32 if ( likelihoods == null ) { 33 logger.warn("Annotation will not be calculated, alleleLikelihoodMap is null"); 34 return null; 35 } 36 37 return StrandBiasUtils.computeSBAnnotation(vc, likelihoods, GATKVCFConstants.AS_SB_TABLE_KEY); 38 } 39 40 @Override getDescriptions()41 public List<VCFInfoHeaderLine> getDescriptions() { 42 return super.getDescriptions(); 43 } 44 45 @Override getKeyNames()46 public List<String> getKeyNames() { 47 return Collections.singletonList(GATKVCFConstants.AS_SB_TABLE_KEY); 48 } 49 } 50