Search in sources :

Example 81 with ArgumentsBuilder

use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.

the class AddOrReplaceReadGroupsIntegrationTest method runIt.

private void runIt(final File inputFile, final File referenceFile, final File outputFile) {
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--input");
    args.add(inputFile.getAbsolutePath());
    args.add("--output");
    args.add(outputFile.getAbsolutePath());
    if (null != referenceFile) {
        args.add("--R");
        args.add(referenceFile.getAbsolutePath());
    }
    args.add("--LB");
    args.add("foo_LB");
    args.add("--PL");
    args.add("foo_PL");
    args.add("--PU");
    args.add("foo_PU");
    args.add("--SM");
    args.add("foo_SM");
    args.add("--CN");
    args.add("foo_CN");
    args.add("--DS");
    args.add("foo_DS");
    args.add("--DT");
    args.add("2015-08-21T09:40:00");
    args.add("--PI");
    args.add("157");
    args.add("--PG");
    args.add("foo_PG");
    args.add("--PM");
    args.add("foo_PM");
    runCommandLine(args.getArgsList());
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder)

Example 82 with ArgumentsBuilder

use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.

the class GatherBQSRReportsIntegrationTest method testCombineReportsFromTwoChrs.

@Test
public void testCombineReportsFromTwoChrs() throws Exception {
    //NOte: this data was generated by running GATK BaseRecalibrator like this
    //  ./gatk-launch BaseRecalibrator -I src/test/resources/large/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.bam -O gatk4_chr20.tbl --knownSites src/test/resources/large/dbsnp_138.b37.20.21.vcf -R src/test/resources/large/human_g1k_v37.20.21.fasta -L 20
    //  ./gatk-launch BaseRecalibrator -I src/test/resources/large/CEUTrio.HiSeq.WGS.b37.NA12878.20.21.bam -O gatk4_chr21.tbl --knownSites src/test/resources/large/dbsnp_138.b37.20.21.vcf -R src/test/resources/large/human_g1k_v37.20.21.fasta -L 21
    //  ./gatk-launch GatherBQSRReports -I gatk4_chr20.tbl -I gatk4_chr21.tbl -O gatk4_combined.tbl
    // Then, the results were manually compared to those generated by GATK3.4 and confirmed to be the same up to 0.01 (which is OK)
    final File chr20 = new File(testDir + "gatk4_chr20.tbl.gz");
    final File chr21 = new File(testDir + "gatk4_chr21.tbl.gz");
    final File chr2021_combined = new File(testDir + "gatk4_combined.tbl.gz");
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--input");
    args.add(chr20.getAbsolutePath());
    args.add("--input");
    args.add(chr21.getAbsolutePath());
    final File outFile = BaseTest.createTempFile("bqsr2021.", "table");
    args.add("-O");
    args.add(outFile.getAbsolutePath());
    final Object res = this.runCommandLine(args.getArgsArray());
    Assert.assertEquals(res, 0);
    IntegrationTestSpec.assertEqualTextFiles(outFile, chr2021_combined);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 83 with ArgumentsBuilder

use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.

the class BothStepsOfBQSRIntegrationTest method testIndelRemoval.

//Tests that BQSR with and without indel recalibration produces the same bam file
@Test
public void testIndelRemoval() throws Exception {
    //Note; using a small 27M file for speed
    final File bamIn = new File(NA12878_20_21_WGS_bam);
    final String interval = "20";
    final File recalOutWithIndels = baseRecalibrator(bamIn, interval, false);
    final File bamOutWithIndels = applyBQSR(bamIn, interval, recalOutWithIndels, false);
    final File recalOutWithoutIndels = baseRecalibrator(bamIn, interval, true);
    final File bamOutWithoutIndels = applyBQSR(bamIn, interval, recalOutWithoutIndels, true);
    final ArgumentsBuilder args1 = new ArgumentsBuilder();
    args1.addArgument("VALIDATION_STRINGENCY", ValidationStringency.SILENT.name());
    args1.addPositionalArgument(bamOutWithIndels.getAbsolutePath());
    args1.addPositionalArgument(bamOutWithoutIndels.getAbsolutePath());
    final Object result = new Main().instanceMain(makeCommandLineArgs(args1.getArgsList(), CompareBaseQualities.class.getSimpleName()));
    Assert.assertEquals(result, 0);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Main(org.broadinstitute.hellbender.Main) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 84 with ArgumentsBuilder

use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.

the class BothStepsOfBQSRIntegrationTest method applyBQSR.

private File applyBQSR(final File bamIn, final String interval, final File recalOut, final boolean skipIndels) {
    final File bamOut = BaseTest.createTempFile("applyBQSR." + skipIndels, ".bam");
    final ArgumentsBuilder args1 = new ArgumentsBuilder();
    args1.addInput(bamIn);
    args1.addFileArgument("bqsr", recalOut);
    args1.addArgument("L", interval);
    args1.addOutput(bamOut);
    new Main().instanceMain(makeCommandLineArgs(args1.getArgsList(), ApplyBQSR.class.getSimpleName()));
    return bamOut;
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Main(org.broadinstitute.hellbender.Main)

Example 85 with ArgumentsBuilder

use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder 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;
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Main(org.broadinstitute.hellbender.Main)

Aggregations

ArgumentsBuilder (org.broadinstitute.hellbender.utils.test.ArgumentsBuilder)139 Test (org.testng.annotations.Test)127 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)123 File (java.io.File)104 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)62 IntegrationTestSpec (org.broadinstitute.hellbender.utils.test.IntegrationTestSpec)14 MetricsFile (htsjdk.samtools.metrics.MetricsFile)10 Path (org.apache.hadoop.fs.Path)5 VariantContext (htsjdk.variant.variantcontext.VariantContext)4 AbstractMarkDuplicatesCommandLineProgramTest (org.broadinstitute.hellbender.utils.test.testers.AbstractMarkDuplicatesCommandLineProgramTest)4 FileReader (java.io.FileReader)3 Configuration (org.apache.hadoop.conf.Configuration)3 Main (org.broadinstitute.hellbender.Main)3 CommandLineProgram (org.broadinstitute.hellbender.cmdline.CommandLineProgram)3 SAMRecord (htsjdk.samtools.SAMRecord)2 SamReader (htsjdk.samtools.SamReader)2 SamReaderFactory (htsjdk.samtools.SamReaderFactory)2 List (java.util.List)2 org.apache.hadoop.fs (org.apache.hadoop.fs)2 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)2