<p>If you don't provide an index, minimap2 will just generate the index on the fly (so, yes, it's done without specifying it). As such the mapping step will take longer. However, index generation is supposed to be very fast in minimap2 (a few minutes for the human genome), so it probably won't matter much.</p>

<p>Doing it separately will therefore also not speed up your code unless you end up using the pre-generated index multiple times.</p>

CC BY-SA 4.0
2020-03-04T15:50:46.837Z
2020-03-04T15:50:46.837Z
DavyCats
<p>I have been using minimap2 for a few month now and I just found a script that follows these steps:</p>
<pre><code>minimap2 [-x preset] -d target.mmi target.fa
minimap2 -a [-x preset] target.mmi query.fa &gt; output.sam
</code></pre>
<p>I have never seen this <code>.mmi</code> index before. I always used minimap2 directly like this:</p>
<pre><code>minimap2 -a [-x preset] target.fa query.fastq &gt; output.sam
</code></pre>
<p>So my question is why should I index my reference genome before mapping? Is it only for speed up? Will it up speed my code if I do it? Or it is already done without specifying it?</p>

<minimap2><genome-index>
Why index a sequence file with minimap2?
# Why index a sequence file with minimap2?

(Asked by: username_0 on 2020-03-04)

I have been using minimap2 for a few month now and I just found a script that follows these steps:
minimap2 [-x preset] -d target.mmi target.fa
minimap2 -a [-x preset] target.mmi query.fa > output.sam

I have never seen this .mmi index before. I always used minimap2 directly like this:
minimap2 -a [-x preset] target.fa query.fastq > output.sam

So my question is why should I index my reference genome before mapping? Is it only for speed up? Will it up speed my code if I do it? Or it is already done without specifying it?

**Tags:** minimap2, genome-index

---

## 1 answers

### Answer by username_1 on 2020-03-04. Score: 7 | Accepted answer

If you don't provide an index, minimap2 will just generate the index on the fly (so, yes, it's done without specifying it). As such the mapping step will take longer. However, index generation is supposed to be very fast in minimap2 (a few minutes for the human genome), so it probably won't matter much.

Doing it separately will therefore also not speed up your code unless you end up using the pre-generated index multiple times.


---

