diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/LikelihoodCalculationEngine.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/LikelihoodCalculationEngine.java index 0552abd4e..afc30318c 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/LikelihoodCalculationEngine.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/LikelihoodCalculationEngine.java @@ -72,10 +72,10 @@ public class LikelihoodCalculationEngine { switch (hmmType) { case EXACT: - pairHMM = new ExactPairHMM(); + pairHMM = new Log10PairHMM(true); break; case ORIGINAL: - pairHMM = new OriginalPairHMM(); + pairHMM = new Log10PairHMM(false); break; case LOGLESS_CACHING: pairHMM = new LoglessCachingPairHMM(); diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java index 6717a4bea..f5f4b9aeb 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java @@ -48,14 +48,12 @@ package org.broadinstitute.sting.gatk.walkers.indels; import com.google.java.contract.Ensures; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; -import org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap; import org.broadinstitute.sting.utils.Haplotype; import org.broadinstitute.sting.utils.MathUtils; import org.broadinstitute.sting.utils.clipping.ReadClipper; import org.broadinstitute.sting.utils.exceptions.UserException; -import org.broadinstitute.sting.utils.pairhmm.ExactPairHMM; -//import org.broadinstitute.sting.utils.pairhmm.LoglessCachingPairHMM; -import org.broadinstitute.sting.utils.pairhmm.OriginalPairHMM; +import org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap; +import org.broadinstitute.sting.utils.pairhmm.Log10PairHMM; import org.broadinstitute.sting.utils.pairhmm.PairHMM; import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; @@ -68,6 +66,8 @@ import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; +//import org.broadinstitute.sting.utils.pairhmm.LoglessCachingPairHMM; + public class PairHMMIndelErrorModel { public static final int BASE_QUAL_THRESHOLD = 20; @@ -116,10 +116,10 @@ public class PairHMMIndelErrorModel { switch (hmmType) { case EXACT: - pairHMM = new ExactPairHMM(); + pairHMM = new Log10PairHMM(true); break; case ORIGINAL: - pairHMM = new OriginalPairHMM(); + pairHMM = new Log10PairHMM(false); break; case LOGLESS_CACHING: //TODO: still not tested so please do not use yet //pairHMM = new LoglessCachingPairHMM(); //TODO - add it back when the figure out how to use the protected LoglessCachingPairHMM class diff --git a/protected/java/test/org/broadinstitute/sting/utils/pairhmm/PairHMMUnitTest.java b/protected/java/test/org/broadinstitute/sting/utils/pairhmm/PairHMMUnitTest.java index 8172c2d1b..c463b7f44 100644 --- a/protected/java/test/org/broadinstitute/sting/utils/pairhmm/PairHMMUnitTest.java +++ b/protected/java/test/org/broadinstitute/sting/utils/pairhmm/PairHMMUnitTest.java @@ -66,8 +66,8 @@ import java.util.Random; public class PairHMMUnitTest extends BaseTest { private final static boolean DEBUG = false; final static boolean EXTENSIVE_TESTING = false; // TODO -- should be true - PairHMM exactHMM = new ExactPairHMM(); // the log truth implementation - PairHMM originalHMM = new OriginalPairHMM(); // the reference implementation + PairHMM exactHMM = new Log10PairHMM(true); // the log truth implementation + PairHMM originalHMM = new Log10PairHMM(false); // the reference implementation PairHMM loglessHMM = new LoglessCachingPairHMM(); private List getHMMs() { @@ -114,11 +114,11 @@ public class PairHMMUnitTest extends BaseTest { } public double getTolerance(final PairHMM hmm) { - if ( hmm instanceof ExactPairHMM || hmm instanceof LoglessCachingPairHMM ) + if ( hmm instanceof LoglessCachingPairHMM ) return toleranceFromExact(); - if ( hmm instanceof OriginalPairHMM ) - return toleranceFromReference(); - else + if ( hmm instanceof Log10PairHMM ) { + return ((Log10PairHMM)hmm).isDoingExactLog10Calculations() ? toleranceFromExact() : toleranceFromReference(); + } else return toleranceFromTheoretical(); } diff --git a/public/java/src/org/broadinstitute/sting/utils/pairhmm/ExactPairHMM.java b/public/java/src/org/broadinstitute/sting/utils/pairhmm/ExactPairHMM.java deleted file mode 100644 index ba34a2861..000000000 --- a/public/java/src/org/broadinstitute/sting/utils/pairhmm/ExactPairHMM.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2012 The Broad Institute -* -* Permission is hereby granted, free of charge, to any person -* obtaining a copy of this software and associated documentation -* files (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, -* copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following -* conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -* THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -package org.broadinstitute.sting.utils.pairhmm; - -/** - * Just use the Log10PairHMM directly - */ -@Deprecated() -public class ExactPairHMM extends Log10PairHMM { - /** - * Create a original PairHMM class that performs the log10 HMM with exact log10 calculations - */ - public ExactPairHMM() { - super(true); - } -} diff --git a/public/java/src/org/broadinstitute/sting/utils/pairhmm/Log10PairHMM.java b/public/java/src/org/broadinstitute/sting/utils/pairhmm/Log10PairHMM.java index 8c6b97540..ea2f18f0e 100644 --- a/public/java/src/org/broadinstitute/sting/utils/pairhmm/Log10PairHMM.java +++ b/public/java/src/org/broadinstitute/sting/utils/pairhmm/Log10PairHMM.java @@ -50,6 +50,14 @@ public class Log10PairHMM extends PairHMM { this.doExactLog10 = doExactLog10; } + /** + * Is this HMM using exact log10 calculations? + * @return true if exact, false if approximate + */ + public boolean isDoingExactLog10Calculations() { + return doExactLog10; + } + @Override public void initialize( final int READ_MAX_LENGTH, final int HAPLOTYPE_MAX_LENGTH ) { super.initialize(READ_MAX_LENGTH, HAPLOTYPE_MAX_LENGTH); diff --git a/public/java/src/org/broadinstitute/sting/utils/pairhmm/OriginalPairHMM.java b/public/java/src/org/broadinstitute/sting/utils/pairhmm/OriginalPairHMM.java deleted file mode 100644 index beb22ed33..000000000 --- a/public/java/src/org/broadinstitute/sting/utils/pairhmm/OriginalPairHMM.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2012 The Broad Institute -* -* Permission is hereby granted, free of charge, to any person -* obtaining a copy of this software and associated documentation -* files (the "Software"), to deal in the Software without -* restriction, including without limitation the rights to use, -* copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following -* conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -* THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -package org.broadinstitute.sting.utils.pairhmm; - -/** - * Just use the Log10PairHMM directly - */ -@Deprecated() -public class OriginalPairHMM extends Log10PairHMM { - /** - * Create a original PairHMM class that performs the log10 HMM with approximate log10 calculations - */ - public OriginalPairHMM() { - super(false); - } -} \ No newline at end of file