Minimap2 Mapping: Minimizers, Seeding, Chaining, Alignment, and Presets for Diverse Sequencing Data
Welcome. This course will build a practical quality-control and validation workflow for bacterial isolate genomes: first understanding the reads, then mapping and assembly, followed by polishing and final assessment. In this module, minimap2 is the central tool for asking a deceptively simple question: where does this sequence best fit relative to another sequence?
This lesson develops the mechanism before the commands. By the end, you should be able to explain why minimap2 can map noisy Oxford Nanopore reads, accurate Illumina reads, and assembled contigs efficiently, and why choosing the right preset matters.
From DNA strings to a compact search index
A genome-scale alignment cannot sensibly compare every base of every read against every possible reference position. For a bacterial genome this may be feasible for a single read, but not for many thousands of reads, and it becomes much more expensive for large references or all-versus-all comparisons.
Minimap2 avoids that exhaustive search by first looking for a limited set of short, exact sequence matches. Its central idea is to turn both the reference and the query into a compact sketch made of minimizers.
A k-mer is simply a DNA word of length . For example, when , ACGTA is a 5-mer. Consecutive k-mers overlap strongly: a sequence of length 100 contains 96 distinct positions at which a 5-mer starts. Storing and comparing every k-mer is already far cheaper than full base-level alignment, but it can still be unnecessarily repetitive.
A minimizer retains only selected k-mers. Consider a sliding window containing consecutive k-mers. Minimap2 gives every k-mer a deterministic rank, typically through hashing, and selects the lowest-ranked k-mer in each window. Adjacent windows commonly select the same k-mer, so duplicates are collapsed: a minimizer sketch contains far fewer entries than the full set of k-mers.
When less is more: sketching with minimizers in genomics - PMC
Read this review article from PMC for the first-principles meaning of k-mers and minimizers. It explains why minimizers are selected by sequence content rather than at fixed positions.
In Background, read the subsections “K-mer definition and properties” and “Minimizers”, stopping before “The importance of ordering.” Begin with the opening explanation of why k-mers are useful but incomplete representations of a sequence. Then read the minimizer selection rule, paying particular attention to the roles of k-mer length, window size, and deterministic ordering.
The selection scheme has an important guarantee. If two sequences share an exact region of at least
bases, they are guaranteed to share at least one minimizer from that region, provided both are processed with the same scheme. For the long, noisy read example described in the review, and , so this guaranteed exact region is 24 bases.
That guarantee describes ideal exact matching. Real reads contain errors, and genuine samples can differ from their references. Still, long reads contain many local regions without an error across a given short stretch. Rather than requiring one flawless read-length match, minimap2 needs enough surviving exact minimizer matches to establish a convincing pattern.
A larger makes a random match less likely, increasing specificity, but makes an exact match less likely to survive sequencing errors. A larger retains fewer minimizers, making the index smaller and faster to search, but provides fewer opportunities to seed an alignment. These are trade-offs, not arbitrary technical details; presets encode sensible choices for particular data types.
The seed, chain, align strategy
Minimap2 treats one input as the reference and the other as the query. For read mapping, the assembly or reference genome is normally the reference, and the sequencing reads are the queries.
It proceeds in four conceptual stages.
-
Index the reference. Minimap2 extracts reference minimizers and stores them in a hash table. The key is a minimizer sequence or its hash value; the associated value is the list of reference positions where it occurs.
-
Seed the query. It extracts minimizers from each query read and looks them up in the reference hash table. An exact matching minimizer identifies a small candidate match.
-
Chain anchors. Each query-reference minimizer match supplies paired coordinates: one position on the query and one on the reference. Such a paired coordinate is an anchor. Minimap2 searches for a set of anchors that occur in the same order and at compatible spacings on both sequences.
-
Align bases locally. Only after identifying a promising chain does minimap2 carry out the more expensive dynamic-programming alignment around and between its anchors. This stage resolves substitutions, insertions, and deletions at base resolution.
The terminology can be slightly inconsistent across descriptions. A matching minimizer is often called a seed, whereas an anchor emphasizes the paired query and reference coordinates produced by that seed match. The essential distinction is that neither alone is a full alignment: both are fast local evidence used to propose one.

Suppose a 15 kb Nanopore read truly came from a 15 kb region of an assembly. Errors will disrupt some minimizers, and a repeated element may produce anchors at several assembly locations. However, the correct location should yield many anchors whose query positions and reference positions advance together. A scattered collection of anchors in unrelated locations is much less persuasive.
Chaining formalizes that reasoning. Minimap2 uses dynamic programming to assign each anchor a score that considers the best compatible preceding anchor. It rewards a long, dense run of ordered anchors and penalizes implausible gaps or jumps. Small differences in spacing are expected because reads may contain indel errors and the sample may differ genuinely from the assembly. Large inconsistent jumps are less plausible unless they represent a structural difference or a chimeric read.
The result is a chain: a candidate mapping interval, not yet a detailed letter-by-letter comparison. Minimap2 can find several chains for one read. It ranks them, generally reporting the best-supported placement as primary and retaining sufficiently competitive alternatives as secondary alignments. A primary alignment means “best under this model,” not “certainly unique or biologically correct.” Repeats often create legitimate competing placements.
At the final alignment stage, minimap2 extends outward from the chain and aligns the regions between neighboring anchors. This is where it determines the actual pattern of matches, substitutions, insertions, and deletions. Localizing the expensive calculation to a promising region is why minimap2 can be both fast and informative.
lh3/minimap2: A versatile pairwise aligner for genomic and spliced ...
The official minimap2 documentation gives the implementation-level version of the seed, chain, align model and explains why presets are required for different data types.
First, in “Algorithm overview,” read the numbered procedure from step 1 through step 7. Focus especially on chaining and alignment: note how chains are scored, classified as primary or secondary, and extended to make base-level alignments. Then move to “Use cases” and read its opening explanation, the rationale for presets. In that section, scan the subsections “Map long noisy genomic reads,” “Map short genomic reads,” and “Full genome/assembly alignment.” Do not worry about memorizing every option; identify the data property each preset is designed to accommodate.
Why long reads and short reads create different mapping problems
The minimizer strategy is the same across sequencing technologies, but the evidence available to the mapper differs.
Oxford Nanopore reads are long. A single read may span a repeated element, connect unique flanking sequence on both sides, or traverse most of a small plasmid. This produces a long chain of anchors, often making the correct placement clear. The cost is a higher error rate than short reads, particularly with indels and context-dependent errors. Therefore, the mapper must tolerate imperfect spacing between anchors and use alignment scoring appropriate to noisier reads.
Illumina reads are short but highly accurate. Individual seeds are usually reliable, but the read may lie entirely within a repeat and lack unique flanking context. For example, a 150 bp read in an insertion sequence may map equally well at several genomic copies. Mapping short reads therefore emphasizes accuracy and short-read assumptions; paired-end information, when available, provides additional positional context.

For a bacterial assembly, the practical consequence is important:
- Long-read mapping is especially useful for testing large-scale continuity, repeat traversal, circular contigs, and structural consistency.
- Short-read mapping is especially valuable for detecting small base-level errors during polishing, but it may be ambiguous in repeats.
- Neither mapping type alone proves that an assembly is correct. They provide different, complementary evidence.
Presets: assumptions packaged into one choice
A minimap2 preset, selected with the -x option, is a coherent bundle of parameter choices. It changes such things as minimizer selection, alignment scoring, gap penalties, chaining thresholds, and reporting behavior. The preset answers: What kind of query am I mapping, against what kind of reference, and how different do I expect them to be?
For the workflows in this course, these are the main conceptual categories:
| Situation | Typical preset | What minimap2 is assuming |
|---|---|---|
| Oxford Nanopore reads mapped to an assembly | map-ont | Long genomic reads with appreciable sequencing error and indels |
| PacBio CLR reads mapped to an assembly | map-pb | Long, noisier PacBio continuous long reads |
| PacBio HiFi reads mapped to an assembly | map-hifi | Long reads with much higher per-base accuracy |
| Illumina reads mapped to an assembly | sr | Short, accurate genomic reads; paired reads can be handled together |
| Assembly mapped to a close reference or another assembly | asm5 | Long assembled sequences with relatively low divergence |
| More divergent assembly comparison | asm10 or asm20 | Assemblies expected to differ more substantially |
| All-versus-all Nanopore read overlap detection | ava-ont | Long-read overlap discovery rather than conventional read-to-reference mapping |
The PacBio CLR and Nanopore distinction illustrates why the technology label matters. The official documentation notes that map-pb uses homopolymer-compressed minimizers, while map-ont uses ordinary minimizers. Homopolymer compression can help with the error characteristics of PacBio CLR reads but can reduce performance for Nanopore reads. “Long read” alone is not a sufficient description.
Similarly, an assembly-to-reference comparison should not be treated as ordinary noisy-read mapping. Assemblies are long, consensus sequences, and the critical issue is their expected divergence. As divergence increases, exact seed matches become less frequent and scoring must avoid treating true accumulated differences as poor alignment. This is why the assembly presets are graded by anticipated divergence.
Minimap2 also has splice-aware presets for RNA sequencing. Those permit long gaps corresponding to introns, which are biologically expected in transcript-to-genome alignment but inappropriate as a default assumption for bacterial genomic reads. A preset should reflect the biology as well as the instrument.
One technical caveat matters when you begin running commands. Reference indexing parameters, including minimizer length and window size, are fixed when a minimap2 index file is built. If you reuse a saved index created for one preset, selecting a different preset later cannot retroactively change those index parameters. In practice, retain separate indexes when mapping substantially different query types requires different indexing choices.
What alignment output represents
At a high level, minimap2 can report either:
- Approximate mapping evidence, including query and reference coordinates and chain-level information. PAF is a compact format commonly used for long sequences and assembly comparisons.
- Base-level alignments, which include a detailed edit description such as a CIGAR string. SAM is the standard alignment format often used for read mapping and downstream coverage analysis.
The first representation is often enough to ask whether a read or contig has a plausible placement. The second is required when inspecting individual mismatches, indels, read depth, or polishing evidence. The next lesson will make these choices operational by constructing commands for read-to-assembly and assembly-to-reference mapping.
For now, keep this hierarchy clear:
| Level of evidence | Meaning |
|---|---|
| Minimizer | A selected representative k-mer |
| Seed | A local exact minimizer match used to propose a location |
| Anchor | A seed match with paired query and reference coordinates |
| Chain | A compatible, ordered group of anchors supporting a candidate mapping |
| Alignment | A base-level account of matches and differences across that candidate region |
Key takeaways
Minimap2 gains speed by indexing a compact subset of reference k-mers, the minimizers, rather than attempting base-level alignment everywhere. Query minimizer matches identify seeds and anchors; chaining asks whether many anchors form one coherent placement; base-level dynamic programming is then applied only where the chain makes alignment plausible.
Long Nanopore reads can tolerate substantial error because their length usually supplies many surviving local matches and extensive chaining context. Short Illumina reads provide more accurate local sequence evidence but can remain ambiguous in repeats. Presets encode these distinct error models, read lengths, and expected sequence divergence, so choosing one is part of the scientific interpretation rather than merely command-line decoration.
Next, you will translate this model into minimap2 commands for mapping Nanopore reads to an assembly and aligning an assembly to a reference, including when to choose PAF versus SAM output.
Can't find a good explanation? Sign up and we'll make it for you
Sign up