public void testNewSplitWorkload() throws IOException { final MockSequencesReader r = new MockSequencesReader(SequenceType.DNA, 3); r.setLengths(new int[] {10000000, 20000000, 30000000}); final String expected = "" + "[[(0:0), (0:3000000)]" + ", [(0:3000000), (0:6000000)]" + ", [(0:6000000), (0:9000000)]" + ", [(0:9000000), (1:2000000)]" + ", [(1:2000000), (1:5000000)]" + ", [(1:5000000), (1:8000000)]" + ", [(1:8000000), (1:11000000)]" + ", [(1:11000000), (1:14000000)]" + ", [(1:14000000), (1:17000000)]" + ", [(1:17000000), (1:20000000)]" + ", [(1:20000000), (2:3000000)]" + ", [(2:3000000), (2:6000000)]" + ", [(2:6000000), (2:9000000)]" + ", [(2:9000000), (2:12000000)]" + ", [(2:12000000), (2:15000000)]" + ", [(2:15000000), (2:18000000)]" + ", [(2:18000000), (2:21000000)]" + ", [(2:21000000), (2:24000000)]" + ", [(2:24000000), (2:27000000)]" + ", [(2:27000000), (2:30000000)]]"; final HashingRegion[] actual; actual = HashingRegion.splitWorkload(r, Sex.EITHER, 0, 3, 20, 10000, 30); checkRangeArray(actual); assertEquals(expected, Arrays.toString(actual)); }
public void testNewSplitWorkloadSingle() throws IOException { final MockSequencesReader r = new MockSequencesReader(SequenceType.DNA, 1); r.setLengths(new int[] {10000}); final String expected = "[[(0:0), (0:10000)]" + "]"; final HashingRegion[] actual; actual = HashingRegion.splitWorkload(r, Sex.EITHER, 0, 1, 20, 20000, 30); assertEquals(expected, Arrays.toString(actual)); assertEquals(0, actual[0].getStartPaddedPosition()); assertEquals(10000, actual[0].getEndPaddedPosition()); }
public void testNewSplitWorkloadReference() throws IOException { final Reader reader = new StringReader(REFERENCE_GENOME); final MockSequencesReader r = new MockSequencesReader(SequenceType.DNA, 3); final ReferenceGenome rg = new ReferenceGenome(r, reader, Sex.MALE); r.setLengths(new int[] {10000000, 20000000, 30000000}); final String expected = "" + "[[(0:0), (0:1500000)]" + ", [(0:1500000), (0:3000000)]" + ", [(0:3000000), (0:4500000)]" + ", [(0:4500000), (0:6000000)]" + ", [(0:6000000), (0:7500000)]" + ", [(0:7500000), (0:9000000)]" + ", [(0:9000000), (1:500000)]" + ", [(1:500000), (1:2000000)]" + ", [(1:2000000), (1:3500000)]" + ", [(1:3500000), (1:5000000)]" + ", [(1:5000000), (1:6500000)]" + ", [(1:6500000), (1:8000000)]" + ", [(1:8000000), (1:9500000)]" + ", [(1:9500000), (1:11000000)]" + ", [(1:11000000), (1:12500000)]" + ", [(1:12500000), (1:14000000)]" + ", [(1:14000000), (1:15500000)]" + ", [(1:15500000), (1:17000000)]" + ", [(1:17000000), (1:18500000)]" + ", [(1:18500000), (1:20000000)]]"; final HashingRegion[] actual; actual = HashingRegion.splitWorkload(r, rg, 0, 3, 20, 10000, 30); assertEquals(0, actual[0].getStartPaddedPosition()); assertEquals(1500030, actual[0].getEndPaddedPosition()); assertEquals(16999970, actual[18].getStartPaddedPosition()); assertEquals(18500030, actual[18].getEndPaddedPosition()); checkRangeArray(actual); assertEquals(expected, Arrays.toString(actual)); }