diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java index cba6c6636..9009039ea 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/TandemRepeatAnnotator.java @@ -52,6 +52,7 @@ package org.broadinstitute.gatk.tools.walkers.annotator; import org.apache.log4j.Logger; +import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.ActiveRegionBasedAnnotation; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; @@ -81,7 +82,7 @@ import java.util.*; * * */ -public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardAnnotation { +public class TandemRepeatAnnotator extends InfoFieldAnnotation implements StandardAnnotation, ActiveRegionBasedAnnotation { private final static Logger logger = Logger.getLogger(TandemRepeatAnnotator.class); private boolean walkerIdentityCheckWarningLogged = false; @@ -93,15 +94,6 @@ public class TandemRepeatAnnotator extends InfoFieldAnnotation implements Standa final VariantContext vc, final Map stratifiedPerReadAlleleLikelihoodMap) throws UserException { - // Can not be called from HaplotypeCaller - if ( walker instanceof HaplotypeCaller ) { - if ( !walkerIdentityCheckWarningLogged ) { - logger.warn("Annotation will not be calculated, can not be called from HaplotypeCaller"); - walkerIdentityCheckWarningLogged = true; - } - return null; - } - if ( !vc.isIndel()) return null; diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java index 0c20f4661..590eb112a 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCallerGenotypingEngine.java @@ -54,6 +54,7 @@ package org.broadinstitute.gatk.tools.walkers.haplotypecaller; import com.google.java.contract.Ensures; import com.google.java.contract.Requires; import htsjdk.variant.variantcontext.*; +import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.genotyper.AlleleList; import org.broadinstitute.gatk.utils.genotyper.IndexedAlleleList; import org.broadinstitute.gatk.utils.genotyper.SampleList; @@ -272,7 +273,8 @@ public class HaplotypeCallerGenotypingEngine extends GenotypingEngine readLikelihoods, final VariantContext vc) { //TODO we transform the read-likelihood into the Map^2 previous version for the sake of not changing of not changing annotation interface. //TODO should we change those interfaces? final Map annotationLikelihoods = readLikelihoods.toPerReadAlleleLikelihoodMap(); - return annotateContextForActiveRegion(tracker, annotationLikelihoods, vc); + return annotateContextForActiveRegion(referenceContext, tracker, annotationLikelihoods, vc); } - public VariantContext annotateContextForActiveRegion(final RefMetaDataTracker tracker, + public VariantContext annotateContextForActiveRegion(final ReferenceContext referenceContext, + final RefMetaDataTracker tracker, final Map perReadAlleleLikelihoodMap, final VariantContext vc) { final Map infoAnnotations = new LinkedHashMap<>(vc.getAttributes()); @@ -238,7 +240,7 @@ public class VariantAnnotatorEngine { if ( !(annotationType instanceof ActiveRegionBasedAnnotation) ) continue; - final Map annotationsFromCurrentType = annotationType.annotate(perReadAlleleLikelihoodMap, vc); + final Map annotationsFromCurrentType = annotationType.annotate(referenceContext, perReadAlleleLikelihoodMap, vc); if ( annotationsFromCurrentType != null ) { infoAnnotations.putAll(annotationsFromCurrentType); } diff --git a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java index d1fb3f015..32f6b90f7 100644 --- a/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java +++ b/public/gatk-tools-public/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/interfaces/InfoFieldAnnotation.java @@ -25,6 +25,7 @@ package org.broadinstitute.gatk.tools.walkers.annotator.interfaces; +import org.broadinstitute.gatk.utils.GenomeLoc; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker; @@ -51,6 +52,10 @@ public abstract class InfoFieldAnnotation extends VariantAnnotatorAnnotation { return annotate(null, null, null, null, vc, perReadAlleleLikelihoodMap); } + public Map annotate(ReferenceContext referenceContext, Map perReadAlleleLikelihoodMap, VariantContext vc) { + + return annotate(null, null, referenceContext, null, vc, perReadAlleleLikelihoodMap); + } public abstract Map annotate(final RefMetaDataTracker tracker, final AnnotatorCompatible walker,