Search in sources :

Example 66 with ArgumentsBuilder

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

the class GenotypeGVCFsIntegrationTest method runGenotypeGVCFSAndAssertSomething.

private void runGenotypeGVCFSAndAssertSomething(String input, File expected, List<String> additionalArguments, BiConsumer<VariantContext, VariantContext> assertion, String reference) throws IOException {
    final File output = createTempFile("genotypegvcf", ".vcf");
    final ArgumentsBuilder args = new ArgumentsBuilder();
    args.addReference(new File(reference)).addArgument("V", input).addOutput(output);
    additionalArguments.forEach(args::add);
    Utils.resetRandomGenerator();
    runCommandLine(args);
    final List<VariantContext> expectedVC = getVariantContexts(expected);
    final List<VariantContext> actualVC = getVariantContexts(output);
    assertForEachElementInLists(actualVC, expectedVC, assertion);
}
Also used : VariantContext(htsjdk.variant.variantcontext.VariantContext) ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File)

Example 67 with ArgumentsBuilder

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

the class CompareDuplicatesSparkIntegrationTest method differentBamTest.

@Test(dataProvider = "CompareDifferentDuplicatesProvider", expectedExceptions = UserException.class, groups = "spark")
public void differentBamTest(File firstBam, File secondBam) throws Exception {
    // These files are the same and should produce no diffs.
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(firstBam.getCanonicalPath());
    args.add("--" + "I2");
    args.add(secondBam.getCanonicalPath());
    args.add("--" + "throwOnDiff");
    args.add("true");
    this.runCommandLine(args.getArgsArray());
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 68 with ArgumentsBuilder

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

the class CompareDuplicatesSparkIntegrationTest method identicalBamTest.

@Test(dataProvider = "CompareIdenticalDuplicatesProvider", groups = "spark")
public void identicalBamTest(File firstBam, File secondBam) throws Exception {
    // These files are the same and should produce no diffs.
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
    args.add(firstBam.getCanonicalPath());
    args.add("--" + "I2");
    args.add(secondBam.getCanonicalPath());
    args.add("--" + "throwOnDiff");
    args.add("true");
    this.runCommandLine(args.getArgsArray());
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 69 with ArgumentsBuilder

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

the class VariantWalkerIntegrationTest method testRequiresSequenceDictionaryForInterval.

@Test(expectedExceptions = UserException.class)
public void testRequiresSequenceDictionaryForInterval() throws Exception {
    String fileIn = "count_variants.vcf";
    String moreArgs = "-L 1";
    final File ORIG_FILE = new File(getTestDataDir(), fileIn);
    ArgumentsBuilder ab = new ArgumentsBuilder();
    ab.add("--variant " + ORIG_FILE.getAbsolutePath());
    ab.add(moreArgs);
    this.runCommandLine(ab.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 70 with ArgumentsBuilder

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

the class VariantWalkerIntegrationTest method testMissingContigForInterval.

@Test(expectedExceptions = UserException.MalformedGenomeLoc.class)
public void testMissingContigForInterval() throws Exception {
    String fileIn = "count_variants_withSequenceDict.vcf";
    String moreArgs = "-L 25";
    final File ORIG_FILE = new File(getTestDataDir(), fileIn);
    ArgumentsBuilder ab = new ArgumentsBuilder();
    ab.add("--variant " + ORIG_FILE.getAbsolutePath());
    ab.add(moreArgs);
    this.runCommandLine(ab.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