use of org.broadinstitute.hellbender.Main in project gatk by broadinstitute.
the class BothStepsOfBQSRIntegrationTest method baseRecalibrator.
private File baseRecalibrator(final File bamIn, final String interval, final boolean skipIndels) {
final File recalOut = BaseTest.createTempFile("baseRecalibrator." + skipIndels, ".recal");
final ArgumentsBuilder args1 = new ArgumentsBuilder();
args1.addInput(bamIn);
args1.addOutput(recalOut);
args1.addArgument("L", interval);
args1.addFileArgument("knownSites", new File(dbsnp_138_b37_20_21_vcf));
args1.addReference(new File(b37_reference_20_21));
args1.addBooleanArgument("indelBQSR", !skipIndels);
new Main().instanceMain(makeCommandLineArgs(args1.getArgsList(), BaseRecalibrator.class.getSimpleName()));
return recalOut;
}
use of org.broadinstitute.hellbender.Main in project gatk-protected by broadinstitute.
the class Mutect2IntegrationTest method testTumorOnly.
// run tumor-only using our mini gnomAD on NA12878, which is not a tumor
// we're just making sure nothing blows up
@Test
public void testTumorOnly() throws Exception {
Utils.resetRandomGenerator();
final File unfilteredVcf = createTempFile("unfiltered", ".vcf");
final File filteredVcf = createTempFile("filtered", ".vcf");
final String[] args = { "-I", NA12878_20_21_WGS_bam, "-tumor", "NA12878", "-R", b37_reference_20_21, "-L", "20:10000000-10010000", "-germline_resource", GNOMAD.getAbsolutePath(), "-O", unfilteredVcf.getAbsolutePath() };
runCommandLine(args);
// run FilterMutectCalls
new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-V", unfilteredVcf.getAbsolutePath(), "-O", filteredVcf.getAbsolutePath()), "FilterMutectCalls"));
final long numVariantsBeforeFiltering = StreamSupport.stream(new FeatureDataSource<VariantContext>(filteredVcf).spliterator(), false).count();
final long numVariantsPassingFilters = StreamSupport.stream(new FeatureDataSource<VariantContext>(filteredVcf).spliterator(), false).filter(vc -> vc.getFilters().isEmpty()).count();
// just a sanity check that this bam has some germline variants on this interval so that our test doesn't pass trivially!
Assert.assertTrue(numVariantsBeforeFiltering > 50);
// every variant on this interval in this sample is in gnomAD
Assert.assertTrue(numVariantsPassingFilters < 2);
}
use of org.broadinstitute.hellbender.Main in project gatk-protected by broadinstitute.
the class Mutect2IntegrationTest method testPon.
// make a pon with a tumor and then use this pon to call somatic variants on the same tumor
// if the pon is doing its job all calls should be filtered by this pon
@Test(dataProvider = "dreamSyntheticDataSample1")
public void testPon(final File tumorBam, final String tumorSample, final File normalBam, final String normalSample) throws Exception {
Utils.resetRandomGenerator();
final File ponVcf = createTempFile("pon", ".vcf");
final String[] createPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-R", b37_reference_20_21, "-L", "20", "-O", ponVcf.getAbsolutePath() };
runCommandLine(createPonArgs);
final File unfilteredVcf = createTempFile("unfiltered", ".vcf");
final File filteredVcf = createTempFile("filtered", ".vcf");
final String[] callWithPonArgs = { "-I", tumorBam.getAbsolutePath(), "-tumor", tumorSample, "-I", normalBam.getAbsolutePath(), "-normal", normalSample, "-normal_panel", ponVcf.getAbsolutePath(), "-R", b37_reference_20_21, "-L", "20", "-O", unfilteredVcf.getAbsolutePath() };
runCommandLine(callWithPonArgs);
// run FilterMutectCalls
new Main().instanceMain(makeCommandLineArgs(Arrays.asList("-V", unfilteredVcf.getAbsolutePath(), "-O", filteredVcf.getAbsolutePath()), "FilterMutectCalls"));
final long numVariants = StreamSupport.stream(new FeatureDataSource<VariantContext>(filteredVcf).spliterator(), false).filter(vc -> vc.getFilters().isEmpty()).count();
Assert.assertEquals(numVariants, 0);
}
use of org.broadinstitute.hellbender.Main 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);
}
});
}
Aggregations