diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java index 7499dc482..ad05e87d9 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCaller.java @@ -530,8 +530,8 @@ public class HaplotypeCaller extends ActiveRegionWalker, In ReferenceConfidenceModel referenceConfidenceModel = null; // as determined experimentally Nov-Dec 2013 - protected final static GATKVCFIndexType OPTIMAL_GVCF_INDEX_TYPE = GATKVCFIndexType.LINEAR; - protected final static int OPTIMAL_GVCF_INDEX_PARAMETER = 128000; + public final static GATKVCFIndexType OPTIMAL_GVCF_INDEX_TYPE = GATKVCFIndexType.LINEAR; + public final static int OPTIMAL_GVCF_INDEX_PARAMETER = 128000; //--------------------------------------------------------------------------------------------------------------- // diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Route.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Route.java index 1cf986c00..4eeb18eb6 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Route.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Route.java @@ -277,7 +277,7 @@ public class Route extends Path { throw new IllegalArgumentException("prefix cannot be negative"); final List resultEdges = getEdges().subList(length,length()); - Route result = new Route<>(graph.getEdgeSource(resultEdges.get(0)),this); + Route result = new Route<>(graph.getEdgeSource(resultEdges.get(0)),graph); for (final E edge : resultEdges) result = new Route<>(result,edge); return result; diff --git a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java index 4a88bc406..047de62e1 100644 --- a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java +++ b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/HaplotypeCallerIntegrationTest.java @@ -309,4 +309,15 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest { Arrays.asList("061a5a9bde0739fe58b314bf8bf8eee3")); executeTest("HC calling with conservative indel error modeling on WGS intervals", spec); } + + @Test + public void testNoSuchEdgeBugFix() { + final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -R %s -I %s -L %s -dontTrimActiveRegions -ERC GVCF " + + "-likelihoodEngine GraphBased -variant_index_type %s -variant_index_parameter %d", + b37KGReferenceWithDecoy, privateTestDir + "graphbased_no_such_edge_bug.bam", privateTestDir + "graphbased_no_such_edge_bug.intervals.bed", + HaplotypeCaller.OPTIMAL_GVCF_INDEX_TYPE, HaplotypeCaller.OPTIMAL_GVCF_INDEX_PARAMETER); + final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList("")); + spec.disableShadowBCF(); + executeTest("testGraphBasedNoSuchEdgeBugFix", spec); + } } diff --git a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/RouteUnitTest.java b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/RouteUnitTest.java index 2918501b2..aeb617b18 100644 --- a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/RouteUnitTest.java +++ b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/RouteUnitTest.java @@ -63,6 +63,17 @@ import java.util.*; */ public class RouteUnitTest extends BaseTest { + @Test(dataProvider="slicePrefixTestData") + public void testSplicePrefix(final Route route) { + final int routeLength = route.length(); + for (int i = 0; i < routeLength; i++) { + final Route spliced = route.splicePrefix(i); + Assert.assertEquals(spliced.length(),route.length() - i); + final List routeEdges = route.getEdges(); + final List expectedSlicedEdges = routeEdges.subList(i,routeLength); + Assert.assertEquals(spliced.getEdges(),expectedSlicedEdges); + } + } @Test(dataProvider="isSuffixTestData") public void testIsSuffix(final Route route, final Path path, final boolean expectedResult) { @@ -71,7 +82,12 @@ public class RouteUnitTest extends BaseTest { @DataProvider(name="isSuffixTestData") public Iterator isSuffixTestData() { - return TEST_DATA.iterator(); + return IS_SUFFIX_TEST_DATA.iterator(); + } + + @DataProvider(name="slicePrefixTestData") + public Iterator slicePrefixTestData() { + return Arrays.asList(SLICE_PREFIX_TEST_DATA).iterator(); } private static final int[] TEST_EDGE_PAIRS1 = new int[] { @@ -86,8 +102,6 @@ public class RouteUnitTest extends BaseTest { 11, 12, }; - - private static final int[] TEST_EDGE_PAIRS = new int[] { 1 , 2, 2 , 3, @@ -119,8 +133,9 @@ public class RouteUnitTest extends BaseTest { private static Map vertexByInteger = new HashMap<>(); private static final BaseGraph TEST_GRAPH = new BaseGraph<>(1, TEST_GRAPH_EDGE_FACTORY); - private static final List TEST_DATA; + private static final List IS_SUFFIX_TEST_DATA; + private static final Object[][] SLICE_PREFIX_TEST_DATA; static { for (int i = 0; i < TEST_EDGE_PAIRS.length; i += 2) { @@ -156,7 +171,16 @@ public class RouteUnitTest extends BaseTest { final int numberOfPaths = allPossiblePaths.size(); final boolean[][] isSuffix = buildIsSuffixMatrix(allPossiblePaths, numberOfPaths); - TEST_DATA = createTestData(allPossiblePaths,allPossibleRoutes,isSuffix); + IS_SUFFIX_TEST_DATA = createTestData(allPossiblePaths,allPossibleRoutes,isSuffix); + SLICE_PREFIX_TEST_DATA = createSlicePrefixTestData(allPossibleRoutes); + } + + private static Object[][] createSlicePrefixTestData(List> allPossibleRoutes) { + final Object[][] result = new Object[allPossibleRoutes.size()][1]; + final Object[] routes = allPossibleRoutes.toArray(); + for (int i = 0; i < result.length; i++) + result[i][0] = routes[i]; + return result; } private static boolean[][] buildIsSuffixMatrix(final List> allPossiblePaths, final int numberOfPaths) {