Define k-mer minimizer selection

{}
Introduces the definition of a minimizer for k-mer windows, defining the canonical form as the lexicographic minimum between the m-mer and its reverse complement. Selection is determined by a deterministic hash function that chooses the m-mer whose canonical form minimizes the hash value, including a warning about potential biases in the ordering.
Eric Coissac committed 2026-09-12 16:26:22 +02:00
1 parent 5313788f7c
commit 0b79a8ee74
1 file changed
+22 -2
+22 -2
@@ -2,11 +2,31 @@
## Definition ## Definition
A **minimizer** of a kmer window is the m-mer ($m < k$) that is smallest, among all $k - m + 1$ overlapping m-mers in the window, under a chosen ordering. The minimizer is always taken in canonical form (lexicographic minimum of forward and reverse complement) so that selection is strand-independent. The **minimizer** of a k-mer is the canonical form of the m-mer that is smallest according to a chosen ordering among the $k-m+1$ overlapping m-mers contained in the k-mer, with $m<k$ \@Roberts2004-rz.
For an m-mer $s$, its **canonical form** is defined as
$$s^c = \min_{\mathrm{lex}}\left(s,\operatorname{RC}(s)\right),$$
where $\operatorname{RC}(s)$ denotes the reverse complement of $s$.
The ordering used to select the minimizer is independent of this canonicalization. In **OBIkmer**, canonical m-mers are ordered according to a deterministic hash function $h$:
$$s_1^c <_h s_2^c \quad\Longleftrightarrow\quad h(s_1^c) < h(s_2^c).$$
Thus, for a k-mer $K$, let
$$M(K)=\{s_1,\ldots,s_{k-m+1}\}$$
be its set of overlapping m-mers. The minimizer is
$$\operatorname{minimizer}(K) = s_j^c, \qquad j=\underset{i}{\operatorname{argmin}}\;h(s_i^c).$$
In other words, the hash function defines the ordering of canonical m-mers, while the minimizer itself is the canonical form of the m-mer selected by that ordering.
The minimizer partitions a sequence into super-kmers: maximal runs of overlapping kmers that share the same minimizer (see [Kmers and super-kmers](theory-kmers_and_superkmers)). The minimizer partitions a sequence into super-kmers: maximal runs of overlapping kmers that share the same minimizer (see [Kmers and super-kmers](theory-kmers_and_superkmers)).
## Hash-based ("random") minimizer ## Hash-based minimizer ordering
`obikmer` selects minimizers by hash order rather than plain lexicographic order. Ordering m-mers lexicographically on their 2-bit encoding systematically favors AT-rich m-mers (an all-A m-mer always encodes to 0), which causes low-complexity regions to dominate as minimizers and produces unbalanced partitions ([Golan & Shur 2025](#ref-Golan2025-xf); [Kille et al. 2023](#ref-Kille2023-px); [Pan & Reinert 2024](#ref-Pan2024-hb); [Zheng et al. 2020](#ref-Zheng2020-ji); [2021](#ref-Zheng2021-cc)). `obikmer` selects minimizers by hash order rather than plain lexicographic order. Ordering m-mers lexicographically on their 2-bit encoding systematically favors AT-rich m-mers (an all-A m-mer always encodes to 0), which causes low-complexity regions to dominate as minimizers and produces unbalanced partitions ([Golan & Shur 2025](#ref-Golan2025-xf); [Kille et al. 2023](#ref-Kille2023-px); [Pan & Reinert 2024](#ref-Pan2024-hb); [Zheng et al. 2020](#ref-Zheng2020-ji); [2021](#ref-Zheng2021-cc)).