picard.sam

## Class RevertOriginalBaseQualitiesAndAddMateCigar

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

-     public class RevertOriginalBaseQualitiesAndAddMateCigar
      extends CommandLineProgram

  This tool reverts the original base qualities (if specified) and adds the mate cigar tag to mapped BAMs. If the file does not have OQs and already has mate cigar tags, nothing is done. New BAM/BAI/MD5 files are created.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `RevertOriginalBaseQualitiesAndAddMateCigar.CanSkipSamFile` Used as a return for the canSkipSAMFile function.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `File` | `INPUT`
    `int` | `MAX_RECORDS_TO_EXAMINE`
    `File` | `OUTPUT`
    `boolean` | `RESTORE_ORIGINAL_QUALITIES`
    `htsjdk.samtools.SAMFileHeader.SortOrder` | `SORT_ORDER`

    - ### 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
    `RevertOriginalBaseQualitiesAndAddMateCigar()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static RevertOriginalBaseQualitiesAndAddMateCigar.CanSkipSamFile` | `canSkipSAMFile(File inputFile, int maxRecordsToExamine, boolean revertOriginalBaseQualities, File referenceFasta)` Checks if we can skip the SAM/BAM file when reverting origin base qualities and adding mate cigars.
    `int` | `doWork()` Do the work after command line has been parsed.
    `static void` | `main(String[] args)` Default main method impl.

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

      `customCommandLineValidation, 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(shortName="I",
                  doc="The input SAM/BAM file to revert the state of.")
          public File INPUT

    - #### OUTPUT

          @Option(shortName="O",
                  doc="The output SAM/BAM file to create.")
          public File OUTPUT

    - #### SORT_ORDER

          @Option(shortName="SO",
                  doc="The sort order to create the reverted output file with.By default, the sort order will be the same as the input.",
                  optional=true)
          public htsjdk.samtools.SAMFileHeader.SortOrder SORT_ORDER

    - #### RESTORE_ORIGINAL_QUALITIES

          @Option(shortName="OQ",
                  doc="True to restore original qualities from the OQ field to the QUAL field if available.")
          public boolean RESTORE_ORIGINAL_QUALITIES

    - #### MAX_RECORDS_TO_EXAMINE

          @Option(doc="The maximum number of records to examine to determine if we can exit early and not output, given that there are a no original base qualities (if we are to restore) and mate cigars exist. Set to 0 to never skip the file.")
          public int MAX_RECORDS_TO_EXAMINE

  - ### Constructor Detail

    - #### RevertOriginalBaseQualitiesAndAddMateCigar

          public RevertOriginalBaseQualitiesAndAddMateCigar()

  - ### Method Detail

    - #### main

          public static void main(String[] args)

      Default main method impl.

    - #### doWork

          public 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.

    - #### canSkipSAMFile

          public static RevertOriginalBaseQualitiesAndAddMateCigar.CanSkipSamFile canSkipSAMFile(File inputFile,
                                                                                                 int maxRecordsToExamine,
                                                                                                 boolean revertOriginalBaseQualities,
                                                                                                 File referenceFasta)

      Checks if we can skip the SAM/BAM file when reverting origin base qualities and adding mate cigars.
      Parameters:
        `inputFile` - the SAM/BAM input file
        `maxRecordsToExamine` - the maximum number of records to examine before quitting
        `revertOriginalBaseQualities` - true if we are to revert original base qualities, false otherwise
      Returns:
        whether we can skip or not, and the explanation why.