Search in sources :

Example 76 with ArgumentsBuilder

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

the class CompareBaseQualitiesIntegrationTest method identicalBamTest.

@Test
public void identicalBamTest() throws Exception {
    // This test verifies that if two bams are identical that they produce zero diffs.
    final String resourceDir = getTestDataDir() + "/validation/";
    final File firstBam = new File(resourceDir, "CEUTrio.HiSeq.WGS.b37.ch20.1m-1m1k.NA12878.bam");
    final File secondBam = new File(resourceDir, "CEUTrio.HiSeq.WGS.b37.ch20.1m-1m1k.NA12878.bam");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.add(firstBam.getCanonicalPath());
    args.add(secondBam.getCanonicalPath());
    args.add("--throwOnDiff true");
    args.add("--VALIDATION_STRINGENCY SILENT");
    final Object result = this.runCommandLine(args);
    Assert.assertEquals(result, 0);
}
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 77 with ArgumentsBuilder

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

the class StructuralVariationDiscoveryPipelineSparkIntegrationTest method testSVDiscoverPipelineRunnableMiniCluster.

@Test(dataProvider = "svDiscoverPipelineSparkIntegrationTest", groups = "sv")
public void testSVDiscoverPipelineRunnableMiniCluster(final StructuralVariationDiscoveryPipelineSparkIntegrationTest.StructuralVariationDiscoveryPipelineSparkIntegrationTestArgs params) throws Exception {
    MiniClusterUtils.runOnIsolatedMiniCluster(cluster -> {
        final List<String> argsToBeModified = Arrays.asList(new ArgumentsBuilder().add(params.getCommandLineNoApiKey()).getArgsArray());
        final Path workingDirectory = MiniClusterUtils.getWorkingDir(cluster);
        int idx = 0;
        idx = argsToBeModified.indexOf("-I");
        Path path = new Path(workingDirectory, "hdfs.bam");
        File file = new File(argsToBeModified.get(idx + 1));
        cluster.getFileSystem().copyFromLocalFile(new Path(file.toURI()), path);
        argsToBeModified.set(idx + 1, path.toUri().toString());
        idx = argsToBeModified.indexOf("-R");
        path = new Path(workingDirectory, "reference.2bit");
        file = new File(argsToBeModified.get(idx + 1));
        cluster.getFileSystem().copyFromLocalFile(new Path(file.toURI()), path);
        argsToBeModified.set(idx + 1, path.toUri().toString());
        idx = argsToBeModified.indexOf("--fastaReference");
        path = new Path(workingDirectory, "reference.fasta");
        file = new File(argsToBeModified.get(idx + 1));
        cluster.getFileSystem().copyFromLocalFile(new Path(file.toURI()), path);
        argsToBeModified.set(idx + 1, path.toUri().toString());
        idx = argsToBeModified.indexOf("--kmersToIgnore");
        path = new Path(workingDirectory, "dummy.kill.kmers");
        file = new File(argsToBeModified.get(idx + 1));
        cluster.getFileSystem().copyFromLocalFile(new Path(file.toURI()), path);
        argsToBeModified.set(idx + 1, path.toUri().toString());
        path = new Path(workingDirectory, "reference.fasta.fai");
        cluster.getFileSystem().copyFromLocalFile(new Path(SVIntegrationTestDataProvider.reference_fai.toURI()), path);
        path = new Path(workingDirectory, "reference.dict");
        cluster.getFileSystem().copyFromLocalFile(new Path(SVIntegrationTestDataProvider.reference_dict.toURI()), path);
        idx = argsToBeModified.indexOf("-O");
        path = new Path(workingDirectory, "variants.vcf");
        final String vcfOnHDFS = path.toUri().toString();
        argsToBeModified.set(idx + 1, vcfOnHDFS);
        idx = argsToBeModified.indexOf("--contigSAMFile");
        path = new Path(workingDirectory, "assemblies.sam");
        argsToBeModified.set(idx + 1, path.toUri().toString());
        idx = argsToBeModified.indexOf("--breakpointIntervals");
        path = new Path(workingDirectory, "intervals");
        argsToBeModified.set(idx + 1, path.toUri().toString());
        idx = argsToBeModified.indexOf("--fastqDir");
        path = new Path(workingDirectory, "fastq");
        argsToBeModified.set(idx + 1, path.toUri().toString());
        runCommandLine(argsToBeModified);
        svDiscoveryVCFEquivalenceTest(vcfOnHDFS, SVIntegrationTestDataProvider.EXPECTED_SIMPLE_DEL_VCF, Arrays.asList("ALIGN_LENGTHS", "CTG_NAMES"), true);
    });
}
Also used : Path(org.apache.hadoop.fs.Path) 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 78 with ArgumentsBuilder

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

the class UnmarkDuplicatesIntegrationTest method testUnmarkDuplicates.

@Test(dataProvider = "testUnmarkDuplicatesProvider")
public void testUnmarkDuplicates(String samFile, int duplicateCount, File referenceFile) throws IOException {
    final File inputBam = new File(getTestDataDir(), samFile);
    Assert.assertEquals(getDuplicateCountForBam(inputBam, referenceFile), duplicateCount, "Wrong number of duplicates in original input file");
    final File outputBam = createTempFile("testUnmarkDuplicates", ".bam");
    ArgumentsBuilder args = new ArgumentsBuilder();
    args.addInput(inputBam).addOutput(outputBam);
    if (referenceFile != null) {
        args.addReference(referenceFile);
    }
    runCommandLine(args);
    Assert.assertEquals(getDuplicateCountForBam(outputBam, referenceFile), 0, "Duplicates still present after UnmarkDuplicates");
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 79 with ArgumentsBuilder

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

the class GenomicsDBImportIntegrationTest method testCantSpecifyVCFAndSampleNameFile.

@Test(expectedExceptions = CommandLineException.class)
public void testCantSpecifyVCFAndSampleNameFile() {
    final ArgumentsBuilder args = new ArgumentsBuilder().addArgument(GenomicsDBImport.SAMPLE_NAME_MAP_LONG_NAME, createTempSampleMapFile().getAbsolutePath()).addArgument(StandardArgumentDefinitions.VARIANT_LONG_NAME, HG_00096).addArgument(GenomicsDBImport.WORKSPACE_ARG_NAME, createTempDir("workspace").getAbsolutePath()).addArgument("L", IntervalUtils.locatableToString(INTERVAL));
    runCommandLine(args);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 80 with ArgumentsBuilder

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

the class CollectMultipleMetricsIntegrationTest method test.

@Test(dataProvider = "metricsTestFiles")
public void test(final String fileName, final String referenceName, final String expectedInsertSizeResults) throws IOException {
    ArgumentsBuilder args = new ArgumentsBuilder();
    String outBase = setupMultipleCollector(args, fileName, referenceName);
    // for now, run the only two conforming collectors that we have
    args.add("--PROGRAM");
    args.add("CollectInsertSizeMetrics");
    this.runCommandLine(args.getArgsArray());
    validateInsertSizeMetrics(outBase, expectedInsertSizeResults);
}
Also used : ArgumentsBuilder(org.broadinstitute.hellbender.utils.test.ArgumentsBuilder) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) 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