From 0571d9dcb95f3535eef3603d79d75e579b47f0c9 Mon Sep 17 00:00:00 2001 From: ebanks Date: Thu, 24 Dec 2009 20:47:32 +0000 Subject: [PATCH] Point MAX_QUAL_SCORE to SAMUtils.MAX_PHRED_SCORE. Also, array size for caches should be max score + 1. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2444 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/walkers/genotyper/GenotypeLikelihoods.java | 2 +- .../sting/gatk/walkers/genotyper/PooledCalculationModel.java | 2 +- java/src/org/broadinstitute/sting/utils/QualityUtils.java | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java index e1203898f..c6269f032 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java @@ -328,7 +328,7 @@ public class GenotypeLikelihoods implements Cloneable { return 1; } - static GenotypeLikelihoods[][][][][][] CACHE = new GenotypeLikelihoods[BaseMismatchModel.values().length][EmpiricalSubstitutionProbabilities.SequencerPlatform.values().length][BaseUtils.BASES.length][QualityUtils.MAX_QUAL_SCORE][MAX_PLOIDY][2]; + static GenotypeLikelihoods[][][][][][] CACHE = new GenotypeLikelihoods[BaseMismatchModel.values().length][EmpiricalSubstitutionProbabilities.SequencerPlatform.values().length][BaseUtils.BASES.length][QualityUtils.MAX_QUAL_SCORE+1][MAX_PLOIDY][2]; private boolean inCache( char observedBase, byte qualityScore, int ploidy, SAMRecord read) { return getCache(CACHE, observedBase, qualityScore, ploidy, read) != null; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PooledCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PooledCalculationModel.java index c74c2f074..9cfbb4fad 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PooledCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PooledCalculationModel.java @@ -77,7 +77,7 @@ public class PooledCalculationModel extends JointEstimateGenotypeCalculationMode static double[][][][][][][][] CACHE = null; static int N_CACHED = 0; private static void makeCache(int pool_size) { - CACHE = new double[BaseMismatchModel.values().length][EmpiricalSubstitutionProbabilities.SequencerPlatform.values().length][BaseUtils.BASES.length][BaseUtils.BASES.length][BaseUtils.BASES.length][QualityUtils.MAX_QUAL_SCORE][2][2 * pool_size+1]; + CACHE = new double[BaseMismatchModel.values().length][EmpiricalSubstitutionProbabilities.SequencerPlatform.values().length][BaseUtils.BASES.length][BaseUtils.BASES.length][BaseUtils.BASES.length][QualityUtils.MAX_QUAL_SCORE+1][2][2 * pool_size+1]; } protected void setCache( int refIndex, int altIndex, int nAltAlleles, char base, byte qual, SAMRecord read, double val ) { diff --git a/java/src/org/broadinstitute/sting/utils/QualityUtils.java b/java/src/org/broadinstitute/sting/utils/QualityUtils.java index 6fae2a380..1b5620301 100755 --- a/java/src/org/broadinstitute/sting/utils/QualityUtils.java +++ b/java/src/org/broadinstitute/sting/utils/QualityUtils.java @@ -1,5 +1,7 @@ package org.broadinstitute.sting.utils; +import net.sf.samtools.SAMUtils; + /** * QualityUtils is a static class (no instantiation allowed!) with some utility methods for manipulating * quality scores. @@ -7,7 +9,7 @@ package org.broadinstitute.sting.utils; * @author Kiran Garimella */ public class QualityUtils { - public final static byte MAX_QUAL_SCORE = 63; + public final static byte MAX_QUAL_SCORE = SAMUtils.MAX_PHRED_SCORE; public final static double MIN_REASONABLE_ERROR = 0.0001; public final static byte MAX_REASONABLE_Q_SCORE = 40;