From 344a938a70de7407ca1169171060e92f3cf11777 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Sun, 18 Mar 2012 00:36:30 -0400 Subject: [PATCH 1/2] When checking to make sure that we have cached enough data in the PL array, use the converted index value since that's what will be used as an index into the array. --- .../utils/variantcontext/GenotypeLikelihoods.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java b/public/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java index cc0d9788b..ae3dff9ed 100755 --- a/public/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java +++ b/public/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java @@ -288,11 +288,13 @@ public class GenotypeLikelihoods { * @return the allele index pair */ public static GenotypeLikelihoodsAllelePair getAllelePairUsingDeprecatedOrdering(final int PLindex) { - // make sure that we've cached enough data - if ( PLindex >= PLIndexToAlleleIndex.length ) - calculatePLcache(PLindex); + final int convertedIndex = PLindexConversion[PLindex]; - return PLIndexToAlleleIndex[PLindexConversion[PLindex]]; + // make sure that we've cached enough data + if ( convertedIndex >= PLIndexToAlleleIndex.length ) + calculatePLcache(convertedIndex); + + return PLIndexToAlleleIndex[convertedIndex]; } /** From 5c5d8e7cd39daff84cca39943b6e10d9595f06a4 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Sun, 18 Mar 2012 00:53:29 -0400 Subject: [PATCH 2/2] Minor: cleaner way of turning off index-on-the-fly checking in case we want to turn it back on. --- public/java/test/org/broadinstitute/sting/WalkerTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/java/test/org/broadinstitute/sting/WalkerTest.java b/public/java/test/org/broadinstitute/sting/WalkerTest.java index 9d8ecb416..7f5212ba3 100755 --- a/public/java/test/org/broadinstitute/sting/WalkerTest.java +++ b/public/java/test/org/broadinstitute/sting/WalkerTest.java @@ -47,6 +47,7 @@ import java.util.*; public class WalkerTest extends BaseTest { private static final boolean ENABLE_PHONE_HOME_FOR_TESTS = false; + private static final boolean ENABLE_ON_THE_FLY_CHECK_FOR_VCF_INDEX = false; @BeforeMethod public void initializeRandomGenerator() { @@ -58,6 +59,9 @@ public class WalkerTest extends BaseTest { } public void maybeValidateSupplementaryFile(final String name, final File resultFile) { + if ( !ENABLE_ON_THE_FLY_CHECK_FOR_VCF_INDEX ) + return; + File indexFile = Tribble.indexFile(resultFile); //System.out.println("Putative index file is " + indexFile); if ( indexFile.exists() ) { @@ -75,13 +79,13 @@ public class WalkerTest extends BaseTest { System.out.println("Verifying on-the-fly index " + indexFile + " for test " + name + " using file " + resultFile); Index indexFromOutputFile = IndexFactory.createIndex(resultFile, new VCFCodec()); Index dynamicIndex = IndexFactory.loadIndex(indexFile.getAbsolutePath()); - /* tmp disable + if ( ! indexFromOutputFile.equalsIgnoreProperties(dynamicIndex) ) { Assert.fail(String.format("Index on disk from indexing on the fly not equal to the index created after the run completed. FileIndex %s vs. on-the-fly %s%n", indexFromOutputFile.getProperties(), dynamicIndex.getProperties())); } - */ } + } public List assertMatchingMD5s(final String name, List resultFiles, List expectedMD5s) { List md5s = new ArrayList();