Search in sources :

Example 1 with ConcordanceSummaryRecord

use of org.broadinstitute.hellbender.tools.walkers.validation.ConcordanceSummaryRecord in project gatk-protected by broadinstitute.

the class Mutect2IntegrationTest method testDreamTumorNormal.

/**
     * Several DREAM challenge bams with synthetic truth data.  In order to keep file sizes manageable, bams are restricted
     * to chromosome 20, leaving ~100-200 variants, and then further restricted to 400-bp intervals centered around
     * these variants.
     *
     * Because this truth data is synthetic, ideal performance is perfect concordance with the truth vcfs.
     *
     * The characteristics of the data are as follows (note that we removed structural variants from the original
     * DREAM challenge vcfs):
     *
     * Sample 1: pure monoclonal sample, SNVs only
     * Sample2: 80% pure monoclonal sample, SNVs only
     * Sample3: pure triclonal sample, subclone minor allele frequencies are 1/2, 1/3, and 1/5, SNVs and indels
     * Sample 4: 80% biclonal sample, subclone minor allele fractions are 50% and 35%, SNVs and indels
     *
     * @throws Exception
     */
@Test(dataProvider = "dreamSyntheticData")
public void testDreamTumorNormal(final File tumorBam, final String tumorSample, final File normalBam, final String normalSample, final File truthVcf, final File mask, final double requiredSensitivity) throws Exception {
    Utils.resetRandomGenerator();
    final File unfilteredVcf = createTempFile("unfiltered", ".vcf");
    final File filteredVcf = createTempFile("filtered", ".vcf");
    final String[] args = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-R", b37_reference_20_21, "-L", "20", "-germline_resource", GNOMAD.getAbsolutePath(), "-XL", mask.getAbsolutePath(), "-O", unfilteredVcf.getAbsolutePath() };
    runCommandLine(args);
    // run FilterMutectCalls
    new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-V", unfilteredVcf.getAbsolutePath(), "-O", filteredVcf.getAbsolutePath()), "FilterMutectCalls"));
    // run Concordance
    final File concordanceSummary = createTempFile("concordance", ".txt");
    new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-truth", truthVcf.getAbsolutePath(), "-eval", unfilteredVcf.getAbsolutePath(), "-L", "20", "-XL", mask.getAbsolutePath(), "-summary", concordanceSummary.getAbsolutePath()), "Concordance"));
    final List<ConcordanceSummaryRecord> summaryRecords = new ConcordanceSummaryRecord.Reader(concordanceSummary).toList();
    summaryRecords.forEach(rec -> {
        if (rec.getTruePositives() + rec.getFalseNegatives() > 0) {
            Assert.assertTrue(rec.getSensitivity() > requiredSensitivity);
            Assert.assertTrue(rec.getPrecision() > 0.5);
        }
    });
}
Also used : File(java.io.File) Main(org.broadinstitute.hellbender.Main) ConcordanceSummaryRecord(org.broadinstitute.hellbender.tools.walkers.validation.ConcordanceSummaryRecord) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 2 with ConcordanceSummaryRecord

use of org.broadinstitute.hellbender.tools.walkers.validation.ConcordanceSummaryRecord in project gatk by broadinstitute.

the class Mutect2IntegrationTest method testDreamTumorNormal.

/**
     * Several DREAM challenge bams with synthetic truth data.  In order to keep file sizes manageable, bams are restricted
     * to chromosome 20, leaving ~100-200 variants, and then further restricted to 400-bp intervals centered around
     * these variants.
     *
     * Because this truth data is synthetic, ideal performance is perfect concordance with the truth vcfs.
     *
     * The characteristics of the data are as follows (note that we removed structural variants from the original
     * DREAM challenge vcfs):
     *
     * Sample 1: pure monoclonal sample, SNVs only
     * Sample2: 80% pure monoclonal sample, SNVs only
     * Sample3: pure triclonal sample, subclone minor allele frequencies are 1/2, 1/3, and 1/5, SNVs and indels
     * Sample 4: 80% biclonal sample, subclone minor allele fractions are 50% and 35%, SNVs and indels
     *
     * @throws Exception
     */
@Test(dataProvider = "dreamSyntheticData")
public void testDreamTumorNormal(final File tumorBam, final String tumorSample, final File normalBam, final String normalSample, final File truthVcf, final File mask, final double requiredSensitivity) throws Exception {
    Utils.resetRandomGenerator();
    final File unfilteredVcf = createTempFile("unfiltered", ".vcf");
    final File filteredVcf = createTempFile("filtered", ".vcf");
    final String[] args = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-R", b37_reference_20_21, "-L", "20", "-germline_resource", GNOMAD.getAbsolutePath(), "-XL", mask.getAbsolutePath(), "-O", unfilteredVcf.getAbsolutePath() };
    runCommandLine(args);
    // run FilterMutectCalls
    new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-V", unfilteredVcf.getAbsolutePath(), "-O", filteredVcf.getAbsolutePath()), "FilterMutectCalls"));
    // run Concordance
    final File concordanceSummary = createTempFile("concordance", ".txt");
    new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-truth", truthVcf.getAbsolutePath(), "-eval", unfilteredVcf.getAbsolutePath(), "-L", "20", "-XL", mask.getAbsolutePath(), "-summary", concordanceSummary.getAbsolutePath()), "Concordance"));
    final List<ConcordanceSummaryRecord> summaryRecords = new ConcordanceSummaryRecord.Reader(concordanceSummary).toList();
    summaryRecords.forEach(rec -> {
        if (rec.getTruePositives() + rec.getFalseNegatives() > 0) {
            Assert.assertTrue(rec.getSensitivity() > requiredSensitivity);
            Assert.assertTrue(rec.getPrecision() > 0.5);
        }
    });
}
Also used : File(java.io.File) Main(org.broadinstitute.hellbender.Main) ConcordanceSummaryRecord(org.broadinstitute.hellbender.tools.walkers.validation.ConcordanceSummaryRecord) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Aggregations

File (java.io.File)2 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)2 Main (org.broadinstitute.hellbender.Main)2 ConcordanceSummaryRecord (org.broadinstitute.hellbender.tools.walkers.validation.ConcordanceSummaryRecord)2 Test (org.testng.annotations.Test)2