diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java deleted file mode 100755 index 353fd1c2c..000000000 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.broadinstitute.sting.gatk.walkers.annotator; - -import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; -import org.broadinstitute.sting.utils.variantcontext.Genotype; - -import java.util.Map; - -/** - * Abstract base class for all annotations that are normalized by depth - */ -public abstract class AnnotationByDepth extends InfoFieldAnnotation { - - - protected int annotationByVariantDepth(final Map genotypes, Map stratifiedContexts) { - int depth = 0; - for ( Map.Entry genotype : genotypes.entrySet() ) { - - // we care only about variant calls - if ( genotype.getValue().isHomRef() ) - continue; - - AlignmentContext context = stratifiedContexts.get(genotype.getKey()); - if ( context != null ) - depth += context.size(); - } - - return depth; - } - - -} \ No newline at end of file diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java index ae9a34ae2..7fcb56b1a 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java @@ -4,6 +4,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker; +import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType; import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine; @@ -20,7 +21,7 @@ import java.util.Map; * * Low scores are indicative of false positive calls and artifacts. */ -public class QualByDepth extends AnnotationByDepth implements StandardAnnotation { +public class QualByDepth extends InfoFieldAnnotation implements StandardAnnotation { public Map annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { if ( stratifiedContexts.size() == 0 ) @@ -48,8 +49,7 @@ public class QualByDepth extends AnnotationByDepth implements StandardAnnotation if ( depth == 0 ) return null; - int qDepth = annotationByVariantDepth(genotypes, stratifiedContexts); - double QD = 10.0 * vc.getNegLog10PError() / (double)qDepth; + double QD = 10.0 * vc.getNegLog10PError() / (double)depth; Map map = new HashMap(); map.put(getKeyNames().get(0), String.format("%.2f", QD)); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java deleted file mode 100755 index 131b87794..000000000 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.broadinstitute.sting.gatk.walkers.annotator; - -import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.contexts.ReferenceContext; -import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; -import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotatorCompatibleWalker; -import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants; -import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType; -import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine; -import org.broadinstitute.sting.utils.variantcontext.Genotype; -import org.broadinstitute.sting.utils.variantcontext.VariantContext; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * SB annotation value by depth of alt containing samples - */ -public class SBByDepth extends AnnotationByDepth { - - public Map annotate(RefMetaDataTracker tracker, AnnotatorCompatibleWalker walker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { - if ( stratifiedContexts.size() == 0 ) - return null; - - if (!vc.hasAttribute(VCFConstants.STRAND_BIAS_KEY)) - return null; - - double sBias = vc.getAttributeAsDouble(VCFConstants.STRAND_BIAS_KEY, -1); - - final Map genotypes = vc.getGenotypes(); - if ( genotypes == null || genotypes.size() == 0 ) - return null; - - int sDepth = annotationByVariantDepth(genotypes, stratifiedContexts); - if ( sDepth == 0 ) - return null; - - - - double SbyD = (-sBias / (double)sDepth); - if (SbyD > 0) - SbyD = Math.log10(SbyD); - else - SbyD = -1000; - - Map map = new HashMap(); - map.put(getKeyNames().get(0), String.format("%.2f", SbyD)); - return map; - } - - public List getKeyNames() { return Arrays.asList("SBD"); } - - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Strand Bias by Depth")); } - - - -} \ No newline at end of file