diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraph.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraph.java index aa8bee8b3..68615492d 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraph.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraph.java @@ -448,18 +448,18 @@ public abstract class DanglingChainMergingGraph extends BaseGraph path, final boolean reverseIfSource) { + public byte[] getBasesForPath(final List path, final boolean expandSource) { if ( path == null ) throw new IllegalArgumentException("Path cannot be null"); final StringBuilder sb = new StringBuilder(); for ( final MultiDeBruijnVertex v : path ) { - if ( isSource(v) ) { + if ( expandSource && isSource(v) ) { final String seq = v.getSequenceString(); - sb.append(reverseIfSource ? new StringBuilder(seq).reverse().toString() : seq); + sb.append(new StringBuilder(seq).reverse().toString()); } else { sb.append((char)v.getSuffix()); } diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraphUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraphUnitTest.java index 1ac94d20d..7078753be 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraphUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/readthreading/DanglingChainMergingGraphUnitTest.java @@ -174,8 +174,10 @@ public class DanglingChainMergingGraphUnitTest extends BaseTest { v = graph.getNextReferenceVertex(v); } - final String result = new String(graph.getBasesForPath(vertexes, false)); - Assert.assertEquals(result, testString); + final String resultForTails = new String(graph.getBasesForPath(vertexes, false)); + Assert.assertEquals(resultForTails, testString.substring(kmerSize-1)); + final String resultForHeads = new String(graph.getBasesForPath(vertexes, true)); + Assert.assertEquals(resultForHeads, "GTAAGGGCAATACTA"); // because the source node will be reversed } @DataProvider(name = "DanglingHeads")