Search in sources :

Example 21 with Locatable

use of htsjdk.samtools.util.Locatable in project gatk by broadinstitute.

the class SimpleIntervalUnitTest method testGoodIntervalsFromLocatable.

@Test(dataProvider = "goodIntervals")
public void testGoodIntervalsFromLocatable(String ignoreMe, String contig, int start, int end) {
    Locatable l = getLocatable(contig, start, end);
    SimpleInterval interval = new SimpleInterval(l);
    Assert.assertEquals(interval.getContig(), contig, "contig");
    Assert.assertEquals(interval.getStart(), start, "start");
    Assert.assertEquals(interval.getEnd(), end, "end");
}
Also used : Locatable(htsjdk.samtools.util.Locatable) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 22 with Locatable

use of htsjdk.samtools.util.Locatable in project gatk by broadinstitute.

the class IntervalsSkipListOneContigUnitTest method testNotSameContig.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNotSameContig() throws Exception {
    List<Locatable> input = Arrays.asList(new SimpleInterval("1", 10, 100), new SimpleInterval("2", 10, 100));
    final IntervalsSkipListOneContig<Locatable> l = new IntervalsSkipListOneContig<>(input);
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Locatable(htsjdk.samtools.util.Locatable) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 23 with Locatable

use of htsjdk.samtools.util.Locatable in project gatk by broadinstitute.

the class IntervalsSkipListOneContigUnitTest method testNullArg.

@Test(expectedExceptions = IllegalArgumentException.class)
public void testNullArg() throws Exception {
    List<Locatable> input = Arrays.asList(new SimpleInterval("1", 10, 100));
    final IntervalsSkipListOneContig<Locatable> l = new IntervalsSkipListOneContig<>(input);
    l.getOverlapping(null);
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Locatable(htsjdk.samtools.util.Locatable) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 24 with Locatable

use of htsjdk.samtools.util.Locatable in project gatk by broadinstitute.

the class IntervalsSkipListOneContigUnitTest method testLotsOfTinyIntervals.

@Test
public void testLotsOfTinyIntervals() throws Exception {
    List<Locatable> input = new ArrayList<>();
    int n = 1000000;
    for (int i = 0; i < n; i++) {
        //1:1-2, 1:4-5, 1:7-8
        input.add(new SimpleInterval("1", 3 * i + 1, 3 * i + 2));
    }
    final IntervalsSkipListOneContig<Locatable> skipList = new IntervalsSkipListOneContig<>(input);
    final List<Locatable> overlapping = skipList.getOverlapping(new SimpleInterval("1", 1, 3 * n + 2));
    Assert.assertEquals(input, overlapping);
}
Also used : ArrayList(java.util.ArrayList) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Locatable(htsjdk.samtools.util.Locatable) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 25 with Locatable

use of htsjdk.samtools.util.Locatable in project gatk by broadinstitute.

the class IntervalsSkipListOneContigUnitTest method testQquetNotSameContig.

@Test
public void testQquetNotSameContig() throws Exception {
    List<Locatable> input = Arrays.asList(new SimpleInterval("1", 10, 100));
    final IntervalsSkipListOneContig<Locatable> l = new IntervalsSkipListOneContig<>(input);
    final List<Locatable> res = l.getOverlappingIgnoringIndex(new SimpleInterval("2", 10, 100));
    Assert.assertEquals(res, Collections.emptyList());
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Locatable(htsjdk.samtools.util.Locatable) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

Locatable (htsjdk.samtools.util.Locatable)38 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)24 Test (org.testng.annotations.Test)22 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)20 ReadPileup (org.broadinstitute.hellbender.utils.pileup.ReadPileup)11 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)10 SAMFileHeader (htsjdk.samtools.SAMFileHeader)6 ArrayList (java.util.ArrayList)5 UserException (org.broadinstitute.hellbender.exceptions.UserException)5 DataProvider (org.testng.annotations.DataProvider)4 SAMSequenceRecord (htsjdk.samtools.SAMSequenceRecord)3 com.google.common.collect (com.google.common.collect)2 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)2 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)2 OverlapDetector (htsjdk.samtools.util.OverlapDetector)2 IOException (java.io.IOException)2 Serializable (java.io.Serializable)2 java.util (java.util)2 LinkedHashMap (java.util.LinkedHashMap)2 Collectors (java.util.stream.Collectors)2