Adding unit test to cover overlapping intervals from the same source with the intersection rule.

This commit is contained in:
Eric Banks 2011-10-28 09:59:43 -04:00
parent 057a79f598
commit 8b1a62da27
1 changed files with 16 additions and 0 deletions

View File

@ -190,6 +190,22 @@ public class IntervalUtilsUnitTest extends BaseTest {
Assert.assertEquals(ret.size(), 20);
}
@Test
public void testOverlappingIntervalsFromSameSourceWithIntersection() {
// a couple of lists we'll use for the testing
List<GenomeLoc> source1 = new ArrayList<GenomeLoc>();
List<GenomeLoc> source2 = new ArrayList<GenomeLoc>();
source1.add(hg18GenomeLocParser.createGenomeLoc("chr1", 10, 20));
source1.add(hg18GenomeLocParser.createGenomeLoc("chr1", 15, 25));
source2.add(hg18GenomeLocParser.createGenomeLoc("chr1", 16, 18));
source2.add(hg18GenomeLocParser.createGenomeLoc("chr1", 22, 24));
List<GenomeLoc> ret = IntervalUtils.mergeListsBySetOperator(source1, source2, IntervalSetRule.INTERSECTION);
Assert.assertEquals(ret.size(), 2);
}
@Test
public void testGetContigLengths() {
Map<String, Long> lengths = IntervalUtils.getContigSizes(new File(BaseTest.hg18Reference));