use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testToolHasDefaultRequiredArgsNegative.
@Test(expectedExceptions = CommandLineException.MissingArgument.class)
public void testToolHasDefaultRequiredArgsNegative() {
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(Collections.singletonList(new ReadGroupReadFilter()))));
// ReadGroupReadFilter has a required "keepReadGroup" arg; don't provide it and fail
String[] args = {};
clp.parseArguments(nullMessageStream, args);
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testToolHasDefaultRequiredArgsPositive.
@Test(dataProvider = "testDefaultFilters")
public void testToolHasDefaultRequiredArgsPositive(final String[] args) {
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(Collections.singletonList(new ReadGroupReadFilter()))));
clp.parseArguments(nullMessageStream, args);
SAMFileHeader samHeader = createHeaderWithReadGroups();
ReadFilter rf = instantiateFilter(clp, samHeader);
final GATKRead read = simpleGoodRead(samHeader);
// make sure the test read actually has this read group
Assert.assertEquals(read.getReadGroup(), readgroupName);
Assert.assertTrue(rf.test(read));
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testEnableDisableConflict.
@Test(expectedExceptions = CommandLineException.class)
public void testEnableDisableConflict() {
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(null)));
clp.parseArguments(nullMessageStream, new String[] { "--RF", "GoodCigarReadFilter", "--disableReadFilter", "GoodCigarReadFilter" });
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class VariantWalkerIntegrationTest method testBestSequenceDictionary_FromVariantReference.
@Test
public void testBestSequenceDictionary_FromVariantReference() throws Exception {
final GATKTool tool = new TestGATKToolWithFeatures();
final CommandLineParser clp = new CommandLineArgumentParser(tool);
final File vcfFile = new File(publicTestDir + "org/broadinstitute/hellbender/engine/example_variants_noSequenceDict.vcf");
final String[] args = { "-V", vcfFile.getCanonicalPath(), "-R", hg19MiniReference };
clp.parseArguments(System.out, args);
tool.onStartup();
// make sure we DON'T get the seq dictionary from the VCF index, and instead get the one from
// the reference when its better
final SAMSequenceDictionary toolDict = tool.getBestAvailableSequenceDictionary();
Assert.assertFalse(toolDict.getSequences().stream().allMatch(seqRec -> seqRec.getSequenceLength() == 0));
SAMSequenceDictionary refDict = new ReferenceFileSource(new File(hg19MiniReference)).getSequenceDictionary();
toolDict.assertSameDictionary(refDict);
refDict.assertSameDictionary(toolDict);
Assert.assertEquals(toolDict, refDict);
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testDisableToolDefaultFilters.
@Test(dataProvider = "disableToolDefaulFiltersArguments")
public void testDisableToolDefaultFilters(final String[] args, final List<ReadFilter> defaultFilters, final ReadFilter expectedFilter) {
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(defaultFilters)));
clp.parseArguments(nullMessageStream, args);
GATKReadFilterPluginDescriptor readFilterPlugin = clp.getPluginDescriptor(GATKReadFilterPluginDescriptor.class);
Assert.assertTrue(readFilterPlugin.userArgs.getDisableToolDefaultReadFilters());
// no instances because no readFilter was provided
List<ReadFilter> readFilters = readFilterPlugin.getAllInstances();
Assert.assertEquals(readFilters.size(), (expectedFilter == null) ? 0 : 1);
// all the default filters returns true for isDisabledFilter if it is not the expected
defaultFilters.stream().map(df -> df.getClass().getSimpleName()).filter(df -> expectedFilter == null || expectedFilter.getClass().getSimpleName().equals(df)).forEach(df -> Assert.assertTrue(readFilterPlugin.isDisabledFilter(df.getClass().getSimpleName())));
ReadFilter rf = instantiateFilter(clp, createHeaderWithReadGroups());
Assert.assertEquals(rf.getClass().getSimpleName(), (expectedFilter == null) ? ReadFilterLibrary.ALLOW_ALL_READS.getClass().getSimpleName() : expectedFilter.getClass().getSimpleName());
}
Aggregations