Search in sources :

Example 6 with GATKReadFilterPluginDescriptor

use of org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor 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));
}
Also used : GATKReadFilterPluginDescriptor(org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor) CommandLineArgumentParser(org.broadinstitute.barclay.argparser.CommandLineArgumentParser) CommandLineParser(org.broadinstitute.barclay.argparser.CommandLineParser) Test(org.testng.annotations.Test)

Example 7 with GATKReadFilterPluginDescriptor

use of org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor 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" });
}
Also used : GATKReadFilterPluginDescriptor(org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor) CommandLineArgumentParser(org.broadinstitute.barclay.argparser.CommandLineArgumentParser) CommandLineParser(org.broadinstitute.barclay.argparser.CommandLineParser) Test(org.testng.annotations.Test)

Example 8 with GATKReadFilterPluginDescriptor

use of org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor 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);
}
Also used : GATKReadFilterPluginDescriptor(org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor) CommandLineArgumentParser(org.broadinstitute.barclay.argparser.CommandLineArgumentParser) CommandLineParser(org.broadinstitute.barclay.argparser.CommandLineParser) Test(org.testng.annotations.Test)

Example 9 with GATKReadFilterPluginDescriptor

use of org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor 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));
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) GATKReadFilterPluginDescriptor(org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor) CommandLineArgumentParser(org.broadinstitute.barclay.argparser.CommandLineArgumentParser) CommandLineParser(org.broadinstitute.barclay.argparser.CommandLineParser) SAMFileHeader(htsjdk.samtools.SAMFileHeader) Test(org.testng.annotations.Test)

Example 10 with GATKReadFilterPluginDescriptor

use of org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor 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" });
}
Also used : GATKReadFilterPluginDescriptor(org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor) CommandLineArgumentParser(org.broadinstitute.barclay.argparser.CommandLineArgumentParser) CommandLineParser(org.broadinstitute.barclay.argparser.CommandLineParser) Test(org.testng.annotations.Test)

Aggregations

CommandLineArgumentParser (org.broadinstitute.barclay.argparser.CommandLineArgumentParser)25 CommandLineParser (org.broadinstitute.barclay.argparser.CommandLineParser)25 GATKReadFilterPluginDescriptor (org.broadinstitute.hellbender.cmdline.GATKPlugin.GATKReadFilterPluginDescriptor)25 Test (org.testng.annotations.Test)25 SAMFileHeader (htsjdk.samtools.SAMFileHeader)5 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)5 ArrayList (java.util.ArrayList)4 Cigar (htsjdk.samtools.Cigar)1 TextCigarCodec (htsjdk.samtools.TextCigarCodec)1 PrintStream (java.io.PrintStream)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 NullOutputStream (org.apache.commons.io.output.NullOutputStream)1 CommandLineException (org.broadinstitute.barclay.argparser.CommandLineException)1 ArtificialReadUtils (org.broadinstitute.hellbender.utils.read.ArtificialReadUtils)1 Assert (org.testng.Assert)1 DataProvider (org.testng.annotations.DataProvider)1