Rename Utils to GraphUtils to avoid conflicts with the sting.Utils class; fix broken unit test in SharedVertexSequenceSplitterUnitTest
This commit is contained in:
parent
15461567d7
commit
5545c629f5
|
|
@ -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<SeqVertex> middleVertices) {
|
||||
final List<byte[]> kmers = Utils.getKmers(middleVertices);
|
||||
final int min = Utils.minKmerLength(kmers);
|
||||
final int suffixLen = Utils.compSuffixLen(kmers, min);
|
||||
final List<byte[]> 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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -70,7 +70,7 @@ public final class SeqGraph extends BaseGraph<SeqVertex> {
|
|||
* 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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue