Package picard.sam

## Class FixMateInformation

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

-     @DocumentedFeature
      public class FixMateInformation
      extends CommandLineProgram

  ### Summary

  This tool ensures that all mate-pair information is in sync between each read and its mate pair. If no `OUTPUT` file is supplied then the output is written to a temporary file and then copied over the `INPUT` file (with the original placed in a .old file.) Reads marked with the secondary alignment flag are written to the output file unchanged. However, supplementary reads are corrected so that they point to the primary, non-supplemental mate record.

  ### Usage example:

       java -jar picard.jar FixMateInformation \
             I=input.bam \
             O=fixed_mate.bam \
             ADD_MATE_CIGAR=true

  ### Caveats

  The program should run with fairly limited memory unless there are many mate pairs that are missing or far apart from each other in the file, as it keeps track of the unmatched mates

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Boolean` | `ADD_MATE_CIGAR` |
    `boolean` | `ASSUME_SORTED` |
    `Boolean` | `IGNORE_MISSING_MATES` |
    `List<File>` | `INPUT` |
    `protected htsjdk.samtools.SAMFileWriter` | `out` |
    `File` | `OUTPUT` |
    `htsjdk.samtools.SAMFileHeader.SortOrder` | `SORT_ORDER` |

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

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

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FixMateInformation()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `closeWriter()` |
    `protected void` | `createSamFileWriter​(htsjdk.samtools.SAMFileHeader header)` |
    `protected int` | `doWork()` | Do the work after command line has been parsed.
    `protected void` | `writeAlignment​(htsjdk.samtools.SAMRecord sam)` |

    - ### Methods inherited from class picard.cmdline.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 java.lang.Object

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

- - ### Field Detail

    - #### INPUT

          @Argument(shortName="I",
                    doc="The SAM/BAM/CRAM input files to check and fix. Multiple files will be merged and sorted.")
          public List<File> INPUT

    - #### OUTPUT

          @Argument(shortName="O",
                    optional=true,
                    doc="The output file to write to. If no output file is supplied, the input file is overwritten (only available with single input file).")
          public File OUTPUT

    - #### SORT_ORDER

          @Argument(shortName="SO",
                    optional=true,
                    doc="Optional sort order if the OUTPUT file should be sorted differently than the INPUT file.")
          public htsjdk.samtools.SAMFileHeader.SortOrder SORT_ORDER

    - #### ASSUME_SORTED

          @Argument(doc="If true, assume that the input file is queryname sorted, even if the header says otherwise.",
                    shortName="AS")
          public boolean ASSUME_SORTED

    - #### ADD_MATE_CIGAR

          @Argument(shortName="MC",
                    optional=true,
                    doc="Adds the mate CIGAR tag (MC) if true, does not if false.")
          public Boolean ADD_MATE_CIGAR

    - #### IGNORE_MISSING_MATES

          @Argument(doc="If true, ignore missing mates, otherwise will throw an exception when missing mates are found.",
                    optional=true)
          public Boolean IGNORE_MISSING_MATES

    - #### out

          protected htsjdk.samtools.SAMFileWriter out

  - ### Constructor Detail

    - #### FixMateInformation

          public FixMateInformation()

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

    - #### createSamFileWriter

          protected void createSamFileWriter​(htsjdk.samtools.SAMFileHeader header)

    - #### writeAlignment

          protected void writeAlignment​(htsjdk.samtools.SAMRecord sam)

    - #### closeWriter

          protected void closeWriter()