Package picard.sam.markduplicates

## Class UmiAwareMarkDuplicatesWithMateCigar

- java.lang.Object
- - picard.cmdline.CommandLineProgram
  - - picard.sam.markduplicates.util.AbstractOpticalDuplicateFinderCommandLineProgram
    - - picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram
      - - picard.sam.markduplicates.MarkDuplicates
        - - picard.sam.markduplicates.SimpleMarkDuplicatesWithMateCigar
          - - picard.sam.markduplicates.UmiAwareMarkDuplicatesWithMateCigar

-     @DocumentedFeature
      public class UmiAwareMarkDuplicatesWithMateCigar
      extends SimpleMarkDuplicatesWithMateCigar

  This tool locates and tags duplicate reads in a BAM or SAM file, where duplicate reads are defined as originating from a single fragment of DNA. It is based on the `MarkDuplicatesWithMateCigar` tool, with added logic to leverage Unique Molecular Identifier (UMI) information.

  It makes use of the fact that duplicate sets with UMIs can be broken up into subsets based on information contained in the UMI. In addition to assuming that all members of a duplicate set must have the same start and end position, it imposes that they must also have sufficiently similar UMIs. In this context, 'sufficiently similar' is parameterized by the command line argument MAX_EDIT_DISTANCE_TO_JOIN, which sets the edit distance between UMIs that will be considered to be part of the same original molecule. This logic allows for sequencing errors in UMIs.

  If UMIs contain dashes, the dashes will be ignored. If UMIs contain Ns, these UMIs will not contribute to UMI metrics associated with each record. If the MAX_EDIT_DISTANCE_TO_JOIN allows, UMIs with Ns will be included in the duplicate set and the UMI metrics associated with each duplicate set. Ns are counted as an edit distance from other bases {ATCG}, but are not considered different from each other.

  This tool is NOT intended to be used on data without UMIs; for marking duplicates in non-UMI data, see `MarkDuplicates` or `MarkDuplicatesWithMateCigar`. Mixed data (where some reads have UMIs and others do not) is not supported.

  Note also that this tool will not work with alignments that have large gaps or deletions, such as those from RNA-seq data. This is due to the need to buffer small genomic windows to ensure integrity of the duplicate marking, while large skips (ex. skipping introns) in the alignment records would force making that window very large, thus exhausting memory.

  Note: Metrics labeled as percentages are actually expressed as fractions!

  #### Usage example:

       java -jar picard.jar UmiAwareMarkDuplicatesWithMateCigar \\

            I=input.bam \\

            O=output.bam \\

            M=output_duplicate_metrics.txt \\

            UMI_METRICS=output_umi_metrics.txt

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class picard.sam.markduplicates.MarkDuplicates

      `MarkDuplicates.DuplicateTaggingPolicy, MarkDuplicates.DuplicateType`

    - ### Nested classes/interfaces inherited from class picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram

      `AbstractMarkDuplicatesCommandLineProgram.SamHeaderAndIterator`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `boolean` | `ALLOW_MISSING_UMIS` |
    `int` | `MAX_EDIT_DISTANCE_TO_JOIN` |
    `File` | `UMI_METRICS_FILE` |
    `String` | `UMI_TAG_NAME` |

    - ### Fields inherited from class picard.sam.markduplicates.MarkDuplicates

      `BARCODE_TAG, CLEAR_DT, DUPLEX_UMI, DUPLICATE_SET_INDEX_TAG, DUPLICATE_SET_SIZE_TAG, DUPLICATE_TYPE_LIBRARY, DUPLICATE_TYPE_SEQUENCING, DUPLICATE_TYPE_TAG, libraryIdGenerator, MAX_FILE_HANDLES_FOR_READ_ENDS_MAP, MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP, MOLECULAR_IDENTIFIER_TAG, READ_ONE_BARCODE_TAG, READ_TWO_BARCODE_TAG, REMOVE_SEQUENCING_DUPLICATES, SORTING_COLLECTION_SIZE_RATIO, TAG_DUPLICATE_SET_MEMBERS, TAGGING_POLICY`

    - ### Fields inherited from class picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram

      `ASSUME_SORT_ORDER, ASSUME_SORTED, COMMENT, DUPLICATE_SCORING_STRATEGY, INPUT, METRICS_FILE, OUTPUT, pgIdsSeen, pgTagArgumentCollection, PROGRAM_GROUP_COMMAND_LINE, PROGRAM_GROUP_NAME, PROGRAM_GROUP_VERSION, PROGRAM_RECORD_ID, REMOVE_DUPLICATES`

    - ### Fields inherited from class picard.sam.markduplicates.util.AbstractOpticalDuplicateFinderCommandLineProgram

      `LOG, MAX_OPTICAL_DUPLICATE_SET_SIZE, OPTICAL_DUPLICATE_PIXEL_DISTANCE, opticalDuplicateFinder, READ_NAME_REGEX`

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected int` | `doWork()` | Main work method.
    `protected htsjdk.samtools.util.CloseableIterator<htsjdk.samtools.DuplicateSet>` | `getDuplicateSetIterator​(AbstractMarkDuplicatesCommandLineProgram.SamHeaderAndIterator headerAndIterator, htsjdk.samtools.SAMRecordDuplicateComparator comparator)` |

    - ### Methods inherited from class picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram

      `addDuplicateReadToMetrics, addReadToLibraryMetrics, addSingletonToCount, finalizeAndWriteMetrics, getChainedPgIds, openInputs, trackOpticalDuplicates`

    - ### Methods inherited from class picard.sam.markduplicates.util.AbstractOpticalDuplicateFinderCommandLineProgram

      `customCommandLineValidation, setupOpticalDuplicateFinder`

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

      `checkRInstallation, 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

    - #### MAX_EDIT_DISTANCE_TO_JOIN

          @Argument(shortName="MAX_EDIT_DISTANCE_TO_JOIN",
                    doc="Largest edit distance that UMIs must have in order to be considered as coming from distinct source molecules.",
                    optional=true)
          public int MAX_EDIT_DISTANCE_TO_JOIN

    - #### UMI_METRICS_FILE

          @Argument(shortName="UMI_METRICS",
                    doc="UMI Metrics")
          public File UMI_METRICS_FILE

    - #### UMI_TAG_NAME

          @Argument(shortName="UMI_TAG_NAME",
                    doc="Tag name to use for UMI",
                    optional=true)
          public String UMI_TAG_NAME

    - #### ALLOW_MISSING_UMIS

          @Argument(doc="FOR TESTING ONLY: allow for missing UMIs if data doesn\'t have UMIs. This option is intended to be used ONLY for testing the code. Use MarkDuplicatesWithMateCigar if data has no UMIs. Mixed data (where some reads have UMIs and others do not) is not supported.",
                    optional=true)
          public boolean ALLOW_MISSING_UMIS

  - ### Constructor Detail

    - #### UmiAwareMarkDuplicatesWithMateCigar

          public UmiAwareMarkDuplicatesWithMateCigar()

  - ### Method Detail

    - #### doWork

          protected int doWork()

      Description copied from class: `SimpleMarkDuplicatesWithMateCigar`
      Main work method.
      Overrides:
        `doWork` in class `SimpleMarkDuplicatesWithMateCigar`
      Returns:
        program exit status.

    - #### getDuplicateSetIterator

          protected htsjdk.samtools.util.CloseableIterator<htsjdk.samtools.DuplicateSet> getDuplicateSetIterator​(AbstractMarkDuplicatesCommandLineProgram.SamHeaderAndIterator headerAndIterator,
                                                                                                                 htsjdk.samtools.SAMRecordDuplicateComparator comparator)

      Overrides:
        `getDuplicateSetIterator` in class `SimpleMarkDuplicatesWithMateCigar`