Answers.Body: <p>From the <a href="https://broadinstitute.github.io/picard/picard-metric-definitions.html#DuplicationMetrics" rel="nofollow noreferrer">Picard documentation</a>:</p>
  <blockquote>
  <p>DUPLICATION METRICS:
  Metrics that are calculated during the process of marking duplicates within a stream of SAMRecords.</p>
  </blockquote>
  <blockquote>
  <p>UNMAPPED_READS    The total number of unmapped reads examined. (Primary, non-supplemental)</p>
  </blockquote>
  <p>It won't alter the flags on these reads, but it will count them in the summary report it generates.
  You should be able to test this yourself with a small set of mapped + unmapped reads</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-20T22:58:27.170Z
Answers.LastActivityDate: 2020-07-20T22:58:27.170Z
Answers.UserDisplayName: James Hawley
Body: <p>Our BAM files are created according to a &quot;lossless&quot; alignment procedure [<a href="https://software.broadinstitute.org/gatk/documentation/article.php?id=6483" rel="nofollow noreferrer">1</a>] from the Broad Institute <code>GATK</code> documenation and involves re-adding the unaligned/unmapped reads into an aligned BAM,  using Picard's <code>MergeBamAlignment</code>.</p>
  <p>The BAM files are produced in the end contain both the mapped and the unmapped reads. These files are then sorted with <a href="https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-" rel="nofollow noreferrer">SortSam</a> [<a href="https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-" rel="nofollow noreferrer">2</a>]- so that the sort order in the header becomes:</p>
  <p><code>@HD VN:1.6 SO:coordinate</code></p>
  <p>How does <code>MarkDuplicates</code> handle the unmapped reads of a BAM file containing both unmapped and mapped?</p>
  <p><strong>Note</strong> <code>MarkDuplicates</code> seems to normally take the BAM's ordering into account, namely, it accepts arguments such as <code>--ASSUME_SORT_ORDER X</code>.  However it's not specified whether reads without a position are ignored, or have to be compared with all other possible reads.</p>
  <hr />
  <p><em>Disclaimer</em>: I initially posted this question on the GATK forum [<a href="https://gatkforums.broadinstitute.org/gatk/discussion/24557/" rel="nofollow noreferrer">3</a>], but I'm reaching out to hopefully a broader audience.</p>
  <p>Citations:</p>
  <ul>
  <li>1 <a href="https://software.broadinstitute.org/gatk/documentation/article.php?id=6483" rel="nofollow noreferrer">How to Map and clean up short read sequence data efficiently</a></li>
  <li>2 <a href="https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-" rel="nofollow noreferrer">SortSam (Picard)</a></li>
  <li>3 <a href="https://gatkforums.broadinstitute.org/gatk/discussion/24557/" rel="nofollow noreferrer">Original posting on the GATK forum</a></li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-31T17:43:14.270Z
Comments.Text: Why not just look and see? I'm not sure what it would biologically mean to mark an unmapped read as a PCR duplicate though, it's unclear upon what basis picard would know to do that.
Comments.UserDisplayName: Devon Ryan
Tags: <picard><markduplicate>
Title: How does picard's MarkDuplicate handle unmapped reads?
ThreadText: # How does picard's MarkDuplicate handle unmapped reads?
  
  (Asked by: username_0 on 2019-10-30)
  
  Our BAM files are created according to a "lossless" alignment procedure [[1](https://software.broadinstitute.org/gatk/documentation/article.php?id=6483)] from the Broad Institute `GATK` documenation and involves re-adding the unaligned/unmapped reads into an aligned BAM, using Picard's `MergeBamAlignment`.
  
  The BAM files are produced in the end contain both the mapped and the unmapped reads. These files are then sorted with [SortSam](https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-) [[2](https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-)]- so that the sort order in the header becomes:
  
  `@HD VN:1.6 SO:coordinate`
  
  How does `MarkDuplicates` handle the unmapped reads of a BAM file containing both unmapped and mapped?
  
  **Note** `MarkDuplicates` seems to normally take the BAM's ordering into account, namely, it accepts arguments such as `--ASSUME_SORT_ORDER X`. However it's not specified whether reads without a position are ignored, or have to be compared with all other possible reads.
  
  ---
  
  *Disclaimer*: I initially posted this question on the GATK forum [[3](https://gatkforums.broadinstitute.org/gatk/discussion/24557/)], but I'm reaching out to hopefully a broader audience.
  
  Citations:
  
  * 1 [How to Map and clean up short read sequence data efficiently](https://software.broadinstitute.org/gatk/documentation/article.php?id=6483)
  * 2 [SortSam (Picard)](https://gatk.broadinstitute.org/hc/en-us/articles/360036510732-SortSam-Picard-)
  * 3 [Original posting on the GATK forum](https://gatkforums.broadinstitute.org/gatk/discussion/24557/)
  
  **Tags:** picard, markduplicate
  
  > **Comments:**
  > **username_1**: Why not just look and see? I'm not sure what it would biologically mean to mark an unmapped read as a PCR duplicate though, it's unclear upon what basis picard would know to do that.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-07-20. Score: 2
  
  From the [Picard documentation](https://broadinstitute.github.io/picard/picard-metric-definitions.html#DuplicationMetrics):
  
  > DUPLICATION METRICS:
  > Metrics that are calculated during the process of marking duplicates within a stream of SAMRecords.
  
  > UNMAPPED\_READS The total number of unmapped reads examined. (Primary, non-supplemental)
  
  It won't alter the flags on these reads, but it will count them in the summary report it generates.
  You should be able to test this yourself with a small set of mapped + unmapped reads
  
  
  ---
  
  