use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method createTestVariantTool.
private TestGATKToolWithVariants createTestVariantTool(final String[] args) {
final TestGATKToolWithVariants tool = new TestGATKToolWithVariants();
if (null != args) {
final CommandLineParser clp = new CommandLineArgumentParser(tool);
clp.parseArguments(System.out, args);
}
return tool;
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testBestSequenceDictionary_fromVariants.
@Test
public void testBestSequenceDictionary_fromVariants() throws Exception {
final GATKTool tool = new TestGATKToolWithFeatures();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File vcfFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/feature_data_source_test_withSequenceDict.vcf");
final String[] args = { "--mask", vcfFile.getCanonicalPath() };
clp.parseArguments(System.out, args);
tool.onStartup();
//read the dict back in and compare to vcf dict
final SAMSequenceDictionary toolDict = tool.getBestAvailableSequenceDictionary();
try (final VCFFileReader reader = new VCFFileReader(vcfFile)) {
final SAMSequenceDictionary vcfDict = reader.getFileHeader().getSequenceDictionary();
toolDict.assertSameDictionary(vcfDict);
vcfDict.assertSameDictionary(toolDict);
Assert.assertEquals(toolDict, vcfDict);
}
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testBestSequenceDictionary_fromNothing.
@Test
public void testBestSequenceDictionary_fromNothing() throws Exception {
final GATKTool tool = new TestGATKToolWithNothing();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final String[] args = {};
clp.parseArguments(System.out, args);
tool.onStartup();
//read the dict back in and assert that it's null
final SAMSequenceDictionary toolDict = tool.getBestAvailableSequenceDictionary();
Assert.assertNull(toolDict);
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method setupVCFWriter.
private File setupVCFWriter(final File inputFile, final String outputExtension, final GATKTool tool, final boolean createIndex, final boolean createMD5, final boolean lenient) throws IOException {
final File tmpDir = createTempDir("createVCFTest");
final File outputFile = new File(tmpDir.getAbsolutePath(), "createVCFTest" + outputExtension);
ArgumentsBuilder args = new ArgumentsBuilder();
args.addInput(inputFile);
args.addOutput(outputFile);
args.add("--createOutputVariantIndex");
args.add(Boolean.toString(createIndex));
args.add("--createOutputVariantMD5");
args.add(Boolean.toString(createMD5));
if (lenient) {
args.add("--lenient");
}
final CommandLineParser clp = new CommandLineArgumentParser(tool);
clp.parseArguments(System.out, args.getArgsArray());
return outputFile;
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testValidationStringency.
private void testValidationStringency(final String bamFileName, final String referenceFileName, final String validationStringency, final int count) throws SAMFormatException {
final TestGATKToolValidationStringency tool = new TestGATKToolValidationStringency();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File bamFile = new File(NA12878_chr17_1k_CRAM);
final File refFile = new File(v37_chr17_1Mb_Reference);
final String[] args = { "-I", bamFileName, "-R", referenceFileName, "-VS", validationStringency };
clp.parseArguments(System.out, args);
tool.onStartup();
tool.doWork();
tool.onShutdown();
Assert.assertEquals(tool.getCount(), count);
}
Aggregations