use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class PrintReadsIntegrationTest method testNonExistentReference.
@Test(expectedExceptions = UserException.MissingReference.class)
public void testNonExistentReference() throws Exception {
final File inCram = new File(TEST_DATA_DIR, "print_reads.sorted.cram");
final File outCram = BaseTest.createTempFile("print_reads_bad_reference", ".cram");
ArgumentsBuilder args = new ArgumentsBuilder();
args.add("--" + StandardArgumentDefinitions.INPUT_LONG_NAME);
args.add(inCram.getCanonicalPath());
args.add("--" + StandardArgumentDefinitions.OUTPUT_LONG_NAME);
args.add(outCram.getCanonicalPath());
args.add("-R");
args.add(BaseTest.getSafeNonExistentFile("Nonexistent.fasta").getCanonicalPath());
runCommandLine(args.getArgsArray());
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class PrintReadsIntegrationTest method testReadFilters.
@Test(dataProvider = "readFilterTestData")
public void testReadFilters(final String input, final String reference, final String extOut, final List<String> inputArgs, final int expectedCount) throws IOException {
final File outFile = createTempFile("testReadFilter", extOut);
final ArgumentsBuilder args = new ArgumentsBuilder();
args.add("-I");
args.add(new File(TEST_DATA_DIR, input).getAbsolutePath());
args.add("-O");
args.add(outFile.getAbsolutePath());
if (reference != null) {
args.add("-R");
args.add(new File(TEST_DATA_DIR, reference).getAbsolutePath());
}
for (final String filter : inputArgs) {
args.add(filter);
}
runCommandLine(args);
SamReaderFactory factory = SamReaderFactory.makeDefault();
if (reference != null) {
factory = factory.referenceSequence(new File(TEST_DATA_DIR, reference));
}
int count = 0;
try (final SamReader reader = factory.open(outFile)) {
Iterator<SAMRecord> it = reader.iterator();
while (it.hasNext()) {
SAMRecord rec = it.next();
count++;
}
}
Assert.assertEquals(count, expectedCount);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class CountBasesIntegrationTest method testCountBases.
@Test(dataProvider = "filenames")
public void testCountBases(final String fileIn, final String referenceName) throws Exception {
final File ORIG_BAM = new File(getTestDataDir(), fileIn);
final ArgumentsBuilder args = new ArgumentsBuilder();
args.add("--input");
args.add(ORIG_BAM.getAbsolutePath());
if (null != referenceName) {
final File REF = new File(getTestDataDir(), referenceName);
args.add("-R");
args.add(REF.getAbsolutePath());
}
final Object res = this.runCommandLine(args.getArgsArray());
Assert.assertEquals(res, 808l);
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class CountReadsIntegrationTest method testNoArgs.
@Test(expectedExceptions = CommandLineException.class)
public void testNoArgs() throws Exception {
//making sure that this blows up in a very specific way (UserException.CommandLineException) if we give bogus arguments
final ArgumentsBuilder args = new ArgumentsBuilder();
this.runCommandLine(args.getArgsArray());
}
use of org.broadinstitute.hellbender.utils.test.ArgumentsBuilder in project gatk by broadinstitute.
the class CountVariantsIntegrationTest method testCountVariants.
@Test(dataProvider = "countVariantsVCFInputs")
public void testCountVariants(final File fileIn, final String moreArgs, final long expectedCount) throws Exception {
final ArgumentsBuilder ab = new ArgumentsBuilder();
ab.addVCF(fileIn);
ab.add(moreArgs);
final Object res = runCommandLine(ab.getArgsArray());
Assert.assertEquals(res, expectedCount);
}
Aggregations