Package picard.sam

## Class SetNmMdAndUqTags

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

- Direct Known Subclasses:
    `SetNmAndUqTags`

      @DocumentedFeature
      public class SetNmMdAndUqTags
      extends CommandLineProgram

  Fixes the NM, MD, and UQ tags in a SAM or BAM file.

  This tool takes in a coordinate-sorted SAM or BAM file and calculates the NM, MD, and UQ tags by comparing with the reference.

  This may be needed when MergeBamAlignment was run with SORT_ORDER other than 'coordinate' and thus could not fix these tags then. The input must be coordinate sorted in order to run. If specified, the MD and NM tags can be ignored and only the UQ tag be set.

  ### Inputs

- The BAM or SAM file to fix
- A reference sequence

### Output

A BAM or SAM output file with recalculated NM, MD, and UQ tags

#### Usage example:

### Fix the tags in a BAM file:

         java -jar picard.jar SetNmMdAndUqTags \
              R=reference_sequence.fasta \
              I=sorted.bam \
              O=fixed.bam

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `File` | `INPUT` |
    `boolean` | `IS_BISULFITE_SEQUENCE` |
    `File` | `OUTPUT` |
    `boolean` | `SET_ONLY_UQ` |

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

      `COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, GA4GH_CLIENT_SECRETS, 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
    --- | ---
    `SetNmMdAndUqTags()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected int` | `doWork()` | Do the work after command line has been parsed.
    `static void` | `main​(String[] argv)` |
    `protected boolean` | `requiresReference()` |

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

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

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

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

- - ### Field Detail

    - #### INPUT

          @Argument(doc="The BAM or SAM file to fix. ",
                    shortName="I")
          public File INPUT

    - #### OUTPUT

          @Argument(doc="The fixed BAM or SAM output file. ",
                    shortName="O")
          public File OUTPUT

    - #### IS_BISULFITE_SEQUENCE

          @Argument(doc="Whether the file contains bisulfite sequence (used when calculating the NM tag).")
          public boolean IS_BISULFITE_SEQUENCE

    - #### SET_ONLY_UQ

          @Argument(doc="Only set the UQ tag, ignore MD and NM.")
          public boolean SET_ONLY_UQ

  - ### Constructor Detail

    - #### SetNmMdAndUqTags

          public SetNmMdAndUqTags()

  - ### Method Detail

    - #### requiresReference

          protected boolean requiresReference()

      Overrides:
        `requiresReference` in class `CommandLineProgram`

    - #### main

          public static void main​(String[] argv)

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