picard.sam

## Class FilterSamReads

- java.lang.Object
- - picard.cmdline.CommandLineProgram
  - - picard.sam.FilterSamReads

-     public class FilterSamReads
      extends CommandLineProgram

  From a SAM or BAM file, produce a new SAM or BAM by filtering aligned reads or a list of read names provided in a file (one readname per line)

  $Id$

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `FilterSamReads.Filter`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `FilterSamReads.Filter` | `FILTER`
    `File` | `INPUT`
    `File` | `INTERVAL_LIST`
    `File` | `JAVASCRIPT_FILE`
    `File` | `OUTPUT`
    `File` | `READ_LIST_FILE`
    `htsjdk.samtools.SAMFileHeader.SortOrder` | `SORT_ORDER`
    `boolean` | `WRITE_READS_FILES`

    - ### Fields inherited from class picard.cmdline.CommandLineProgram

      `COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, GA4GH_CLIENT_SECRETS, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, TMP_DIR, VALIDATION_STRINGENCY, VERBOSITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterSamReads()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String[]` | `customCommandLineValidation()` Put any custom command-line validation in an override of this method.
    `protected int` | `doWork()` Do the work after command line has been parsed.
    `static void` | `main(String[] args)` Stock main method.

    - ### Methods inherited from class picard.cmdline.CommandLineProgram

      `getCommandLine, getCommandLineParser, getDefaultHeaders, getMetricsFile, getNestedOptions, getNestedOptionsForHelp, getStandardUsagePreamble, getVersion, instanceMain, instanceMainWithExit, parseArgs, setDefaultHeaders`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INPUT

          @Option(doc="The SAM or BAM file that will be filtered.",
                  optional=false,
                  shortName="I")
          public File INPUT

    - #### FILTER

          @Option(doc="Filter.",
                  optional=false)
          public FilterSamReads.Filter FILTER

    - #### READ_LIST_FILE

          @Option(doc="Read List File containing reads that will be included or excluded from the OUTPUT SAM or BAM file.",
                  optional=true,
                  shortName="RLF")
          public File READ_LIST_FILE

    - #### INTERVAL_LIST

          @Option(doc="Interval List File containing intervals that will be included or excluded from the OUTPUT SAM or BAM file.",
                  optional=true,
                  shortName="IL")
          public File INTERVAL_LIST

    - #### SORT_ORDER

          @Option(doc="SortOrder of the OUTPUT SAM or BAM file, otherwise use the SortOrder of the INPUT file.",
                  optional=true,
                  shortName="SO")
          public htsjdk.samtools.SAMFileHeader.SortOrder SORT_ORDER

    - #### WRITE_READS_FILES

          @Option(doc="Create .reads files (for debugging purposes)",
                  optional=true)
          public boolean WRITE_READS_FILES

    - #### OUTPUT

          @Option(doc="SAM or BAM file to write read excluded results to",
                  optional=false,
                  shortName="O")
          public File OUTPUT

    - #### JAVASCRIPT_FILE

          @Option(shortName="JS",
                  doc="Filters a SAM or BAM file with a javascript expression using the java javascript-engine.  The script puts the following variables in the script context:  \'record\' a SamRecord ( https://samtools.github.io/htsjdk/javadoc/htsjdk/htsjdk/samtools/SAMRecord.html ) and  \'header\' a SAMFileHeader ( https://samtools.github.io/htsjdk/javadoc/htsjdk/htsjdk/samtools/SAMFileHeader.html ). Last value of the script should be a boolean to tell wether we should accept or reject the record.",
                  optional=true)
          public File JAVASCRIPT_FILE

  - ### Constructor Detail

    - #### FilterSamReads

          public FilterSamReads()

  - ### Method Detail

    - #### doWork

          protected int doWork()

      Description copied from class: `CommandLineProgram`
      Do the work after command line has been parsed. RuntimeException may be thrown by this method, and are reported appropriately.
      Specified by:
        `doWork` in class `CommandLineProgram`
      Returns:
        program exit status.

    - #### customCommandLineValidation

          protected String[] customCommandLineValidation()

      Description copied from class: `CommandLineProgram`
      Put any custom command-line validation in an override of this method. clp is initialized at this point and can be used to print usage and access argv. Any options set by command-line parser can be validated.
      Overrides:
        `customCommandLineValidation` in class `CommandLineProgram`
      Returns:
        null if command line is valid. If command line is invalid, returns an array of error message to be written to the appropriate place.

    - #### main

          public static void main(String[] args)

      Stock main method.
      Parameters:
        `args` - main arguments