From 8325cb8c26b216d0c01bca32ded77efda0a5e14d Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Wed, 10 Aug 2011 15:31:49 -0400 Subject: [PATCH] Fixing up apparent source control/merge snafu: fix to correctly output PL ordering in multi-allelic sites by UG was only half-committed and hence not working. This completes fix --- .../genotyper/ExactAFCalculationModel.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java index 5c27bc943..cd006a3cf 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java @@ -239,8 +239,8 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { // now with banding public int linearExactBanded(Map GLs, - double[] log10AlleleFrequencyPriors, - double[] log10AlleleFrequencyPosteriors) { + double[] log10AlleleFrequencyPriors, + double[] log10AlleleFrequencyPosteriors) { throw new NotImplementedException(); // final int numSamples = GLs.size(); // final int numChr = 2*numSamples; @@ -419,7 +419,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { } - + /** * Can be overridden by concrete subclasses * @param vc variant context with genotype likelihoods @@ -517,10 +517,10 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { double qual = Double.NEGATIVE_INFINITY; double[] likelihoods = g.getLikelihoods().getAsVector(); - /* System.out.format("Sample: %s GL:",sample); - for (int i=0; i < likelihoods.length; i++) - System.out.format("%1.4f ",likelihoods[i]); - */ + /* System.out.format("Sample: %s GL:",sample); + for (int i=0; i < likelihoods.length; i++) + System.out.format("%1.4f ",likelihoods[i]); + */ for (int i=0; i < likelihoods.length; i++) { if (i==bestGTguess) @@ -531,14 +531,14 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { // qual contains now max(likelihoods[k]) for all k != bestGTguess qual = likelihoods[bestGTguess] - qual; - // likelihoods are stored row-wise in upper triangular matrix. IE + // likelihoods are stored row-wise in lower triangular matrix. IE // for 2 alleles they have ordering AA,AB,BB - // for 3 alleles they are ordered AA,AB,AC,BB,BC,CC + // for 3 alleles they are ordered AA,AB,BB,AC,BC,CC // Get now alleles corresponding to best index int kk=0; boolean done = false; - for (int i=0; i < vc.getNAlleles(); i++) { - for (int j=i; j < vc.getNAlleles(); j++){ + for (int j=0; j < vc.getNAlleles(); j++) { + for (int i=0; i <= j; i++){ if (kk++ == bestGTguess) { if (i==0) myAlleles.add(vc.getReference()); @@ -565,7 +565,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { double chosenGenotype = normalized[bestGTguess]; qual = -1.0 * Math.log10(1.0 - chosenGenotype); } - //System.out.println(myAlleles.toString()); + //System.out.println(myAlleles.toString()); calls.put(sample, new Genotype(sample, myAlleles, qual, null, g.getAttributes(), false)); } @@ -592,7 +592,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { for (int j=0; j <=numChr; j++) logYMatrix[i][j] = Double.NEGATIVE_INFINITY; - //YMatrix[0][0] = 1.0; + //YMatrix[0][0] = 1.0; logYMatrix[0][0] = 0.0; int j=0;