use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class IntervalAlignmentContextIteratorUnitTest method testCoveredOnly.
@Test
public void testCoveredOnly() {
// This test is good at finding places where the alignment contexts start behind the interval.
// Totally covered
final SimpleInterval record_20_9999910_9999913 = new SimpleInterval("20:9999910-9999913");
final List<SimpleInterval> locusIntervals = new ArrayList<>(1);
locusIntervals.add(record_20_9999910_9999913);
final List<AlignmentContext> allAlignmentContexts = getAlignmentContexts(locusIntervals, BAM_FILE_NAME);
Assert.assertEquals(allAlignmentContexts.size(), 4);
Assert.assertTrue(allAlignmentContexts.stream().allMatch(ac -> ac != null));
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class IntervalAlignmentContextIteratorUnitTest method testUnCoveredOnly.
@Test
public void testUnCoveredOnly() {
final SimpleInterval record_20_9999900_9999901 = new SimpleInterval("20:9999900-9999901");
final List<SimpleInterval> locusIntervals = new ArrayList<>(1);
locusIntervals.add(record_20_9999900_9999901);
final List<AlignmentContext> allAlignmentContexts = getAlignmentContexts(locusIntervals, BAM_FILE_NAME);
Assert.assertEquals(allAlignmentContexts.size(), 2);
Assert.assertTrue(allAlignmentContexts.stream().allMatch(ac -> ac != null));
Assert.assertEquals(allAlignmentContexts.get(0).getBasePileup().getReads().size(), 0);
Assert.assertEquals(allAlignmentContexts.get(1).getBasePileup().getReads().size(), 0);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class IntervalLocusIteratorUnitTest method testSimpleSinglePoints.
@Test
public void testSimpleSinglePoints() {
final SimpleInterval record_1_1_1 = new SimpleInterval("1:1-1");
final SimpleInterval record_1_5_5 = new SimpleInterval("1:5-5");
List<SimpleInterval> intervals = new ArrayList<>();
intervals.add(record_1_1_1);
intervals.add(record_1_5_5);
final IntervalLocusIterator intervalLocusIterator = new IntervalLocusIterator(intervals.iterator());
final List<SimpleInterval> newIntervals = StreamSupport.stream(Spliterators.spliteratorUnknownSize(intervalLocusIterator, Spliterator.ORDERED), false).collect(Collectors.toList());
Assert.assertEquals(newIntervals.size(), 2);
Assert.assertEquals(newIntervals.get(0).getStart(), 1);
Assert.assertEquals(newIntervals.get(1).getStart(), 5);
Assert.assertEquals(newIntervals.get(0).getEnd(), 1);
Assert.assertEquals(newIntervals.get(1).getEnd(), 5);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class IntervalLocusIteratorUnitTest method testSlightChallenge.
@Test
public void testSlightChallenge() {
final SimpleInterval record_20_9999600_9999800 = new SimpleInterval("20:9999600-9999600");
final SimpleInterval record_20_9999800_10000000 = new SimpleInterval("20:9999800-10000000");
final SimpleInterval record_20_10000050_10000100 = new SimpleInterval("20:10000050-10000100");
List<SimpleInterval> intervals = new ArrayList<>();
intervals.add(record_20_9999600_9999800);
intervals.add(record_20_9999800_10000000);
intervals.add(record_20_10000050_10000100);
final IntervalLocusIterator intervalLocusIterator = new IntervalLocusIterator(intervals.iterator());
final List<SimpleInterval> newIntervals = StreamSupport.stream(Spliterators.spliteratorUnknownSize(intervalLocusIterator, Spliterator.ORDERED), false).collect(Collectors.toList());
Assert.assertEquals(newIntervals.size(), 253);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class IntervalLocusIteratorUnitTest method testSimple.
@Test
public void testSimple() {
final SimpleInterval record_1_1_100 = new SimpleInterval("1:1-100");
final SimpleInterval record_1_500_600 = new SimpleInterval("1:500-600");
final SimpleInterval record_1_800_800 = new SimpleInterval("1:800-800");
List<SimpleInterval> intervals = new ArrayList<>();
intervals.add(record_1_1_100);
intervals.add(record_1_500_600);
intervals.add(record_1_800_800);
final IntervalLocusIterator intervalLocusIterator = new IntervalLocusIterator(intervals.iterator());
final List<SimpleInterval> newIntervals = StreamSupport.stream(Spliterators.spliteratorUnknownSize(intervalLocusIterator, Spliterator.ORDERED), false).collect(Collectors.toList());
Assert.assertEquals(newIntervals.size(), 202);
Assert.assertEquals(newIntervals.get(0).getStart(), 1);
Assert.assertEquals(newIntervals.get(1).getStart(), 2);
Assert.assertEquals(newIntervals.get(99).getStart(), 100);
Assert.assertEquals(newIntervals.get(100).getStart(), 500);
Assert.assertEquals(newIntervals.get(200).getStart(), 600);
Assert.assertEquals(newIntervals.get(201).getStart(), 800);
// Make sure that start = end for all intervals coming out of the LocusIntervalIterator, since each is only 1 bp
Assert.assertTrue(newIntervals.stream().allMatch(i -> i.getEnd() == i.getStart()));
}
Aggregations