Search in sources :

Example 26 with ArgumentsBuilder

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

the class BQSRPipelineSparkIntegrationTest method testBlowUpOnBroadcastIncompatibleReference.

@Test(groups = "spark")
public void testBlowUpOnBroadcastIncompatibleReference() throws IOException {
    //this should blow up because broadcast requires a 2bit reference
    final String hiSeqBam_chr20 = getResourceDir() + WGS_B37_CH20_1M_1M1K_BAM;
    final String dbSNPb37_chr20 = getResourceDir() + DBSNP_138_B37_CH20_1M_1M1K_VCF;
    BQSRTest params = new BQSRTest(b37_reference_20_21, hiSeqBam_chr20, dbSNPb37_chr20, ".bam", "-indelBQSR -enableBAQ " + "--joinStrategy BROADCAST", getResourceDir() + BQSRTestData.EXPECTED_WGS_B37_CH20_1M_1M1K_RECAL);
    ArgumentsBuilder ab = new ArgumentsBuilder().add(params.getCommandLineNoApiKey());
    IntegrationTestSpec spec = new IntegrationTestSpec(ab.getString(), 1, UserException.Require2BitReferenceForBroadcast.class);
    spec.executeTest("testBQSR-" + params.args, this);
}
Also used : IntegrationTestSpec(org.broadinstitute.hellbender.utils.test.IntegrationTestSpec) ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) UserException(org.broadinstitute.hellbender.exceptions.UserException) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 27 with ArgumentsBuilder

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

the class CountBasesSparkIntegrationTest method testNoNPRWhenOutputIsUnspecified.

@Test(groups = "spark")
public void testNoNPRWhenOutputIsUnspecified() {
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.addInput(new File(getTestDataDir(), "count_bases.bam"));
    this.runCommandLine(args.getArgsArray());
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 28 with ArgumentsBuilder

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

the class CountReadsSparkIntegrationTest method testCountReadsWithIntervals.

@Test(dataProvider = "intervals", groups = "spark")
public void testCountReadsWithIntervals(final String interval_args, final long expectedCount) throws Exception {
    final File ORIG_BAM = new File(getTestDataDir(), "count_reads_sorted.bam");
    final File outputFile = createTempFile("count_reads_spark", "count");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.addInput(ORIG_BAM);
    args.add(interval_args);
    args.addOutput(outputFile);
    this.runCommandLine(args.getArgsArray());
    try (XReadLines output = new XReadLines(outputFile)) {
        Assert.assertEquals((long) Long.valueOf(output.next()), expectedCount);
    }
}
Also used : XReadLines(org.broadinstitute.hellbender.utils.text.XReadLines) ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 29 with ArgumentsBuilder

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

the class CountReadsSparkIntegrationTest method testCountReads.

@Test(dataProvider = "filenames", groups = "spark")
public void testCountReads(final String fileIn, final String referenceName, final long expectedCount) throws Exception {
    final File ORIG_BAM = new File(getTestDataDir(), fileIn);
    final File outputTxt = createTempFile("count_reads", ".txt");
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.addInput(ORIG_BAM);
    args.addOutput(outputTxt);
    if (null != referenceName) {
        final File REF = new File(getTestDataDir(), referenceName);
        args.addReference(REF);
    }
    this.runCommandLine(args.getArgsArray());
    final String readIn = FileUtils.readFileToString(outputTxt.getAbsoluteFile());
    Assert.assertEquals((long) Long.valueOf(readIn), expectedCount);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 30 with ArgumentsBuilder

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

the class CountReadsSparkIntegrationTest method testNoNPRWhenOutputIsUnspecified.

@Test(groups = "spark")
public void testNoNPRWhenOutputIsUnspecified() {
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.addInput(new File(getTestDataDir(), "count_reads.bam"));
    this.runCommandLine(args.getArgsArray());
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

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