Merge pull request #532 from broadinstitute/vrr_graphbased_there_is_no_such_edge_fix
Fix for a bug a bug in (Assembly Graph) Routes.
This commit is contained in:
commit
1c7eac50fc
|
|
@ -530,8 +530,8 @@ public class HaplotypeCaller extends ActiveRegionWalker<List<VariantContext>, 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;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ public class Route<V extends BaseVertex, E extends BaseEdge> extends Path<V,E> {
|
|||
throw new IllegalArgumentException("prefix cannot be negative");
|
||||
|
||||
final List<E> resultEdges = getEdges().subList(length,length());
|
||||
Route<V,E> result = new Route<>(graph.getEdgeSource(resultEdges.get(0)),this);
|
||||
Route<V,E> result = new Route<>(graph.getEdgeSource(resultEdges.get(0)),graph);
|
||||
for (final E edge : resultEdges)
|
||||
result = new Route<>(result,edge);
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,17 @@ import java.util.*;
|
|||
*/
|
||||
public class RouteUnitTest extends BaseTest {
|
||||
|
||||
@Test(dataProvider="slicePrefixTestData")
|
||||
public void testSplicePrefix(final Route<BaseVertex,BaseEdge> route) {
|
||||
final int routeLength = route.length();
|
||||
for (int i = 0; i < routeLength; i++) {
|
||||
final Route<BaseVertex,BaseEdge> spliced = route.splicePrefix(i);
|
||||
Assert.assertEquals(spliced.length(),route.length() - i);
|
||||
final List<BaseEdge> routeEdges = route.getEdges();
|
||||
final List<BaseEdge> expectedSlicedEdges = routeEdges.subList(i,routeLength);
|
||||
Assert.assertEquals(spliced.getEdges(),expectedSlicedEdges);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider="isSuffixTestData")
|
||||
public void testIsSuffix(final Route<BaseVertex,BaseEdge> route, final Path<BaseVertex,BaseEdge> path, final boolean expectedResult) {
|
||||
|
|
@ -71,7 +82,12 @@ public class RouteUnitTest extends BaseTest {
|
|||
|
||||
@DataProvider(name="isSuffixTestData")
|
||||
public Iterator<Object[]> isSuffixTestData() {
|
||||
return TEST_DATA.iterator();
|
||||
return IS_SUFFIX_TEST_DATA.iterator();
|
||||
}
|
||||
|
||||
@DataProvider(name="slicePrefixTestData")
|
||||
public Iterator<Object[]> 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<Integer, BaseVertex> vertexByInteger = new HashMap<>();
|
||||
private static final BaseGraph<BaseVertex, BaseEdge> TEST_GRAPH = new BaseGraph<>(1, TEST_GRAPH_EDGE_FACTORY);
|
||||
private static final List<Object[]> TEST_DATA;
|
||||
private static final List<Object[]> 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<Route<BaseVertex, BaseEdge>> 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<Path<BaseVertex, BaseEdge>> allPossiblePaths, final int numberOfPaths) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue