use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class PileupSparkIntegrationTest method testFeaturesPileup.
@Test(dataProvider = "shuffle")
public void testFeaturesPileup(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("-metadata " + dbsnp_138_b37_20_21_vcf);
if (useShuffle) {
args.add("--shuffle");
}
this.runCommandLine(args.getArgsArray());
File expected = new File(TEST_DATA_DIR, "expectedFeaturesPileup.txt");
IntegrationTestSpec.assertEqualTextFiles(new File(out, "part-00000"), expected);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class GatherBQSRReportsIntegrationTest method testCombine5Reports.
@Test
public void testCombine5Reports() throws Exception {
final File recal1 = new File(testDir + "HiSeq.1mb.1RG.sg1.table");
final File recal2 = new File(testDir + "HiSeq.1mb.1RG.sg2.table");
final File recal3 = new File(testDir + "HiSeq.1mb.1RG.sg3.table");
final File recal4 = new File(testDir + "HiSeq.1mb.1RG.sg4.table");
final File recal5 = new File(testDir + "HiSeq.1mb.1RG.sg5.table");
//Note: the expected output was created by running GATK3, fixing table headers and sorting in unix "sort -k 2,2 -k 3,3 -k 4,4"
final File recal_original = new File(testDir + "HiSeq.1mb.1RG.noSG.table");
final ArgumentsBuilder args = new ArgumentsBuilder();
args.add("--input");
args.add(recal1.getAbsolutePath());
args.add("--input");
args.add(recal2.getAbsolutePath());
args.add("--input");
args.add(recal3.getAbsolutePath());
args.add("--input");
args.add(recal4.getAbsolutePath());
args.add("--input");
args.add(recal5.getAbsolutePath());
final File outFile = BaseTest.createTempFile("bqsr.", "table");
args.add("-O");
args.add(outFile.getAbsolutePath());
final Object res = this.runCommandLine(args.getArgsArray());
Assert.assertEquals(res, 0);
IntegrationTestSpec.assertEqualTextFiles(outFile, recal_original);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class ApplyVQSRIntegrationTest method testApplyRecalibrationSnpAndIndelTogetherExcludeFiltered.
@Test
public void testApplyRecalibrationSnpAndIndelTogetherExcludeFiltered() throws Exception {
ArgumentsBuilder args = new ArgumentsBuilder();
File tempOut = createTempFile("testApplyRecalibrationSnpAndIndelTogetherExcludeFiltered", ".vcf");
args.add("--variant");
args.add(new File(getToolTestDataDir() + "VQSR.mixedTest.input.vcf"));
args.add("-L");
args.add("20:1000100-1000500");
args.add("-mode");
args.add("BOTH");
args.add("--excludeFiltered");
args.add("-ts_filter_level");
args.add("90.0");
args.add("-tranchesFile ");
args.add(getToolTestDataDir() + "VQSR.mixedTest.tranches");
args.add("-recalFile");
args.add(getToolTestDataDir() + "VQSR.mixedTest.recal.vcf");
args.addOutput(tempOut);
runCommandLine(args);
try (FeatureDataSource<VariantContext> featureSource = new FeatureDataSource<>(tempOut)) {
for (VariantContext feature : featureSource) {
// there should only be unfiltered records in the output VCF file
Assert.assertTrue(feature.isNotFiltered());
}
}
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class AlignAssembledContigsSparkIntegrationTest method testAlignAssembledContigsSparkRunnableMiniCluster.
@Test(dataProvider = "alignAssembledContigsSparkIntegrationTest", groups = "sv")
public void testAlignAssembledContigsSparkRunnableMiniCluster(final AlignAssembledContigsSparkIntegrationTest.AlignAssembledContigsSparkIntegrationTestArgs params) throws Exception {
MiniClusterUtils.runOnIsolatedMiniCluster(cluster -> {
final List<String> argsToBeModified = Arrays.asList(new ArgumentsBuilder().add(params.getCommandLineNoApiKey()).getArgsArray());
final org.apache.hadoop.fs.Path workingDirectory = MiniClusterUtils.getWorkingDir(cluster);
int idx = 0;
idx = argsToBeModified.indexOf("--inputAssemblyDir");
org.apache.hadoop.fs.Path path = new org.apache.hadoop.fs.Path(workingDirectory, "contents.txt");
File file = new File(argsToBeModified.get(idx + 1));
cluster.getFileSystem().copyFromLocalFile(new org.apache.hadoop.fs.Path(file.toURI()), path);
argsToBeModified.set(idx + 1, path.toUri().toString());
path = new org.apache.hadoop.fs.Path(workingDirectory, "reference.fasta");
cluster.getFileSystem().copyFromLocalFile(new org.apache.hadoop.fs.Path(SVIntegrationTestDataProvider.reference.toURI()), path);
path = new org.apache.hadoop.fs.Path(workingDirectory, "reference.fasta.fai");
cluster.getFileSystem().copyFromLocalFile(new org.apache.hadoop.fs.Path(SVIntegrationTestDataProvider.reference_fai.toURI()), path);
path = new org.apache.hadoop.fs.Path(workingDirectory, "reference.2bit");
cluster.getFileSystem().copyFromLocalFile(new org.apache.hadoop.fs.Path(SVIntegrationTestDataProvider.reference_2bit.toURI()), path);
path = new org.apache.hadoop.fs.Path(workingDirectory, "reference.dict");
cluster.getFileSystem().copyFromLocalFile(new org.apache.hadoop.fs.Path(SVIntegrationTestDataProvider.reference_dict.toURI()), path);
idx = argsToBeModified.indexOf("-O");
path = new org.apache.hadoop.fs.Path(workingDirectory, "alignedContigs.txt");
argsToBeModified.set(idx + 1, path.toUri().toString());
new IntegrationTestSpec(String.join(" ", argsToBeModified), SVIntegrationTestDataProvider.dummyExpectedFileNames).executeTest("testAlignAssembledContigsSparkRunnableMiniCluster-", this);
});
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTest method testDiscoverVariantsRunnableMiniCluster.
@Test(dataProvider = "discoverVariantsFromContigAlignmentsSGASparkIntegrationTest", groups = "sv")
public void testDiscoverVariantsRunnableMiniCluster(final DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTest.DiscoverVariantsFromContigAlignmentsSGASparkIntegrationTestArgs 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("--inputAssemblies");
Path path = new Path(workingDirectory, "assemblies_0");
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("--inputAlignments");
path = new Path(workingDirectory, "alignments");
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());
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);
runCommandLine(argsToBeModified);
StructuralVariationDiscoveryPipelineSparkIntegrationTest.svDiscoveryVCFEquivalenceTest(vcfOnHDFS, SVIntegrationTestDataProvider.EXPECTED_SIMPLE_INV_VCF, Arrays.asList("ALIGN_LENGTHS", "CTG_NAMES"), true);
final RemoteIterator<LocatedFileStatus> it = FileSystem.get(workingDirectory.toUri(), new Configuration()).listFiles(workingDirectory, true);
while (it.hasNext()) System.err.println(it.next());
final FileSystem fs = FileSystem.get(workingDirectory.toUri(), new Configuration());
Assert.assertTrue(fs.exists(new Path(argsToBeModified.get(argsToBeModified.indexOf("--inputAlignments") + 1) + "_withTwoAlignments")));
Assert.assertTrue(fs.exists(new Path(argsToBeModified.get(argsToBeModified.indexOf("--inputAlignments") + 1) + "_withMoreThanTwoAlignments")));
});
}
Aggregations