Search in sources :

Example 56 with ArgumentsBuilder

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

the class MeanQualityByCycleSparkIntegrationTest method test1.

@Test(groups = "spark")
public void test1() throws IOException {
    //Note we compare to non-spark outputs
    final File unsortedBam = new File(TEST_DATA_DIR, "first5000a.bam");
    final File expectedFile = new File(TEST_DATA_DIR, "meanqualbycycle.txt");
    final File outfile = BaseTest.createTempFile("testMeanQualityByCycle", ".metrics");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(unsortedBam.getCanonicalPath());
    args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
    args.add(outfile.getCanonicalPath());
    this.runCommandLine(args.getArgsArray());
    IntegrationTestSpec.assertEqualTextFiles(outfile, expectedFile, "#");
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) MetricsFile(htsjdk.samtools.metrics.MetricsFile) File(java.io.File) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 57 with ArgumentsBuilder

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

the class MeanQualityByCycleSparkIntegrationTest method test_PF_READS_ONLY_false.

@Test(groups = "spark")
public void test_PF_READS_ONLY_false() throws IOException {
    //Note we compare to non-spark outputs
    final File unsortedBam = new File(TEST_DATA_DIR, "example_pfFail_reads.bam");
    final File expectedFile = new File(TEST_DATA_DIR, "pfFailBam.pf.txt");
    final File outfile = BaseTest.createTempFile("pfFailBam.pf.", ".metrics");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(unsortedBam.getCanonicalPath());
    args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
    args.add(outfile.getCanonicalPath());
    args.add("--" + "pfReadsOnly");
    args.add("false");
    this.runCommandLine(args.getArgsArray());
    IntegrationTestSpec.assertEqualTextFiles(outfile, expectedFile, "#");
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) MetricsFile(htsjdk.samtools.metrics.MetricsFile) File(java.io.File) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 58 with ArgumentsBuilder

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

the class PrintReadsSparkIntegrationTest method testNonExistentReference.

@Test(expectedExceptions = UserException.MissingReference.class)
public void testNonExistentReference() throws Exception {
    final File inCram = new File(TEST_DATA_DIR, "print_reads.sorted.cram");
    final File outCram = BaseTest.createTempFile("print_reads_bad_reference", ".cram");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(inCram.getCanonicalPath());
    args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
    args.add(outCram.getCanonicalPath());
    args.add("-R");
    args.add(BaseTest.getSafeNonExistentFile("Nonexistent.fasta").getCanonicalPath());
    runCommandLine(args.getArgsArray());
}
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 59 with ArgumentsBuilder

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

the class AbstractMarkDuplicatesCommandLineProgramTest method testMDOrderImpl.

protected void testMDOrderImpl(final File input, final File expectedOutput, final String extraArgs) throws Exception {
    final File metricsFile = createTempFile("markdups_metrics", ".txt");
    final File outputFile = createTempFile("markdups", ".bam");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("-" + StandardArgumentDefinitions.INPUT_SHORT_NAME);
    args.add(input.getPath());
    args.add("-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME);
    args.add(outputFile.getAbsolutePath());
    args.add("--METRICS_FILE");
    args.add(metricsFile.getAbsolutePath());
    args.add(extraArgs);
    final CommandLineProgram markDuplicates = getCommandLineProgramInstance();
    markDuplicates.instanceMain(args.getArgsArray());
    SamAssertionUtils.assertEqualBamFiles(outputFile, expectedOutput, false, ValidationStringency.SILENT);
}
Also used : CommandLineProgram(org.broadinstitute.hellbender.cmdline.CommandLineProgram) ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File)

Example 60 with ArgumentsBuilder

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

the class ExampleVariantWalkerSparkIntegrationTest method testExampleVariantWalker.

@Test
public void testExampleVariantWalker() throws IOException {
    final File out = File.createTempFile("out", ".txt");
    out.delete();
    out.deleteOnExit();
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("-L 1:100-200");
    // note that joining with reads is not currently supported
    args.add("-V");
    args.add(TEST_DATA_DIRECTORY + "example_variants_withSequenceDict.vcf");
    args.add("-auxiliaryVariants");
    args.add(TEST_DATA_DIRECTORY + "feature_data_source_test.vcf");
    args.add("--output");
    args.add(out.getAbsolutePath());
    args.add("--reference");
    args.add(hg19MiniReference);
    this.runCommandLine(args.getArgsArray());
    File expected = new File(TEST_OUTPUT_DIRECTORY, "expected_ExampleVariantWalkerSparkIntegrationTest_output.txt");
    IntegrationTestSpec.assertEqualTextFiles(new File(out, "part-00000"), expected);
}
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