diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/CommonSuffixSplitter.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/CommonSuffixSplitter.java index dabfbb322..371d5b7e3 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/CommonSuffixSplitter.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/CommonSuffixSplitter.java @@ -48,7 +48,6 @@ package org.broadinstitute.sting.gatk.walkers.haplotypecaller.graphs; import com.google.java.contract.Requires; -import java.io.File; import java.util.*; /** @@ -177,9 +176,9 @@ public class CommonSuffixSplitter { */ @Requires("!middleVertices.isEmpty()") protected static SeqVertex commonSuffix(final Collection middleVertices) { - final List kmers = Utils.getKmers(middleVertices); - final int min = Utils.minKmerLength(kmers); - final int suffixLen = Utils.compSuffixLen(kmers, min); + final List kmers = GraphUtils.getKmers(middleVertices); + final int min = GraphUtils.minKmerLength(kmers); + final int suffixLen = GraphUtils.compSuffixLen(kmers, min); final byte[] kmer = kmers.get(0); final byte[] suffix = Arrays.copyOfRange(kmer, kmer.length - suffixLen, kmer.length); return new SeqVertex(suffix); diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Utils.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/GraphUtils.java similarity index 99% rename from protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Utils.java rename to protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/GraphUtils.java index 8cb272925..30c5be190 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/Utils.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/GraphUtils.java @@ -60,8 +60,8 @@ import java.util.List; * Date: 3/25/13 * Time: 9:42 PM */ -final class Utils { - private Utils() {} +final class GraphUtils { + private GraphUtils() {} /** * Compute the maximum shared prefix length of list of bytes. diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraph.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraph.java index 4cc7aae2a..97969d098 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraph.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraph.java @@ -70,7 +70,7 @@ public final class SeqGraph extends BaseGraph { * merging inappropriate head or tail nodes, which introduces large insertion / deletion events * as the merge operation creates a link among the non-linked sink / source vertices */ - private final static int MIN_COMMON_SEQUENCE_TO_MERGE_SOURCE_SINK_VERTICES = 10; + protected final static int MIN_COMMON_SEQUENCE_TO_MERGE_SOURCE_SINK_VERTICES = 10; /** * Construct an empty SeqGraph diff --git a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitter.java b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitter.java index ca7faa444..f6ee4c3c3 100644 --- a/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitter.java +++ b/protected/java/src/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitter.java @@ -295,8 +295,8 @@ public class SharedVertexSequenceSplitter { min = Math.min(min, v.getSequence().length); } - final int prefixLen = Utils.compPrefixLen(kmers, min); - final int suffixLen = Utils.compSuffixLen(kmers, min - prefixLen); + final int prefixLen = GraphUtils.compPrefixLen(kmers, min); + final int suffixLen = GraphUtils.compSuffixLen(kmers, min - prefixLen); final byte[] kmer = kmers.get(0); final byte[] prefix = Arrays.copyOfRange(kmer, 0, prefixLen); diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraphUnitTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraphUnitTest.java index ca43ced69..42137e4e4 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraphUnitTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SeqGraphUnitTest.java @@ -47,6 +47,7 @@ package org.broadinstitute.sting.gatk.walkers.haplotypecaller.graphs; import org.broadinstitute.sting.BaseTest; +import org.broadinstitute.sting.utils.Utils; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -195,8 +196,8 @@ public class SeqGraphUnitTest extends BaseTest { final SeqGraph graph = new SeqGraph(); - SeqVertex pre1 = new SeqVertex("ACT"); - SeqVertex pre2 = new SeqVertex("AGT"); + SeqVertex pre1 = new SeqVertex(Utils.dupString("A", SeqGraph.MIN_COMMON_SEQUENCE_TO_MERGE_SOURCE_SINK_VERTICES) + "CT"); + SeqVertex pre2 = new SeqVertex(Utils.dupString("A", SeqGraph.MIN_COMMON_SEQUENCE_TO_MERGE_SOURCE_SINK_VERTICES) + "GT"); SeqVertex top = new SeqVertex("A"); SeqVertex middle1 = new SeqVertex("GC"); SeqVertex middle2 = new SeqVertex("TC"); @@ -282,7 +283,7 @@ public class SeqGraphUnitTest extends BaseTest { final SeqVertex newMiddle1 = new SeqVertex("G"); final SeqVertex newMiddle2 = new SeqVertex("T"); final SeqVertex newBottom = new SeqVertex("C" + bottom.getSequenceString()); - final SeqVertex newTop = new SeqVertex("A"); + final SeqVertex newTop = new SeqVertex(Utils.dupString("A", SeqGraph.MIN_COMMON_SEQUENCE_TO_MERGE_SOURCE_SINK_VERTICES)); final SeqVertex newTopDown1 = new SeqVertex("G"); final SeqVertex newTopDown2 = new SeqVertex("C"); final SeqVertex newTopBottomMerged = new SeqVertex("TA"); diff --git a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitterUnitTest.java b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitterUnitTest.java index 0930d497f..2df783b19 100644 --- a/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitterUnitTest.java +++ b/protected/java/test/org/broadinstitute/sting/gatk/walkers/haplotypecaller/graphs/SharedVertexSequenceSplitterUnitTest.java @@ -98,10 +98,10 @@ public class SharedVertexSequenceSplitterUnitTest extends BaseTest { min = Math.min(min, s.length()); } - final int actualPrefixLen = org.broadinstitute.sting.gatk.walkers.haplotypecaller.graphs.Utils.compPrefixLen(bytes, min); + final int actualPrefixLen = GraphUtils.compPrefixLen(bytes, min); Assert.assertEquals(actualPrefixLen, expectedPrefixLen, "Failed prefix test"); - final int actualSuffixLen = org.broadinstitute.sting.gatk.walkers.haplotypecaller.graphs.Utils.compSuffixLen(bytes, min - actualPrefixLen); + final int actualSuffixLen = GraphUtils.compSuffixLen(bytes, min - actualPrefixLen); Assert.assertEquals(actualSuffixLen, expectedSuffixLen, "Failed suffix test"); }