diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationPerformanceTest.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationPerformanceTest.java index bcb6af7f3..e4c07d6f7 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationPerformanceTest.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationPerformanceTest.java @@ -53,14 +53,14 @@ public class ExactAFCalculationPerformanceTest { final SimpleTimer timer = new SimpleTimer(); for ( final int nonTypePL : Arrays.asList(10, 100, 1000) ) { - final ExactAFCalculation calc = testBuilder.makeModel(); + final ExactAFCalc calc = testBuilder.makeModel(); final double[] priors = testBuilder.makePriors(); for ( int[] ACs : makeACs(testBuilder.numAltAlleles, testBuilder.nSamples*2) ) { final VariantContext vc = testBuilder.makeACTest(ACs, 0, nonTypePL); timer.start(); - final AlleleFrequencyCalculationResult result = calc.getLog10PNonRef(vc, priors); + final AFCalcResult result = calc.getLog10PNonRef(vc, priors); final long runtime = timer.getElapsedTimeNano(); int otherAC = 0; @@ -109,7 +109,7 @@ public class ExactAFCalculationPerformanceTest { final SimpleTimer timer = new SimpleTimer(); for ( final int nonTypePL : Arrays.asList(100) ) { - final ExactAFCalculation calc = testBuilder.makeModel(); + final ExactAFCalc calc = testBuilder.makeModel(); final double[] priors = testBuilder.makePriors(); final int[] ac = new int[testBuilder.numAltAlleles]; @@ -123,7 +123,7 @@ public class ExactAFCalculationPerformanceTest { vcb.genotypes(genotypes); timer.start(); - final AlleleFrequencyCalculationResult result = calc.getLog10PNonRef(vcb.make(), priors); + final AFCalcResult result = calc.getLog10PNonRef(vcb.make(), priors); final long runtime = timer.getElapsedTimeNano(); final List columns = new LinkedList(coreValues); @@ -143,7 +143,7 @@ public class ExactAFCalculationPerformanceTest { final SimpleTimer timer = new SimpleTimer(); for ( final int nonTypePL : Arrays.asList(100) ) { - final ExactAFCalculation calc = testBuilder.makeModel(); + final ExactAFCalc calc = testBuilder.makeModel(); final double[] priors = testBuilder.makePriors(); final int[] ac = new int[testBuilder.numAltAlleles]; @@ -153,7 +153,7 @@ public class ExactAFCalculationPerformanceTest { final VariantContext vc = testBuilder.makeACTest(ac, nNonInformative, nonTypePL); timer.start(); - final AlleleFrequencyCalculationResult result = calc.getLog10PNonRef(vc, priors); + final AFCalcResult result = calc.getLog10PNonRef(vc, priors); final long runtime = timer.getElapsedTimeNano(); final List columns = new LinkedList(coreValues); diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationTestBuilder.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationTestBuilder.java index 2fb9947e1..41544d0f9 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationTestBuilder.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationTestBuilder.java @@ -47,11 +47,11 @@ public class ExactAFCalculationTestBuilder { return nSamples; } - public ExactAFCalculation makeModel() { + public ExactAFCalc makeModel() { switch (modelType) { - case ReferenceDiploidExact: return new ReferenceDiploidExactAFCalculation(nSamples, 4); - case ConstrainedDiploidExact: return new ConstrainedDiploidExactAFCalculation(nSamples, 4); - case GeneralExact: return new GeneralPloidyExactAFCalculation(nSamples, 4, 2); + case ReferenceDiploidExact: return new ReferenceDiploidExactAFCalc(nSamples, 4); + case ConstrainedDiploidExact: return new ConstrainedDiploidExactAFCalc(nSamples, 4); + case GeneralExact: return new GeneralPloidyExactAFCalc(nSamples, 4, 2); default: throw new RuntimeException("Unexpected type " + modelType); } } diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculation.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalc.java similarity index 97% rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculation.java rename to protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalc.java index a179d87f9..77dff98c6 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalculation.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyExactAFCalc.java @@ -37,19 +37,19 @@ import org.broadinstitute.sting.utils.variantcontext.*; import java.io.PrintStream; import java.util.*; -public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { +public class GeneralPloidyExactAFCalc extends ExactAFCalc { static final int MAX_LENGTH_FOR_POOL_PL_LOGGING = 10; // if PL vectors longer than this # of elements, don't log them private final int ploidy; private final static double MAX_LOG10_ERROR_TO_STOP_EARLY = 6; // we want the calculation to be accurate to 1 / 10^6 private final static boolean VERBOSE = false; - protected GeneralPloidyExactAFCalculation(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { + protected GeneralPloidyExactAFCalc(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { super(UAC, N, logger, verboseWriter); ploidy = UAC.samplePloidy; } - public GeneralPloidyExactAFCalculation(final int nSamples, final int maxAltAlleles, final int ploidy) { + public GeneralPloidyExactAFCalc(final int nSamples, final int maxAltAlleles, final int ploidy) { super(nSamples, maxAltAlleles, maxAltAlleles, null, null, null); this.ploidy = ploidy; } @@ -78,7 +78,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { @Override public void computeLog10PNonRef(final VariantContext vc, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { combineSinglePools(vc.getGenotypes(), vc.getNAlleles(), ploidy, log10AlleleFrequencyPriors, result); } @@ -186,7 +186,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { final int numAlleles, final int ploidyPerPool, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { final ArrayList genotypeLikelihoods = getGLs(GLs); @@ -213,7 +213,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { public static CombinedPoolLikelihoods fastCombineMultiallelicPool(final CombinedPoolLikelihoods originalPool, double[] newGL, int originalPloidy, int newGLPloidy, int numAlleles, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { @@ -276,7 +276,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { final double[] log10AlleleFrequencyPriors, final int originalPloidy, final int newGLPloidy, - final AlleleFrequencyCalculationResult result, + final AFCalcResult result, final StateTracker stateTracker, final LinkedList ACqueue, final HashMap indexesToACset) { @@ -343,7 +343,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { */ public static void combineMultiallelicPoolNaively(CombinedPoolLikelihoods originalPool, double[] yy, int ploidy1, int ploidy2, int numAlleles, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { /* final int dim1 = GenotypeLikelihoods.numLikelihoods(numAlleles, ploidy1); final int dim2 = GenotypeLikelihoods.numLikelihoods(numAlleles, ploidy2); @@ -405,7 +405,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { final double[] secondGL, final double[] log10AlleleFrequencyPriors, final int numAlleles, final int ploidy1, final int ploidy2, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { final int newPloidy = ploidy1 + ploidy2; @@ -511,7 +511,7 @@ public class GeneralPloidyExactAFCalculation extends ExactAFCalculation { */ public static ProbabilityVector combineBiallelicPoolsNaively(final ProbabilityVector originalPool, final double[] newPLVector, final int ploidy1, final int ploidy2, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { final int newPloidy = ploidy1 + ploidy2; diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationModelUnitTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationModelUnitTest.java index 9038caba4..aaa0706e7 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationModelUnitTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculationModelUnitTest.java @@ -53,16 +53,16 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { private class GetGLsTest extends TestDataProvider { GenotypesContext GLs; int numAltAlleles; - final ExactAFCalculation calc; + final ExactAFCalc calc; final int[] expectedACs; final double[] priors; final String priorName; - private GetGLsTest(final ExactAFCalculation calculation, int numAltAlleles, List arg, final double[] priors, final String priorName) { + private GetGLsTest(final ExactAFCalc calc, int numAltAlleles, List arg, final double[] priors, final String priorName) { super(GetGLsTest.class); GLs = GenotypesContext.create(new ArrayList(arg)); this.numAltAlleles = numAltAlleles; - this.calc = calculation; + this.calc = calc; this.priors = priors; this.priorName = priorName; @@ -76,12 +76,12 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { } } - public AlleleFrequencyCalculationResult execute() { + public AFCalcResult execute() { return getCalc().getLog10PNonRef(getVC(), getPriors()); } - public AlleleFrequencyCalculationResult executeRef() { - final ExactAFCalculation ref = new ReferenceDiploidExactAFCalculation(getCalc().nSamples, getCalc().getMaxAltAlleles()); + public AFCalcResult executeRef() { + final ExactAFCalc ref = new ReferenceDiploidExactAFCalc(getCalc().nSamples, getCalc().getMaxAltAlleles()); return ref.getLog10PNonRef(getVC(), getPriors()); } @@ -89,7 +89,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { return priors; } - public ExactAFCalculation getCalc() { + public ExactAFCalc getCalc() { return calc; } @@ -122,9 +122,9 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { final List triAllelicSamples = Arrays.asList(AA2, AB2, BB2, AC2, BC2, CC2); for ( final int nSamples : Arrays.asList(1, 2, 3, 4) ) { - final ExactAFCalculation diploidCalc = new ReferenceDiploidExactAFCalculation(nSamples, 4); - final ExactAFCalculation optDiploidCalc = new ConstrainedDiploidExactAFCalculation(nSamples, 4); - final ExactAFCalculation generalCalc = new GeneralPloidyExactAFCalculation(nSamples, 4, 2); + final ExactAFCalc diploidCalc = new ReferenceDiploidExactAFCalc(nSamples, 4); + final ExactAFCalc optDiploidCalc = new ConstrainedDiploidExactAFCalc(nSamples, 4); + final ExactAFCalc generalCalc = new GeneralPloidyExactAFCalc(nSamples, 4, 2); final int nPriorValues = 2*nSamples+1; final double[] flatPriors = MathUtils.normalizeFromLog10(new double[nPriorValues], true); // flat priors @@ -132,7 +132,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { UnifiedGenotyperEngine.computeAlleleFrequencyPriors(nPriorValues - 1, humanPriors, 0.001); for ( final double[] priors : Arrays.asList(flatPriors, humanPriors) ) { // , humanPriors) ) { - for ( ExactAFCalculation model : Arrays.asList(diploidCalc, generalCalc, optDiploidCalc) ) { + for ( ExactAFCalc model : Arrays.asList(diploidCalc, generalCalc, optDiploidCalc) ) { final String priorName = priors == humanPriors ? "human" : "flat"; // bi-allelic @@ -179,12 +179,12 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { samples.addAll(Collections.nCopies(nNonInformative, testData.nonInformative)); final int nSamples = samples.size(); - final ExactAFCalculation diploidCalc = new ReferenceDiploidExactAFCalculation(nSamples, 4); - final ExactAFCalculation optDiploidCalc = new ConstrainedDiploidExactAFCalculation(nSamples, 4); - final ExactAFCalculation generalCalc = new GeneralPloidyExactAFCalculation(nSamples, 4, 2); + final ExactAFCalc diploidCalc = new ReferenceDiploidExactAFCalc(nSamples, 4); + final ExactAFCalc optDiploidCalc = new ConstrainedDiploidExactAFCalc(nSamples, 4); + final ExactAFCalc generalCalc = new GeneralPloidyExactAFCalc(nSamples, 4, 2); final double[] priors = new double[2*nSamples+1]; // flat priors - for ( ExactAFCalculation model : Arrays.asList(diploidCalc, optDiploidCalc, generalCalc) ) { + for ( ExactAFCalc model : Arrays.asList(diploidCalc, optDiploidCalc, generalCalc) ) { final GetGLsTest onlyInformative = new GetGLsTest(model, testData.nAltAlleles, testData.called, priors, "flat"); for ( int rotation = 0; rotation < nSamples; rotation++ ) { @@ -206,8 +206,8 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { @Test(enabled = true, dataProvider = "GLsWithNonInformative", dependsOnMethods = "testGLs") public void testGLsWithNonInformative(GetGLsTest onlyInformative, GetGLsTest withNonInformative) { - final AlleleFrequencyCalculationResult expected = onlyInformative.execute(); - final AlleleFrequencyCalculationResult actual = withNonInformative.execute(); + final AFCalcResult expected = onlyInformative.execute(); + final AFCalcResult actual = withNonInformative.execute(); testResultSimple(withNonInformative); @@ -222,8 +222,8 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { } private void testResultSimple(final GetGLsTest cfg) { - final AlleleFrequencyCalculationResult refResult = cfg.executeRef(); - final AlleleFrequencyCalculationResult result = cfg.execute(); + final AFCalcResult refResult = cfg.executeRef(); + final AFCalcResult result = cfg.execute(); compareToRefResult(refResult, result); @@ -254,8 +254,8 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { // } } - private void compareToRefResult(final AlleleFrequencyCalculationResult refResult, - final AlleleFrequencyCalculationResult result) { + private void compareToRefResult(final AFCalcResult refResult, + final AFCalcResult result) { final double TOLERANCE = 1; // MAP may not be equal // Assert.assertEquals(result.getAlleleCountsOfMAP(), refResult.getAlleleCountsOfMAP()); @@ -271,23 +271,23 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { } @Test(enabled = true, dataProvider = "Models") - public void testLargeGLs(final ExactAFCalculation calc) { + public void testLargeGLs(final ExactAFCalc calc) { final Genotype BB = makePL(Arrays.asList(C, C), 20000000, 20000000, 0); GetGLsTest cfg = new GetGLsTest(calc, 1, Arrays.asList(BB, BB, BB), FLAT_3SAMPLE_PRIORS, "flat"); - final AlleleFrequencyCalculationResult result = cfg.execute(); + final AFCalcResult result = cfg.execute(); int calculatedAlleleCount = result.getAlleleCountsOfMAP()[0]; Assert.assertEquals(calculatedAlleleCount, 6); } @Test(enabled = true, dataProvider = "Models") - public void testMismatchedGLs(final ExactAFCalculation calc) { + public void testMismatchedGLs(final ExactAFCalc calc) { final Genotype AB = makePL(Arrays.asList(A, C), 2000, 0, 2000, 2000, 2000, 2000); final Genotype AC = makePL(Arrays.asList(A, G), 100, 100, 100, 0, 100, 100); GetGLsTest cfg = new GetGLsTest(calc, 2, Arrays.asList(AB, AC), FLAT_3SAMPLE_PRIORS, "flat"); - final AlleleFrequencyCalculationResult result = cfg.execute(); + final AFCalcResult result = cfg.execute(); Assert.assertEquals(result.getAlleleCountsOfMAP()[0], 1); Assert.assertEquals(result.getAlleleCountsOfMAP()[1], 1); @@ -297,15 +297,15 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { public Object[][] makeModels() { List tests = new ArrayList(); - tests.add(new Object[]{new ReferenceDiploidExactAFCalculation(2, 4)}); -// tests.add(new Object[]{new ConstrainedDiploidExactAFCalculation(2, 4)}); -// tests.add(new Object[]{new GeneralPloidyExactAFCalculation(2, 4, 2)}); + tests.add(new Object[]{new ReferenceDiploidExactAFCalc(2, 4)}); +// tests.add(new Object[]{new ConstrainedDiploidExactAFCalc(2, 4)}); +// tests.add(new Object[]{new GeneralPloidyExactAFCalc(2, 4, 2)}); return tests.toArray(new Object[][]{}); } @Test(enabled = true, dataProvider = "Models") - public void testBiallelicPriors(final ExactAFCalculation model) { + public void testBiallelicPriors(final ExactAFCalc model) { final int REF_PL = 10; final Genotype AB = makePL(Arrays.asList(A,C), REF_PL, 0, 10000); @@ -313,7 +313,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { final double refPrior = 1 - QualityUtils.qualToErrorProb(log10NonRefPrior); final double[] priors = MathUtils.toLog10(new double[]{refPrior, (1-refPrior) / 2, (1-refPrior) / 2}); GetGLsTest cfg = new GetGLsTest(model, 1, Arrays.asList(AB), priors, "pNonRef" + log10NonRefPrior); - final AlleleFrequencyCalculationResult result = cfg.execute(); + final AFCalcResult result = cfg.execute(); final int actualAC = result.getAlleleCountsOfMAP()[0]; final double pRefWithPrior = AB.getLikelihoods().getAsVector()[0] + priors[0]; @@ -333,7 +333,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { } @Test(enabled = false, dataProvider = "Models") - public void testTriallelicPriors(final ExactAFCalculation model) { + public void testTriallelicPriors(final ExactAFCalc model) { // TODO // TODO // TODO THIS SEEMS TO ID A BUG IN THE EXACT MODEL FOR MULTI-ALLELICS, AS THE @@ -349,7 +349,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { final double nonRefPrior = (1-refPrior) / 2; final double[] priors = MathUtils.toLog10(new double[]{refPrior, nonRefPrior, nonRefPrior, nonRefPrior, nonRefPrior, nonRefPrior}); GetGLsTest cfg = new GetGLsTest(model, 2, Arrays.asList(AB, AC), priors, "pNonRef" + log10NonRefPrior); - final AlleleFrequencyCalculationResult result = cfg.execute(); + final AFCalcResult result = cfg.execute(); final int actualAC_AB = result.getAlleleCountsOfMAP()[0]; final double pRefABWithPrior = AB.getLikelihoods().getAsVector()[0] + priors[0]; @@ -401,7 +401,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { ExactAFCalculationTestBuilder.PriorType.human); final VariantContext vc = testBuilder.makeACTest(requestedACs, nNonInformative, 100); - final int[] maxACsToVisit = ((ConstrainedDiploidExactAFCalculation)testBuilder.makeModel()).computeMaxACs(vc); + final int[] maxACsToVisit = ((ConstrainedDiploidExactAFCalc)testBuilder.makeModel()).computeMaxACs(vc); testExpectedACs(vc, maxACsToVisit); } @@ -466,7 +466,7 @@ public class ExactAFCalculationModelUnitTest extends BaseTest { final ExactAFCalculationTestBuilder testBuilder = new ExactAFCalculationTestBuilder(1, vc.getNAlleles()-1, modelType, ExactAFCalculationTestBuilder.PriorType.human); - final int[] maxACsToVisit = ((ConstrainedDiploidExactAFCalculation)testBuilder.makeModel()).computeMaxACs(vc); + final int[] maxACsToVisit = ((ConstrainedDiploidExactAFCalc)testBuilder.makeModel()).computeMaxACs(vc); testExpectedACs(vc, maxACsToVisit); } } \ No newline at end of file diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyAFCalculationModelUnitTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyAFCalculationModelUnitTest.java index e9edad75e..7381349ca 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyAFCalculationModelUnitTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/GeneralPloidyAFCalculationModelUnitTest.java @@ -138,11 +138,11 @@ public class GeneralPloidyAFCalculationModelUnitTest extends BaseTest { @Test(dataProvider = "getGLs") public void testGLs(GetGLsTest cfg) { - final AlleleFrequencyCalculationResult result = new AlleleFrequencyCalculationResult(cfg.numAltAlleles); + final AFCalcResult result = new AFCalcResult(cfg.numAltAlleles); final int len = GeneralPloidyGenotypeLikelihoods.getNumLikelihoodElements(1 + cfg.numAltAlleles, cfg.ploidy * cfg.GLs.size()); double[] priors = new double[len]; // flat priors - GeneralPloidyExactAFCalculation.combineSinglePools(cfg.GLs, 1 + cfg.numAltAlleles, cfg.ploidy, priors, result); + GeneralPloidyExactAFCalc.combineSinglePools(cfg.GLs, 1 + cfg.numAltAlleles, cfg.ploidy, priors, result); int nameIndex = 1; for ( int allele = 0; allele < cfg.numAltAlleles; allele++, nameIndex+=2 ) { int expectedAlleleCount = Integer.valueOf(cfg.name.substring(nameIndex, nameIndex+1)); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java index f06922add..d3dd46a0a 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedArgumentCollection.java @@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper; import org.broadinstitute.sting.commandline.*; import org.broadinstitute.sting.gatk.arguments.StandardCallerArgumentCollection; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AlleleFrequencyCalculation; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalc; import org.broadinstitute.sting.utils.variantcontext.VariantContext; import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils; @@ -42,7 +42,7 @@ public class UnifiedArgumentCollection extends StandardCallerArgumentCollection */ @Advanced @Argument(fullName = "p_nonref_model", shortName = "pnrm", doc = "Non-reference probability calculation model to employ", required = false) - protected AlleleFrequencyCalculation.Model AFmodel = AlleleFrequencyCalculation.Model.EXACT; + protected AFCalc.Model AFmodel = AFCalc.Model.EXACT; /** * The PCR error rate is independent of the sequencing error rate, which is necessary because we cannot necessarily diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java index 30a1439e4..3116d3a7d 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java @@ -249,7 +249,7 @@ public class UnifiedGenotyper extends LocusWalker, Unif throw new UserException("Incorrect genotype calculation model chosen. Only [POOLSNP|POOLINDEL|POOLBOTH] supported with this walker if sample ploidy != 2"); } - if (UAC.AFmodel != AlleleFrequencyCalculation.Model.POOL) + if (UAC.AFmodel != AFCalc.Model.POOL) throw new UserException("Incorrect AF Calculation model. Only POOL model supported if sample ploidy != 2"); } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java index 02645483b..cbe50b951 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -34,8 +34,8 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AlleleFrequencyCalculation; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AlleleFrequencyCalculationResult; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalc; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalcResult; import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.baq.BAQ; import org.broadinstitute.sting.utils.classloader.PluginManager; @@ -80,10 +80,10 @@ public class UnifiedGenotyperEngine { private ThreadLocal> glcm = new ThreadLocal>(); // the model used for calculating p(non-ref) - private ThreadLocal afcm = new ThreadLocal(); + private ThreadLocal afcm = new ThreadLocal(); // the allele frequency likelihoods and posteriors (allocated once as an optimization) - private ThreadLocal alleleFrequencyCalculationResult = new ThreadLocal(); + private ThreadLocal alleleFrequencyCalculationResult = new ThreadLocal(); // because the allele frequency priors are constant for a given i, we cache the results to avoid having to recompute everything private final double[] log10AlleleFrequencyPriorsSNPs; @@ -355,9 +355,9 @@ public class UnifiedGenotyperEngine { // initialize the data for this thread if that hasn't been done yet if ( afcm.get() == null ) { afcm.set(getAlleleFrequencyCalculationObject(N, logger, verboseWriter, UAC)); - alleleFrequencyCalculationResult.set(new AlleleFrequencyCalculationResult(UAC.MAX_ALTERNATE_ALLELES)); + alleleFrequencyCalculationResult.set(new AFCalcResult(UAC.MAX_ALTERNATE_ALLELES)); } - AlleleFrequencyCalculationResult AFresult = alleleFrequencyCalculationResult.get(); + AFCalcResult AFresult = alleleFrequencyCalculationResult.get(); // estimate our confidence in a reference call and return if ( vc.getNSamples() == 0 ) { @@ -743,9 +743,9 @@ public class UnifiedGenotyperEngine { return glcm; } - private static AlleleFrequencyCalculation getAlleleFrequencyCalculationObject(int N, Logger logger, PrintStream verboseWriter, UnifiedArgumentCollection UAC) { + private static AFCalc getAlleleFrequencyCalculationObject(int N, Logger logger, PrintStream verboseWriter, UnifiedArgumentCollection UAC) { - List> afClasses = new PluginManager(AlleleFrequencyCalculation.class).getPlugins(); + List> afClasses = new PluginManager(AFCalc.class).getPlugins(); // user-specified name String afModelName = UAC.AFmodel.implementationName; @@ -756,21 +756,21 @@ public class UnifiedGenotyperEngine { afModelName = "Diploid" + afModelName; for (int i = 0; i < afClasses.size(); i++) { - Class afClass = afClasses.get(i); + Class afClass = afClasses.get(i); String key = afClass.getSimpleName().replace("AFCalculationModel","").toUpperCase(); if (afModelName.equalsIgnoreCase(key)) { try { Object args[] = new Object[]{UAC,N,logger,verboseWriter}; Constructor c = afClass.getDeclaredConstructor(UnifiedArgumentCollection.class, int.class, Logger.class, PrintStream.class); - return (AlleleFrequencyCalculation)c.newInstance(args); + return (AFCalc)c.newInstance(args); } catch (Exception e) { - throw new IllegalArgumentException("Unexpected AlleleFrequencyCalculation " + UAC.AFmodel); + throw new IllegalArgumentException("Unexpected AFCalc " + UAC.AFmodel); } } } - throw new IllegalArgumentException("Unexpected AlleleFrequencyCalculation " + UAC.AFmodel); + throw new IllegalArgumentException("Unexpected AFCalc " + UAC.AFmodel); } public static VariantContext getVCFromAllelesRod(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc, boolean requireSNP, Logger logger, final RodBinding allelesBinding) { diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculation.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalc.java similarity index 89% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculation.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalc.java index afdcfa9b4..6ba73e59f 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculation.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalc.java @@ -48,12 +48,12 @@ import java.util.List; /** * Generic interface for calculating the probability of alleles segregating given priors and genotype likelihoods */ -public abstract class AlleleFrequencyCalculation implements Cloneable { - private final static Logger defaultLogger = Logger.getLogger(AlleleFrequencyCalculation.class); +public abstract class AFCalc implements Cloneable { + private final static Logger defaultLogger = Logger.getLogger(AFCalc.class); public enum Model { /** The default model with the best performance in all cases */ - EXACT("ExactAFCalculation"); + EXACT("ExactAFCalc"); public final String implementationName; @@ -74,16 +74,16 @@ public abstract class AlleleFrequencyCalculation implements Cloneable { private SimpleTimer callTimer = new SimpleTimer(); private PrintStream callReport = null; - protected AlleleFrequencyCalculation(final UnifiedArgumentCollection UAC, final int nSamples, final Logger logger, final PrintStream verboseWriter) { + protected AFCalc(final UnifiedArgumentCollection UAC, final int nSamples, final Logger logger, final PrintStream verboseWriter) { this(nSamples, UAC.MAX_ALTERNATE_ALLELES, UAC.MAX_ALTERNATE_ALLELES_FOR_INDELS, UAC.exactCallsLog, logger, verboseWriter); } - protected AlleleFrequencyCalculation(final int nSamples, - final int maxAltAlleles, - final int maxAltAllelesForIndels, - final File exactCallsLog, - final Logger logger, - final PrintStream verboseWriter) { + protected AFCalc(final int nSamples, + final int maxAltAlleles, + final int maxAltAllelesForIndels, + final File exactCallsLog, + final Logger logger, + final PrintStream verboseWriter) { if ( nSamples < 0 ) throw new IllegalArgumentException("nSamples must be greater than zero " + nSamples); if ( maxAltAlleles < 1 ) throw new IllegalArgumentException("maxAltAlleles must be greater than zero " + maxAltAlleles); @@ -97,13 +97,13 @@ public abstract class AlleleFrequencyCalculation implements Cloneable { } /** - * @see #getLog10PNonRef(org.broadinstitute.sting.utils.variantcontext.VariantContext, double[], AlleleFrequencyCalculationResult) + * @see #getLog10PNonRef(org.broadinstitute.sting.utils.variantcontext.VariantContext, double[], AFCalcResult) * * Allocates a new results object. Useful for testing but slow in practice. */ - public final AlleleFrequencyCalculationResult getLog10PNonRef(final VariantContext vc, + public final AFCalcResult getLog10PNonRef(final VariantContext vc, final double[] log10AlleleFrequencyPriors) { - return getLog10PNonRef(vc, log10AlleleFrequencyPriors, new AlleleFrequencyCalculationResult(getMaxAltAlleles())); + return getLog10PNonRef(vc, log10AlleleFrequencyPriors, new AFCalcResult(getMaxAltAlleles())); } /** @@ -114,9 +114,9 @@ public abstract class AlleleFrequencyCalculation implements Cloneable { * @param result a pre-allocated (for efficiency) object to hold the result of the calculation * @return result (for programming convenience) */ - public final AlleleFrequencyCalculationResult getLog10PNonRef(final VariantContext vc, + public final AFCalcResult getLog10PNonRef(final VariantContext vc, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { if ( vc == null ) throw new IllegalArgumentException("VariantContext cannot be null"); if ( log10AlleleFrequencyPriors == null ) throw new IllegalArgumentException("priors vector cannot be null"); if ( result == null ) throw new IllegalArgumentException("Results object cannot be null"); @@ -168,7 +168,7 @@ public abstract class AlleleFrequencyCalculation implements Cloneable { // TODO -- add consistent requires among args public abstract void computeLog10PNonRef(final VariantContext vc, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result); + final AFCalcResult result); /** * Must be overridden by concrete subclasses diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculationResult.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalcResult.java similarity index 98% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculationResult.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalcResult.java index 705c59a9b..5629af4e1 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AlleleFrequencyCalculationResult.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/AFCalcResult.java @@ -41,7 +41,7 @@ import java.util.List; * * TODO -- WHAT IS THE CONTRACT ON MAP AC AND P NON REF? */ -public class AlleleFrequencyCalculationResult { +public class AFCalcResult { // These variables are intended to contain the MLE and MAP (and their corresponding allele counts) of the site over all alternate alleles private double log10MLE; private double log10MAP; @@ -71,7 +71,7 @@ public class AlleleFrequencyCalculationResult { * * @param maxAltAlleles an integer >= 1 */ - public AlleleFrequencyCalculationResult(final int maxAltAlleles) { + public AFCalcResult(final int maxAltAlleles) { if ( maxAltAlleles < 1 ) throw new IllegalArgumentException("maxAltAlleles must be >= 0, saw " + maxAltAlleles); alleleCountsOfMLE = new int[maxAltAlleles]; @@ -227,7 +227,7 @@ public class AlleleFrequencyCalculationResult { * Resetting of the data is done by the calculation model itself, so shouldn't be done by callers any longer */ protected void reset() { - log10MLE = log10MAP = log10LikelihoodOfAFzero = log10PosteriorOfAFzero = AlleleFrequencyCalculation.VALUE_NOT_CALCULATED; + log10MLE = log10MAP = log10LikelihoodOfAFzero = log10PosteriorOfAFzero = AFCalc.VALUE_NOT_CALCULATED; for ( int i = 0; i < alleleCountsOfMLE.length; i++ ) { alleleCountsOfMLE[i] = 0; alleleCountsOfMAP[i] = 0; diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalculation.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalc.java similarity index 91% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalculation.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalc.java index 8465151bd..3257be97b 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalculation.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ConstrainedDiploidExactAFCalc.java @@ -10,16 +10,16 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext; import java.io.PrintStream; -public class ConstrainedDiploidExactAFCalculation extends DiploidExactAFCalculation { - public ConstrainedDiploidExactAFCalculation(final int nSamples, final int maxAltAlleles) { +public class ConstrainedDiploidExactAFCalc extends DiploidExactAFCalc { + public ConstrainedDiploidExactAFCalc(final int nSamples, final int maxAltAlleles) { super(nSamples, maxAltAlleles); } - public ConstrainedDiploidExactAFCalculation(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { + public ConstrainedDiploidExactAFCalc(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { super(UAC, N, logger, verboseWriter); } - protected StateTracker makeMaxLikelihood(final VariantContext vc, final AlleleFrequencyCalculationResult result) { + protected StateTracker makeMaxLikelihood(final VariantContext vc, final AFCalcResult result) { final int[] maxACsToConsider = computeMaxACs(vc); result.setAClimits(maxACsToConsider); return new StateTracker(maxACsToConsider); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalculation.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalc.java similarity index 96% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalculation.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalc.java index ddfab445b..48e4e8359 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalculation.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/DiploidExactAFCalc.java @@ -33,21 +33,21 @@ import org.broadinstitute.sting.utils.variantcontext.*; import java.io.PrintStream; import java.util.*; -public abstract class DiploidExactAFCalculation extends ExactAFCalculation { - public DiploidExactAFCalculation(final int nSamples, final int maxAltAlleles) { +public abstract class DiploidExactAFCalc extends ExactAFCalc { + public DiploidExactAFCalc(final int nSamples, final int maxAltAlleles) { super(nSamples, maxAltAlleles, maxAltAlleles, null, null, null); } - public DiploidExactAFCalculation(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { + public DiploidExactAFCalc(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { super(UAC, N, logger, verboseWriter); } - protected abstract StateTracker makeMaxLikelihood(final VariantContext vc, final AlleleFrequencyCalculationResult result); + protected abstract StateTracker makeMaxLikelihood(final VariantContext vc, final AFCalcResult result); @Override public void computeLog10PNonRef(final VariantContext vc, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { final int numAlternateAlleles = vc.getNAlleles() - 1; final ArrayList genotypeLikelihoods = getGLs(vc.getGenotypes()); final int numSamples = genotypeLikelihoods.size()-1; @@ -161,7 +161,7 @@ public abstract class DiploidExactAFCalculation extends ExactAFCalculation { final LinkedList ACqueue, final HashMap indexesToACset, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { //if ( DEBUG ) // System.out.printf(" *** computing LofK for set=%s%n", set.ACcounts); @@ -250,7 +250,7 @@ public abstract class DiploidExactAFCalculation extends ExactAFCalculation { private void computeLofK(final ExactACset set, final ArrayList genotypeLikelihoods, final double[] log10AlleleFrequencyPriors, - final AlleleFrequencyCalculationResult result) { + final AFCalcResult result) { set.getLog10Likelihoods()[0] = 0.0; // the zero case final int totalK = set.getACsum(); diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactACset.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactACset.java index 5b9a9a28e..de5bad57f 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactACset.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactACset.java @@ -1,5 +1,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper.afcalc; +import org.broadinstitute.sting.utils.MathUtils; + import java.util.Arrays; /** @@ -21,16 +23,15 @@ public final class ExactACset { public ExactACset(final int size, final ExactACcounts ACcounts) { this.ACcounts = ACcounts; log10Likelihoods = new double[size]; - Arrays.fill(getLog10Likelihoods(), Double.NEGATIVE_INFINITY); + Arrays.fill(log10Likelihoods, Double.NEGATIVE_INFINITY); } - // sum of all the non-reference alleles + /** + * sum of all the non-reference alleles + */ public int getACsum() { - if ( sum == -1 ) { - sum = 0; - for ( int count : getACcounts().getCounts() ) - sum += count; - } + if ( sum == -1 ) + sum = (int)MathUtils.sum(getACcounts().getCounts()); return sum; } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculation.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalc.java similarity index 89% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculation.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalc.java index 248ae5491..d1a769eb7 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalculation.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ExactAFCalc.java @@ -40,14 +40,14 @@ import java.util.ArrayList; /** * Uses the Exact calculation of Heng Li */ -abstract class ExactAFCalculation extends AlleleFrequencyCalculation { +abstract class ExactAFCalc extends AFCalc { protected static final int HOM_REF_INDEX = 0; // AA likelihoods are always first - protected ExactAFCalculation(final UnifiedArgumentCollection UAC, final int nSamples, final Logger logger, final PrintStream verboseWriter) { + protected ExactAFCalc(final UnifiedArgumentCollection UAC, final int nSamples, final Logger logger, final PrintStream verboseWriter) { super(UAC, nSamples, logger, verboseWriter); } - protected ExactAFCalculation(final int nSamples, int maxAltAlleles, int maxAltAllelesForIndels, File exactCallsLog, Logger logger, PrintStream verboseWriter) { + protected ExactAFCalc(final int nSamples, int maxAltAlleles, int maxAltAllelesForIndels, File exactCallsLog, Logger logger, PrintStream verboseWriter) { super(nSamples, maxAltAlleles, maxAltAllelesForIndels, exactCallsLog, logger, verboseWriter); } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalculation.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalc.java similarity index 57% rename from public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalculation.java rename to public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalc.java index b0a2c572f..7ae710e73 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalculation.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/ReferenceDiploidExactAFCalc.java @@ -6,16 +6,16 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext; import java.io.PrintStream; -public class ReferenceDiploidExactAFCalculation extends DiploidExactAFCalculation { - public ReferenceDiploidExactAFCalculation(final int nSamples, final int maxAltAlleles) { +public class ReferenceDiploidExactAFCalc extends DiploidExactAFCalc { + public ReferenceDiploidExactAFCalc(final int nSamples, final int maxAltAlleles) { super(nSamples, maxAltAlleles); } - public ReferenceDiploidExactAFCalculation(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { + public ReferenceDiploidExactAFCalc(UnifiedArgumentCollection UAC, int N, Logger logger, PrintStream verboseWriter) { super(UAC, N, logger, verboseWriter); } - protected StateTracker makeMaxLikelihood(final VariantContext vc, final AlleleFrequencyCalculationResult result) { + protected StateTracker makeMaxLikelihood(final VariantContext vc, final AFCalcResult result) { return new StateTracker(); } } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/StateTracker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/StateTracker.java index bd48784a7..7dc8926ca 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/StateTracker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/afcalc/StateTracker.java @@ -21,7 +21,7 @@ final class StateTracker { } /** - * Update the maximum log10L seen, if log10LofKs is higher + * Update the maximum log10L seen, if log10LofKs is higher, and the corresponding ACs of this state * * @param log10LofKs the likelihood of our current configuration state */ diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/GLBasedSampleSelector.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/GLBasedSampleSelector.java index 17d54a2b8..11b4ca3cc 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/GLBasedSampleSelector.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/GLBasedSampleSelector.java @@ -23,9 +23,9 @@ */ package org.broadinstitute.sting.gatk.walkers.validation.validationsiteselector; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AlleleFrequencyCalculationResult; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.DiploidExactAFCalculation; -import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.ReferenceDiploidExactAFCalculation; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.AFCalcResult; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.DiploidExactAFCalc; +import org.broadinstitute.sting.gatk.walkers.genotyper.afcalc.ReferenceDiploidExactAFCalc; import org.broadinstitute.sting.utils.variantcontext.VariantContext; import java.util.TreeSet; @@ -34,7 +34,7 @@ import java.util.TreeSet; public class GLBasedSampleSelector extends SampleSelector { double[] flatPriors = null; final double referenceLikelihood; - DiploidExactAFCalculation AFCalculator; + DiploidExactAFCalc AFCalculator; public GLBasedSampleSelector(TreeSet sm, double refLik) { super(sm); @@ -52,9 +52,9 @@ public class GLBasedSampleSelector extends SampleSelector { // do we want to apply a prior? maybe user-spec? if ( flatPriors == null ) { flatPriors = new double[1+2*samples.size()]; - AFCalculator = new ReferenceDiploidExactAFCalculation(samples.size(), 4); + AFCalculator = new ReferenceDiploidExactAFCalc(samples.size(), 4); } - AlleleFrequencyCalculationResult result = new AlleleFrequencyCalculationResult(vc.getAlternateAlleles().size()); + AFCalcResult result = new AFCalcResult(vc.getAlternateAlleles().size()); AFCalculator.computeLog10PNonRef(subContext, flatPriors, result); // do we want to let this qual go up or down? if ( result.getLog10PosteriorOfAFzero() < referenceLikelihood ) {