use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testReadsHeader.
@Test
public void testReadsHeader() throws Exception {
final GATKTool tool = new TestGATKToolWithReads();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File bamFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/reads_data_source_test1.bam");
final String[] args = { "-I", bamFile.getCanonicalPath() };
clp.parseArguments(System.out, args);
tool.onStartup();
final SAMFileHeader headerForReads = tool.getHeaderForReads();
final SamReaderFactory factory = //read the file directly and compare headers
SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT);
try (SamReader samReader = factory.open(bamFile)) {
final SAMFileHeader samFileHeader = samReader.getFileHeader();
Assert.assertEquals(headerForReads, samFileHeader);
}
tool.doWork();
tool.onShutdown();
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testAllowLexicographicallySortedVariantHeader.
@Test
public void testAllowLexicographicallySortedVariantHeader() throws Exception {
final GATKTool tool = new TestGATKToolWithFeatures();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File vcfFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/lexicographically_sorted_dict.vcf");
final String[] args = { "--mask", vcfFile.getCanonicalPath() };
clp.parseArguments(System.out, args);
// This method would throw if sequence dictionary validation failed. Here we are testing
// that it does not throw despite the lexicographically-sorted sequence dictionary in the vcf.
tool.onStartup();
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testNonExistentReferenceFile.
@Test(expectedExceptions = UserException.MissingReference.class)
public void testNonExistentReferenceFile() throws Exception {
final TestGATKToolWithFeatures tool = new TestGATKToolWithFeatures();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final String[] args = { "--reference", BaseTest.getSafeNonExistentFile("NonExistentReferenceFile.fasta").getAbsolutePath() };
clp.parseArguments(System.out, args);
tool.onStartup();
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class GATKToolUnitTest method testBestSequenceDictionary_fromReadsAndReference.
@Test
public void testBestSequenceDictionary_fromReadsAndReference() throws Exception {
final GATKTool tool = new TestGATKToolWithReads();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File bamFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/reads_data_source_test1.bam");
final String fastaFile = hg19MiniReference;
final String[] args = { "-I", bamFile.getCanonicalPath(), "-R", fastaFile };
clp.parseArguments(System.out, args);
tool.onStartup();
//read the dict back in and compare to reference dict
final SAMSequenceDictionary toolDict = tool.getBestAvailableSequenceDictionary();
final SAMSequenceDictionary fastaDict = new IndexedFastaSequenceFile(new File(fastaFile)).getSequenceDictionary();
toolDict.assertSameDictionary(fastaDict);
fastaDict.assertSameDictionary(toolDict);
Assert.assertEquals(toolDict, fastaDict);
}
use of org.broadinstitute.barclay.argparser.CommandLineArgumentParser in project gatk by broadinstitute.
the class ReadInputArgumentCollectionTest method testRequiredIsRequired.
@Test(expectedExceptions = CommandLineException.class)
public void testRequiredIsRequired() {
Object req = new Object() {
@ArgumentCollection
private ReadInputArgumentCollection ric = new RequiredReadInputArgumentCollection();
};
CommandLineParser clp = new CommandLineArgumentParser(req);
String[] args = {};
clp.parseArguments(System.out, args);
}
Aggregations