<p><code>samtools rmdup</code> and <code>samtools markdup -r</code> do the same thing. Without the <code>-r</code> flag <code>samtools markdup</code> only flags the duplicates.</p>

<p>You'll have to run <code>samtools fixmate -m</code> and sort the output to add ms and MC tags to prepare the file for <code>markdup</code>..</p>

<p>According to the current <a href="http://www.htslib.org/doc/samtools.html" rel="nofollow noreferrer">documentation</a>, <code>rmdup</code> is obsolete. Please do not use <code>rmdup</code>. </p>

CC BY-SA 4.0
2018-07-03T14:01:49.103Z
2018-07-03T14:01:49.103Z
Kohl Kinning
<p><strong>TL;DR:</strong> just use <code>markdup</code>.</p>

<p><code>rmdup</code> removes duplicates from BAM, while <code>markdup</code>, like Picard's <code>MarkDuplicates</code>, marks duplicates by default without hard removal – the latter is usually the desired behavior. In addition, <code>markdup</code> implements a better algorithm that takes care of more corner cases and gives more consistent results.</p>

<p>PS: to emphasize – I see no point to use <code>samtools rmdup</code> nowadays. It has been declared obsolete as @kohlkopf said.</p>

CC BY-SA 4.0
2024-12-12T15:16:54.837Z
Could you elaborate regarding why not performing hard removal "is usually the desired behavior"? For instance, what useful stuff is typically done using the duplicates?
bli
CC BY-SA 4.0
2018-07-03T14:03:51.340Z
2018-07-03T14:29:53.890Z
2018-07-03T14:29:53.890Z
user172818
<p>What is difference between samtools mark duplicates and remove duplicates ?  Is it necessary to mark duplicates before removing duplicates with samtools?</p>

<phylogenetics><ngs><samtools>
Difference between samtools mark duplicates and samtools remove duplicates?
# Difference between samtools mark duplicates and samtools remove duplicates?

(Asked by: username_0 on 2018-07-03)

What is difference between samtools mark duplicates and remove duplicates ? Is it necessary to mark duplicates before removing duplicates with samtools?

**Tags:** phylogenetics, ngs, samtools

---

## 2 answers

### Answer by username_1 on 2018-07-03. Score: 3 | Accepted answer

`samtools rmdup` and `samtools markdup -r` do the same thing. Without the `-r` flag `samtools markdup` only flags the duplicates.

You'll have to run `samtools fixmate -m` and sort the output to add ms and MC tags to prepare the file for `markdup`..

According to the current [documentation](http://www.htslib.org/doc/samtools.html), `rmdup` is obsolete. Please do not use `rmdup`.


---

### Answer by username_2 on 2018-07-03. Score: 2

**TL;DR:** just use `markdup`.

`rmdup` removes duplicates from BAM, while `markdup`, like Picard's `MarkDuplicates`, marks duplicates by default without hard removal – the latter is usually the desired behavior. In addition, `markdup` implements a better algorithm that takes care of more corner cases and gives more consistent results.

PS: to emphasize – I see no point to use `samtools rmdup` nowadays. It has been declared obsolete as @kohlkopf said.

> **Comments:**
> **username_3**: Could you elaborate regarding why not performing hard removal "is usually the desired behavior"? For instance, what useful stuff is typically done using the duplicates?  

---

