-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code review comments and added unit tests for stop site calculation.
- Loading branch information
Showing
2 changed files
with
77 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/test/java/org/broadinstitute/hellbender/tools/walkers/CombineGVCFsUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.broadinstitute.hellbender.tools.walkers; | ||
|
||
import org.broadinstitute.hellbender.utils.SimpleInterval; | ||
import org.testng.Assert; | ||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
import java.util.*; | ||
import java.util.stream.Collectors; | ||
|
||
public class CombineGVCFsUnitTest { | ||
|
||
@DataProvider(name="breakIntermediateStopSites") | ||
public Object[][] getIntermediateStopSitesData() { | ||
return new Object[][] { | ||
{ new SimpleInterval("contig", 1, 1), 1, Collections.EMPTY_LIST }, | ||
{ new SimpleInterval("contig", 1, 2), 1, Arrays.asList(1) }, | ||
{ new SimpleInterval("contig", 1, 2), 2, Arrays.asList(1) }, | ||
{ new SimpleInterval("contig", 1, 10), 2, Arrays.asList(1, 3, 5, 7, 9) }, | ||
{ new SimpleInterval("contig", 1, 10), 5, Arrays.asList(4, 9) }, | ||
{ new SimpleInterval("contig", 1, 100), 25, Arrays.asList(24, 49, 74, 99) }, | ||
|
||
{ new SimpleInterval("contig", 10, 10), 2, Arrays.asList(9) }, | ||
{ new SimpleInterval("contig", 10, 10), 5, Arrays.asList(9) }, | ||
|
||
// TODO ?? is this the correct result ? | ||
{ new SimpleInterval("contig", 10, 10), 10, Arrays.asList(9) }, | ||
{ new SimpleInterval("contig", 10, 10), 100, Collections.EMPTY_LIST }, | ||
|
||
{ new SimpleInterval("contig", 10, 20), 5, Arrays.asList(9, 14, 19) }, | ||
{ new SimpleInterval("contig", 10, 20), 10, Arrays.asList(9, 19) }, | ||
{ new SimpleInterval("contig", 10, 20), 100, Collections.EMPTY_LIST }, | ||
|
||
{ new SimpleInterval("contig", 10, 100), 25, Arrays.asList(24, 49, 74, 99) }, | ||
{ new SimpleInterval("contig", 10, 100), 50, Arrays.asList(49, 99) }, | ||
{ new SimpleInterval("contig", 10, 100), 100, Arrays.asList(99) }, | ||
{ new SimpleInterval("contig", 10, 100), 1000, Collections.EMPTY_LIST }, | ||
}; | ||
} | ||
|
||
@Test(dataProvider = "breakIntermediateStopSites") | ||
public void testGetIntermediateStopSites( | ||
final SimpleInterval intervalToClose, | ||
final int breakBandMultiple, | ||
final List<Integer> expectedCloseSites) | ||
{ | ||
final List<Integer> actualStopSites = new ArrayList<>(CombineGVCFs.getIntermediateStopSites(intervalToClose, breakBandMultiple)); | ||
actualStopSites.sort(Comparator.naturalOrder()); | ||
// validate that the resulting stop sites all result in valid single-position stop intervals | ||
actualStopSites.stream().forEach(stopSite -> Assert.assertNotNull(new SimpleInterval(intervalToClose.getContig(), stopSite, stopSite))); | ||
Assert.assertEquals(actualStopSites, expectedCloseSites); | ||
} | ||
|
||
} |