Search in sources :

Example 61 with SimpleInterval

use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.

the class ReferenceContextUnitTest method testInvalidWindowHandlingAtConstruction.

@Test(dataProvider = "InvalidWindowDataProvider", expectedExceptions = GATKException.class)
public void testInvalidWindowHandlingAtConstruction(final int windowStartOffset, final int windowStopOffset) {
    try (ReferenceDataSource reference = new ReferenceFileSource(TEST_REFERENCE)) {
        SimpleInterval interval = new SimpleInterval("1", 5, 10);
        ReferenceContext refContext = new ReferenceContext(reference, interval, windowStartOffset, windowStopOffset);
    }
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 62 with SimpleInterval

use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.

the class ProgressMeterUnitTest method testProcessingRate.

@Test(dataProvider = "ProcessingRateTestData")
public void testProcessingRate(final ListBasedTimeFunction timeFunction, final long recordsToProcess, final double expectedProcessingRate) {
    final ProgressMeter meter = new ProgressMeter(1.0, timeFunction);
    meter.start();
    for (int i = 1; i <= recordsToProcess; ++i) {
        meter.update(new SimpleInterval("1", 1, 1));
    }
    Assert.assertEquals(meter.processingRate(), expectedProcessingRate, "actual processing rate differs from expected value");
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 63 with SimpleInterval

use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.

the class ModeledSegmentUnitTest method testSegmentConstructor.

@Test
public void testSegmentConstructor() {
    SimpleInterval interval = new SimpleInterval("chr", 1, 2);
    String call = "call";
    double segmentMean = -0.0001;
    final long originalProbeCount = 100;
    final ModeledSegment ci = new ModeledSegment(interval, call, originalProbeCount, segmentMean);
    Assert.assertEquals(ci.getSimpleInterval(), interval);
    Assert.assertEquals(ci.getCall(), call);
    Assert.assertEquals(ci.getTargetCount(), originalProbeCount);
    Assert.assertEquals(ci.getSegmentMean(), segmentMean);
    Assert.assertEquals(ci.getSegmentMeanInCRSpace(), Math.pow(2, segmentMean));
    ci.setTargetCount(5);
    Assert.assertEquals(ci.getTargetCount(), 5);
    double segmentMeanInCRSpace = 2;
    ci.setSegmentMeanInCRSpace(segmentMeanInCRSpace);
    Assert.assertEquals(ci.getSegmentMeanInCRSpace(), segmentMeanInCRSpace);
    Assert.assertEquals(ci.getSegmentMean(), 1.0);
    double segmentMeanAgain = 1;
    ci.setSegmentMean(segmentMeanAgain);
    Assert.assertEquals(ci.getSegmentMeanInCRSpace(), segmentMeanInCRSpace);
    Assert.assertEquals(ci.getSegmentMean(), 1.0);
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 64 with SimpleInterval

use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.

the class HashedListTargetCollectionUnitTest method testTargetName.

@Test(dependsOnMethods = { "testCorrectInitialization", "testTargetCount" })
public void testTargetName() {
    for (int i = 0; i < targetDB.targetCount(); i++) {
        final SimpleInterval loc = targetDB.target(i);
        final String name = targetDB.name(loc);
        final SimpleInterval observed = targetDB.target(name);
        Assert.assertEquals(observed, loc);
        Assert.assertEquals(targetDB.index(name), i);
    }
    Assert.assertNull(targetDB.target("no-interval"));
    Assert.assertEquals(targetDB.index("no-interval"), -1);
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 65 with SimpleInterval

use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.

the class HashedListTargetCollectionUnitTest method testEmptyRangeObject.

@Test(dependsOnMethods = { "testCorrectInitialization", "testCorrectRangeObjectInitialization" })
public void testEmptyRangeObject() {
    final IndexRange range = new IndexRange(0, 0);
    final List<SimpleInterval> targets = targetDB.targets(range);
    Assert.assertNotNull(targets);
    Assert.assertEquals(targets.size(), 0);
}
Also used : IndexRange(org.broadinstitute.hellbender.utils.IndexRange) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)545 Test (org.testng.annotations.Test)287 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)202 File (java.io.File)102 ArrayList (java.util.ArrayList)66 DataProvider (org.testng.annotations.DataProvider)64 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)60 Collectors (java.util.stream.Collectors)53 java.util (java.util)41 SAMSequenceDictionary (htsjdk.samtools.SAMSequenceDictionary)40 AllelicCount (org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount)40 UserException (org.broadinstitute.hellbender.exceptions.UserException)39 VariantContext (htsjdk.variant.variantcontext.VariantContext)36 IntStream (java.util.stream.IntStream)34 Target (org.broadinstitute.hellbender.tools.exome.Target)34 IOException (java.io.IOException)32 JavaSparkContext (org.apache.spark.api.java.JavaSparkContext)28 Assert (org.testng.Assert)27 Locatable (htsjdk.samtools.util.Locatable)26 List (java.util.List)26