use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk-protected by broadinstitute.
the class GenotypeGVCFsIntegrationTest method testIntervalsAndOnlyOutputCallsStartingInIntervalsAreMutuallyRequired.
@Test
public void testIntervalsAndOnlyOutputCallsStartingInIntervalsAreMutuallyRequired() {
ArgumentsBuilder args = new ArgumentsBuilder().addVCF(getTestFile("leadingDeletion.g.vcf")).addReference(new File(b37_reference_20_21)).addOutput(createTempFile("tmp", ".vcf")).addBooleanArgument(GenotypeGVCFs.ONLY_OUTPUT_CALLS_STARTING_IN_INTERVALS_FULL_NAME, true);
Assert.assertThrows(CommandLineException.MissingArgument.class, () -> runCommandLine(args));
args.addArgument("L", "20:69512-69513");
runCommandLine(args);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk-protected 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);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTest method testDiscoverVariantsFromContigAlignmentsSGASparkRunnableLocal.
@Test(dataProvider = "discoverVariantsFromContigAlignmentsSGASparkIntegrationTest", groups = "sv")
public void testDiscoverVariantsFromContigAlignmentsSGASparkRunnableLocal(final DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTest.DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTestArgs params) throws Exception {
final List<String> args = Arrays.asList(new ArgumentsBuilder().add(params.getCommandLineNoApiKey()).getArgsArray());
runCommandLine(args);
StructuralVariationDiscoveryPipelineSparkIntegrationTest.svDiscoveryVCFEquivalenceTest(args.get(args.indexOf("-O") + 1), SVIntegrationTestDataProvider.EXPECTED_SIMPLE_INV_VCF, Arrays.asList("ALIGN_LENGTHS", "CTG_NAMES"), false);
Assert.assertTrue(Files.exists(Paths.get(args.get(args.indexOf("--inputAlignments") + 1) + "_withMoreThanTwoAlignments")));
Assert.assertTrue(Files.exists(Paths.get(args.get(args.indexOf("--inputAlignments") + 1) + "_withTwoAlignments")));
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class FindBreakpointEvidenceSparkIntegrationTest method testFindBreakpointRunnableMiniCluster.
@Test(dataProvider = "findBreakpointEvidenceSparkIntegrationTest", groups = "sv")
public void testFindBreakpointRunnableMiniCluster(final FindBreakpointEvidenceSparkIntegrationTestArgs 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("--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());
idx = argsToBeModified.indexOf("-O");
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());
new IntegrationTestSpec(String.join(" ", argsToBeModified), SVIntegrationTestDataProvider.dummyExpectedFileNames).executeTest("testFindBreakpointEvidenceSparkRunnableMiniCluster-", this);
});
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class QualityScoreDistributionSparkIntegrationTest method test.
@Test(dataProvider = "QualityScoreDistribution", groups = { "spark", "R" })
public void test(final String unsortedBamName, final String expectedFileName, final String referenceName, final boolean makePdf, final boolean pfReadsOnly, final boolean alignedReadsOnly) throws IOException {
final File unsortedBam = new File(TEST_DATA_DIR, unsortedBamName);
final File expectedFile = new File(TEST_DATA_DIR, expectedFileName);
//Note we compare to non-spark outputs
final File outfile = BaseTest.createTempFile("test", ".metrics");
final File pdf = BaseTest.createTempFile("test", ".pdf");
ArgumentsBuilder args = new ArgumentsBuilder();
args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
args.add(unsortedBam.getCanonicalPath());
args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
args.add(outfile.getCanonicalPath());
if (null != referenceName) {
final File REF = new File(referenceName);
args.add("-R");
args.add(REF.getAbsolutePath());
}
if (makePdf) {
args.add("--" + "chart");
args.add(pdf.getCanonicalPath());
}
args.add("--" + "pfReadsOnly");
args.add(pfReadsOnly);
args.add("--" + "alignedReadsOnly");
args.add(alignedReadsOnly);
this.runCommandLine(args.getArgsArray());
IntegrationTestSpec.assertEqualTextFiles(outfile, expectedFile, "#");
}
Aggregations