Search in sources :

Example 36 with AllelicCount

use of org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount in project gatk by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetTumorHetPulldown15.

@DataProvider(name = "inputGetTumorHetPulldownMin15")
public Object[][] inputGetTumorHetPulldown15() {
    final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
    normalHetIntervals.add(new Interval("1", 14630, 14630));
    normalHetIntervals.add(new Interval("2", 14689, 14689));
    return new Object[][] { { normalHetIntervals, tumorHetPulldown } };
}
Also used : IntervalList(htsjdk.samtools.util.IntervalList) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Interval(htsjdk.samtools.util.Interval) DataProvider(org.testng.annotations.DataProvider)

Example 37 with AllelicCount

use of org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount in project gatk by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetNormalHetPulldown.

@DataProvider(name = "inputGetNormalHetPulldown")
public Object[][] inputGetNormalHetPulldown() {
    final Pulldown normalHetPulldown1 = new Pulldown(normalHeader);
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    //changing pValThreshold from 0.05 -> 0.95 only keeps hets close to balanced
    final Pulldown normalHetPulldown2 = new Pulldown(normalHeader);
    normalHetPulldown2.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    normalHetPulldown2.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    return new Object[][] { { 0.05, normalHetPulldown1 }, { 0.95, normalHetPulldown2 } };
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) DataProvider(org.testng.annotations.DataProvider)

Example 38 with AllelicCount

use of org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount in project gatk by broadinstitute.

the class AlleleFractionHMMUnitTest method equalMinorFractionsTest.

// if all states have the same minor fraction, then regardless of data the hidden state probabilities are
// proportional to the weights
@Test
public void equalMinorFractionsTest() {
    // only the second state
    final List<Double> weights = Arrays.asList(0.2, 0.3, 0.5);
    final List<Double> minorAlleleFractions = Arrays.asList(0.3, 0.3, 0.3);
    final double memoryLength = 1e3;
    final AlleleFractionGlobalParameters params = new AlleleFractionGlobalParameters(0.1, 0.01, 0.03);
    final AlleleFractionHMM model = new AlleleFractionHMM(minorAlleleFractions, weights, memoryLength, AllelicPanelOfNormals.EMPTY_PON, params);
    final Random random = new Random(13);
    final int chainLength = 10000;
    final List<SimpleInterval> positions = new ArrayList<>();
    final List<AllelicCount> data = new ArrayList<>();
    int position = 1;
    for (int n = 0; n < chainLength; n++) {
        position += random.nextInt((int) (2 * memoryLength));
        final SimpleInterval interval = new SimpleInterval("chr1", position, position);
        positions.add(interval);
        data.add(new AllelicCount(interval, random.nextInt(30) + 1, random.nextInt(30) + 1));
    }
    final ForwardBackwardAlgorithm.Result<AllelicCount, SimpleInterval, Integer> fbResult = ForwardBackwardAlgorithm.apply(data, positions, model);
    for (int pos = 0; pos < chainLength; pos++) {
        for (int state = 0; state < weights.size(); state++) {
            Assert.assertEquals(fbResult.logProbability(pos, state), Math.log(weights.get(state)), 1e-5);
        }
    }
}
Also used : AlleleFractionGlobalParameters(org.broadinstitute.hellbender.tools.exome.allelefraction.AlleleFractionGlobalParameters) ForwardBackwardAlgorithm(org.broadinstitute.hellbender.utils.hmm.ForwardBackwardAlgorithm) ArrayList(java.util.ArrayList) Random(java.util.Random) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) Test(org.testng.annotations.Test)

Example 39 with AllelicCount

use of org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount in project gatk-protected by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetNormalHetPulldown.

@DataProvider(name = "inputGetNormalHetPulldown")
public Object[][] inputGetNormalHetPulldown() {
    final Pulldown normalHetPulldown1 = new Pulldown(normalHeader);
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    normalHetPulldown1.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    //changing pValThreshold from 0.05 -> 0.95 only keeps hets close to balanced
    final Pulldown normalHetPulldown2 = new Pulldown(normalHeader);
    normalHetPulldown2.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    normalHetPulldown2.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    return new Object[][] { { 0.05, normalHetPulldown1 }, { 0.95, normalHetPulldown2 } };
}
Also used : SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) DataProvider(org.testng.annotations.DataProvider)

Example 40 with AllelicCount

use of org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount in project gatk-protected by broadinstitute.

the class HetPulldownCalculatorUnitTest method inputGetTumorHetPulldown.

@DataProvider(name = "inputGetTumorHetPulldown")
public Object[][] inputGetTumorHetPulldown() {
    final Pulldown tumorHetPulldown = new Pulldown(normalHeader);
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9));
    tumorHetPulldown.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5));
    final IntervalList normalHetIntervals = new IntervalList(tumorHeader);
    normalHetIntervals.add(new Interval("1", 11522, 11522));
    normalHetIntervals.add(new Interval("1", 12098, 12098));
    normalHetIntervals.add(new Interval("1", 14630, 14630));
    normalHetIntervals.add(new Interval("2", 14689, 14689));
    normalHetIntervals.add(new Interval("2", 14982, 14982));
    return new Object[][] { { normalHetIntervals, tumorHetPulldown } };
}
Also used : IntervalList(htsjdk.samtools.util.IntervalList) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) Interval(htsjdk.samtools.util.Interval) DataProvider(org.testng.annotations.DataProvider)

Aggregations

AllelicCount (org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount)62 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)38 Test (org.testng.annotations.Test)32 File (java.io.File)22 UserException (org.broadinstitute.hellbender.exceptions.UserException)14 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)10 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)10 IntervalList (htsjdk.samtools.util.IntervalList)8 Pulldown (org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown)8 Utils (org.broadinstitute.hellbender.utils.Utils)8 Interval (htsjdk.samtools.util.Interval)6 SamLocusIterator (htsjdk.samtools.util.SamLocusIterator)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 AllelicCountCollection (org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCountCollection)6 ParamUtils (org.broadinstitute.hellbender.utils.param.ParamUtils)6 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)5 IOUtils (org.broadinstitute.hellbender.utils.io.IOUtils)5 ReferenceSequenceFileWalker (htsjdk.samtools.reference.ReferenceSequenceFileWalker)4