Search in sources :

Example 41 with ArgumentsBuilder

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

the class CreateHadoopBamSplittingIndexIntegrationTest method testNegativeGranularity.

@Test(expectedExceptions = CommandLineException.BadArgumentValue.class)
public void testNegativeGranularity() {
    final ArgumentsBuilder args = getInputAndOutputArgs(SORTED_BAM, getTempIndexFile()).add("--" + CreateHadoopBamSplittingIndex.SPLITTING_INDEX_GRANULARITY_LONG_NAME).add(-10);
    this.runCommandLine(args);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 42 with ArgumentsBuilder

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

the class PrintReadsSparkIntegrationTest method testSequenceDictionaryValidation.

@Test(expectedExceptions = UserException.IncompatibleSequenceDictionaries.class, groups = "spark")
public void testSequenceDictionaryValidation() throws Exception {
    final File inCram = new File(getTestDataDir(), "print_reads.sorted.cram");
    final File inRef = new File(getTestDataDir(), "print_reads.chr1only.fasta");
    final File outBam = BaseTest.createTempFile("print_reads_spark", ".bam");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(inCram.getCanonicalPath());
    args.add("-R");
    args.add(inRef.getCanonicalPath());
    args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
    args.add(outBam.getCanonicalPath());
    this.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 43 with ArgumentsBuilder

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

the class PrintReadsSparkIntegrationTest method testCoordinateSortedInRegion.

@Test(groups = "spark")
public void testCoordinateSortedInRegion() throws Exception {
    final File inBam = new File(getTestDataDir(), "print_reads.sorted.bam");
    final File expectedBam = new File(getTestDataDir(), "print_reads.sorted.chr1_1.bam");
    final File outBam = BaseTest.createTempFile("print_reads_spark", ".bam");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(inBam.getCanonicalPath());
    args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
    args.add(outBam.getCanonicalPath());
    args.add("-L chr7:1-100 -XL chr7:2-100");
    this.runCommandLine(args.getArgsArray());
    SamAssertionUtils.assertSamsEqual(outBam, expectedBam);
}
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 44 with ArgumentsBuilder

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

the class PileupSparkIntegrationTest method testSimplePileup.

@Test(dataProvider = "shuffle")
public void testSimplePileup(boolean useShuffle) throws Exception {
    final File out = createTempFile();
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--input");
    args.add(NA12878_20_21_WGS_bam);
    args.add("--output");
    args.add(out.getAbsolutePath());
    args.add("--reference");
    args.add(b37_reference_20_21);
    args.add("-L 20:9999900-10000000");
    if (useShuffle) {
        args.add("--shuffle");
    }
    this.runCommandLine(args.getArgsArray());
    File expected = new File(TEST_DATA_DIR, "expectedSimplePileup.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)

Example 45 with ArgumentsBuilder

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

the class PileupSparkIntegrationTest method testInsertLengthPileup.

@Test(dataProvider = "shuffle")
public void testInsertLengthPileup(boolean useShuffle) throws Exception {
    final File out = createTempFile();
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--input");
    args.add(NA12878_20_21_WGS_bam);
    args.add("--output");
    args.add(out.getAbsolutePath());
    args.add("--reference");
    args.add(b37_reference_20_21);
    args.add("-L 20:10000092-10000112");
    args.add("-outputInsertLength");
    if (useShuffle) {
        args.add("--shuffle");
    }
    this.runCommandLine(args.getArgsArray());
    File expected = new File(TEST_DATA_DIR, "expectedInsertLengthPileup.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