Search in sources :

Example 1 with Pulldown

use of org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown in project gatk by broadinstitute.

the class GetBayesianHetCoverage method runNormalOnly.

/**
     * The normal-only workflow
     */
private void runNormalOnly() {
    final BayesianHetPulldownCalculator normalHetPulldownCalculator;
    final Pulldown normalHetPulldown;
    normalHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), IntervalList.fromFile(snpFile), minimumMappingQuality, minimumBaseQuality, readDepthThreshold, VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor, new BalancedHeterozygousPileupPriorModel());
    logger.info("Calculating the Het pulldown from the normal BAM file using the BALANCED prior...");
    normalHetPulldown = normalHetPulldownCalculator.getHetPulldown(normalBamFile, hetCallingStringency);
    logger.info("Writing Het pulldown from normal reads to " + normalHetOutputFile.toString());
    normalHetPulldown.write(normalHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.FULL);
}
Also used : Pulldown(org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown) BalancedHeterozygousPileupPriorModel(org.broadinstitute.hellbender.tools.exome.pulldown.BalancedHeterozygousPileupPriorModel) BayesianHetPulldownCalculator(org.broadinstitute.hellbender.tools.exome.pulldown.BayesianHetPulldownCalculator)

Example 2 with Pulldown

use of org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown in project gatk by broadinstitute.

the class GetBayesianHetCoverage method runTumorOnly.

/**
     * The tumor-only workflow
     */
private void runTumorOnly() {
    final BayesianHetPulldownCalculator tumorHetPulldownCalculator;
    final Pulldown tumorHetPulldown;
    tumorHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), IntervalList.fromFile(snpFile), minimumMappingQuality, minimumBaseQuality, readDepthThreshold, VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor, new HeterogeneousHeterozygousPileupPriorModel(minimumAbnormalFraction, maximumAbnormalFraction, maximumCopyNumber, quadratureOrder));
    logger.info("Calculating the Het pulldown from the tumor BAM file using the HETEROGENEOUS prior...");
    tumorHetPulldown = tumorHetPulldownCalculator.getHetPulldown(tumorBamFile, hetCallingStringency);
    logger.info("Writing Het pulldown from tumor reads to " + tumorHetOutputFile.toString());
    tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.FULL);
}
Also used : HeterogeneousHeterozygousPileupPriorModel(org.broadinstitute.hellbender.tools.exome.pulldown.HeterogeneousHeterozygousPileupPriorModel) Pulldown(org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown) BayesianHetPulldownCalculator(org.broadinstitute.hellbender.tools.exome.pulldown.BayesianHetPulldownCalculator)

Example 3 with Pulldown

use of org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown in project gatk by broadinstitute.

the class GetHetCoverage method doWork.

@Override
protected Object doWork() {
    //if tumor arguments are missing, throw exception (and do not even get normal pulldown)
    final boolean doTumorPulldown;
    if (tumorHetOutputFile != null && tumorBAMFile != null) {
        doTumorPulldown = true;
    } else if ((tumorHetOutputFile == null) != (tumorBAMFile == null)) {
        throw new CommandLineException("Must specify both BAM and output files for tumor pulldown.");
    } else {
        doTumorPulldown = false;
    }
    final HetPulldownCalculator hetPulldown = new HetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), snpFile, minimumMappingQuality, minimumBaseQuality, VALIDATION_STRINGENCY);
    logger.info("Getting normal het pulldown...");
    final Pulldown normalHetPulldown = hetPulldown.getNormal(normalBAMFile, pvalThreshold, minimumRawReads);
    normalHetPulldown.write(normalHetOutputFile, AllelicCountTableVerbosity.BASIC);
    logger.info("Normal het pulldown written to " + normalHetOutputFile.toString());
    if (doTumorPulldown) {
        final IntervalList normalHetIntervals = normalHetPulldown.getIntervals();
        logger.info("Getting tumor het pulldown...");
        final Pulldown tumorHetPulldown = hetPulldown.getTumor(tumorBAMFile, normalHetIntervals, minimumRawReads);
        tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableVerbosity.BASIC);
        logger.info("Tumor het pulldown written to " + tumorHetOutputFile.toString());
    }
    return "SUCCESS";
}
Also used : Pulldown(org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown) IntervalList(htsjdk.samtools.util.IntervalList) HetPulldownCalculator(org.broadinstitute.hellbender.tools.exome.pulldown.HetPulldownCalculator)

Example 4 with Pulldown

use of org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown in project gatk by broadinstitute.

the class GetBayesianHetCoverage method runMatchedNormalTumor.

/**
     * The matched norrmal-tumor workflow
     */
private void runMatchedNormalTumor() {
    final BayesianHetPulldownCalculator normalHetPulldownCalculator, tumorHetPulldownCalculator;
    final Pulldown normalHetPulldown, tumorHetPulldown;
    normalHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), IntervalList.fromFile(snpFile), minimumMappingQuality, minimumBaseQuality, readDepthThreshold, VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor, new BalancedHeterozygousPileupPriorModel());
    logger.info("Calculating the Het pulldown from the normal BAM file using the BALANCED prior...");
    normalHetPulldown = normalHetPulldownCalculator.getHetPulldown(normalBamFile, hetCallingStringency);
    logger.info("Writing Het pulldown from normal reads to " + normalHetOutputFile.toString());
    normalHetPulldown.write(normalHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.FULL);
    tumorHetPulldownCalculator = new BayesianHetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), normalHetPulldown.getIntervals(), minimumMappingQuality, minimumBaseQuality, readDepthThreshold, VALIDATION_STRINGENCY, errorProbabilityAdjustmentFactor, new BalancedHeterozygousPileupPriorModel());
    logger.info("Calculating the Het pulldown from the tumor BAM file on Hets detected in the normal BAM file...");
    tumorHetPulldown = tumorHetPulldownCalculator.getTumorHetPulldownFromNormalPulldown(tumorBamFile, normalHetPulldown);
    logger.info("Writing Het pulldown from tumor reads to " + tumorHetOutputFile.toString());
    tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableColumn.AllelicCountTableVerbosity.INTERMEDIATE);
}
Also used : Pulldown(org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown) BalancedHeterozygousPileupPriorModel(org.broadinstitute.hellbender.tools.exome.pulldown.BalancedHeterozygousPileupPriorModel) BayesianHetPulldownCalculator(org.broadinstitute.hellbender.tools.exome.pulldown.BayesianHetPulldownCalculator)

Example 5 with Pulldown

use of org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown in project gatk-protected by broadinstitute.

the class GetBayesianHetCoverageIntegrationTest method testNormalJob.

@Test
public void testNormalJob() {
    final File normalOutputFile = createTempFile("normal-test", ".tsv");
    Pulldown normalHetPulldownExpected, normalHetPulldownResult;
    /* test 1: tight calling stringency */
    final String[] args_1 = { "-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME, REF_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SNP_FILE_SHORT_NAME, SNP_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_BAM_FILE_SHORT_NAME, NORMAL_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_ALLELIC_COUNTS_FILE_SHORT_NAME, normalOutputFile.getAbsolutePath(), "-" + GetBayesianHetCoverage.READ_DEPTH_THRESHOLD_SHORT_NAME, Integer.toString(10), "-" + GetBayesianHetCoverage.HET_CALLING_STRINGENCY_SHORT_NAME, Double.toString(15.0) };
    runCommandLine(args_1);
    normalHetPulldownExpected = new Pulldown(normalHeader);
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17, 39.99));
    normalHetPulldownResult = new Pulldown(normalOutputFile, normalHeader);
    Assert.assertEquals(normalHetPulldownExpected, normalHetPulldownResult);
    /* test 2: loose calling stringency */
    final String[] args_2 = { "-" + StandardArgumentDefinitions.REFERENCE_SHORT_NAME, REF_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.SNP_FILE_SHORT_NAME, SNP_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_BAM_FILE_SHORT_NAME, NORMAL_BAM_FILE.getAbsolutePath(), "-" + ExomeStandardArgumentDefinitions.NORMAL_ALLELIC_COUNTS_FILE_SHORT_NAME, normalOutputFile.getAbsolutePath(), "-" + GetBayesianHetCoverage.READ_DEPTH_THRESHOLD_SHORT_NAME, Integer.toString(10), "-" + GetBayesianHetCoverage.HET_CALLING_STRINGENCY_SHORT_NAME, Double.toString(2.0) };
    runCommandLine(args_2);
    normalHetPulldownExpected = new Pulldown(normalHeader);
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 11522, 11522), 7, 4, Nucleotide.G, Nucleotide.A, 11, 18.60));
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 12098, 12098), 8, 6, Nucleotide.G, Nucleotide.T, 14, 29.29));
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("1", 14630, 14630), 9, 8, Nucleotide.T, Nucleotide.G, 17, 39.99));
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14689, 14689), 6, 9, Nucleotide.T, Nucleotide.G, 15, 28.60));
    normalHetPulldownExpected.add(new AllelicCount(new SimpleInterval("2", 14982, 14982), 6, 5, Nucleotide.G, Nucleotide.C, 11, 24.99));
    normalHetPulldownResult = new Pulldown(normalOutputFile, normalHeader);
    Assert.assertEquals(normalHetPulldownExpected, normalHetPulldownResult);
}
Also used : Pulldown(org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown) SimpleInterval(org.broadinstitute.hellbender.utils.SimpleInterval) File(java.io.File) AllelicCount(org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Aggregations

Pulldown (org.broadinstitute.hellbender.tools.exome.pulldown.Pulldown)20 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)10 Test (org.testng.annotations.Test)10 AllelicCount (org.broadinstitute.hellbender.tools.exome.alleliccount.AllelicCount)8 SimpleInterval (org.broadinstitute.hellbender.utils.SimpleInterval)8 File (java.io.File)6 BayesianHetPulldownCalculator (org.broadinstitute.hellbender.tools.exome.pulldown.BayesianHetPulldownCalculator)6 BalancedHeterozygousPileupPriorModel (org.broadinstitute.hellbender.tools.exome.pulldown.BalancedHeterozygousPileupPriorModel)4 SamReader (htsjdk.samtools.SamReader)2 IntervalList (htsjdk.samtools.util.IntervalList)2 HetPulldownCalculator (org.broadinstitute.hellbender.tools.exome.pulldown.HetPulldownCalculator)2 HeterogeneousHeterozygousPileupPriorModel (org.broadinstitute.hellbender.tools.exome.pulldown.HeterogeneousHeterozygousPileupPriorModel)2 BeforeClass (org.testng.annotations.BeforeClass)2