# Class RevertOriginalBaseQualitiesAndAddMateCigar

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

@DocumentedFeature public class RevertOriginalBaseQualitiesAndAddMateCigar extends CommandLineProgram
This tool reverts the original base qualities (if specified) and adds the mate cigar tag to mapped SAM, BAM or CRAM files. 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
Description
`static enum`
`RevertOriginalBaseQualitiesAndAddMateCigar.CanSkipSamFile`
Used as a return for the canSkipSAMFile function.

## Field Summary

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

### Fields inherited from class CommandLineProgram

`COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, referenceSequence, specialArgumentsCollection, SYNTAX_TRANSITION_URL, TMP_DIR, USE_JDK_DEFLATER, USE_JDK_INFLATER, VALIDATION_STRINGENCY, VERBOSITY`

## Constructor Summary

Constructors
Constructor
Description
`RevertOriginalBaseQualitiesAndAddMateCigar()`

## Method Summary

Modifier and Type
Method
Description
`static RevertOriginalBaseQualitiesAndAddMateCigar.CanSkipSamFile`
`canSkipSAMFile(File inputFile, int maxRecordsToExamine, boolean revertOriginalBaseQualities, File referenceFasta)`
Checks if we can skip the SAM/BAM/CRAM file when reverting origin base qualities and adding mate cigars.
`int`
`doWork()`
Do the work after command line has been parsed.

### Methods inherited from class CommandLineProgram

`checkRInstallation, customCommandLineValidation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser`

### Methods inherited from class Object

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

## Field Details

### INPUT

@Argument(shortName="I", doc="The input SAM/BAM/CRAM file to revert the state of.") public File INPUT

### OUTPUT

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

### SORT_ORDER

@Argument(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

@Argument(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

@Argument(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 Details

### RevertOriginalBaseQualitiesAndAddMateCigar

public RevertOriginalBaseQualitiesAndAddMateCigar()

## Method Details

### 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/CRAM file when reverting origin base qualities and adding mate cigars.

Parameters:
  `inputFile` - the SAM/BAM/CRAM 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.