use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testDisabledDefaultWithArgsProvided.
// Disabled due to https://github.com/broadinstitute/barclay/issues/23
// For now this will just generate a warning, but it should throw
@Test(expectedExceptions = CommandLineException.class, enabled = false)
public void testDisabledDefaultWithArgsProvided() {
// test for arguments provided for a default filter that is also disabled
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(Collections.singletonList(new SampleReadFilter()))));
clp.parseArguments(nullMessageStream, new String[] { "--sample", "fred", "-disableReadFilter", SampleReadFilter.class.getSimpleName() });
// get the command line read filters
clp.getPluginDescriptor(GATKReadFilterPluginDescriptor.class);
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testEnableDuplicateFilter.
@Test(dataProvider = "duplicateFilters", expectedExceptions = CommandLineException.BadArgumentValue.class)
public void testEnableDuplicateFilter(final String[] arguments) {
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(null)));
clp.parseArguments(nullMessageStream, arguments);
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testReadLengthFilter.
@Test
public void testReadLengthFilter() {
final SAMFileHeader header = createHeaderWithReadGroups();
final GATKRead read = simpleGoodRead(header);
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(null)));
String[] args = { "--readFilter", ReadLengthReadFilter.class.getSimpleName(), "--minReadLength", "10", "--maxReadLength", "20" };
clp.parseArguments(nullMessageStream, args);
ReadFilter rf = instantiateFilter(clp, header);
read.setBases(new byte[5]);
Assert.assertFalse(rf.test(read));
read.setBases(new byte[25]);
Assert.assertFalse(rf.test(read));
read.setBases(new byte[15]);
Assert.assertTrue(rf.test(read));
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method testDisabledDefaultWithArgsNotProvided.
@Test
public void testDisabledDefaultWithArgsNotProvided() {
// test for disabling a default filter that has arguments, but they are not provided
GATKReadFilterPluginDescriptor rfDesc = new GATKReadFilterPluginDescriptor(Collections.singletonList(new ReadLengthReadFilter(1, 10)));
CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(rfDesc));
final String filterName = ReadLengthReadFilter.class.getSimpleName();
clp.parseArguments(nullMessageStream, new String[] { "-disableReadFilter", filterName });
// Make sure ReadLengthReadFilter got disabled without an exception
Assert.assertTrue(rfDesc.userArgs.getUserDisabledReadFilterNames().contains(filterName));
Assert.assertTrue(rfDesc.isDisabledFilter(filterName));
}
use of org.broadinstitute.barclay.argparser.CommandLineParser in project gatk by broadinstitute.
the class ReadFilterPluginUnitTest method tesDisableNonExistentReadFilter.
@Test(expectedExceptions = CommandLineException.class)
public void tesDisableNonExistentReadFilter() {
final CommandLineParser clp = new CommandLineArgumentParser(new Object(), Collections.singletonList(new GATKReadFilterPluginDescriptor(null)));
clp.parseArguments(nullMessageStream, new String[] { "-disableReadFilter", "asdfasdf" });
}
Aggregations