From 8901e638796e719fb8efd1a9cee9eb4ca26abf05 Mon Sep 17 00:00:00 2001 From: ebanks Date: Sun, 5 Dec 2010 04:36:21 +0000 Subject: [PATCH] Cheap optimization: don't keep calculating the log of a constant. (How did I not catch this before?) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4791 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java index 3b390df72..818346506 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidSNPGenotypeLikelihoods.java @@ -69,6 +69,7 @@ import static java.lang.Math.pow; public class DiploidSNPGenotypeLikelihoods implements Cloneable { protected final static int FIXED_PLOIDY = 2; protected final static int MAX_PLOIDY = FIXED_PLOIDY + 1; + protected final static double ploidyAdjustment = log10(FIXED_PLOIDY); protected boolean enableCacheFlag = true; protected boolean VERBOSE = false; @@ -407,8 +408,6 @@ public class DiploidSNPGenotypeLikelihoods implements Cloneable { gl.setToZero(); // we need to adjust for ploidy. We take the raw p(obs | chrom) / ploidy, which is -log10(ploidy) in log space - double ploidyAdjustment = log10(FIXED_PLOIDY); - for ( DiploidGenotype g : DiploidGenotype.values() ) { // todo assumes ploidy is 2 -- should be generalized. Obviously the below code can be turned into a loop