diff --git a/.crate-kit/VERSION b/.crate-kit/VERSION index 74e4be05..2a701a9c 100644 --- a/.crate-kit/VERSION +++ b/.crate-kit/VERSION @@ -1 +1 @@ -0.3.6+0.1.1 +0.3.7+0.1.1 diff --git a/Makefile b/Makefile index 70b2c5ff..e9bf171c 100644 --- a/Makefile +++ b/Makefile @@ -134,13 +134,16 @@ clean-doc-user: # Regenerates the Gitea/Forgejo wiki (a separate repository, checked out next # to this one) from the user documentation. Only rewrites its working tree: # committing and pushing it stays a manual step. Not part of `clean`. +# The wiki is flat and entirely generated: its pages (top-level *.md) are deleted first, so that a page +# renamed or removed in the sources does not linger. Only *.md at the top level are touched (.git, .jj kept). DOC_WIKI_DIR := ../obiskim.wiki .PHONY: wiki -## wiki: Regenerates the wiki working tree (../obiskim.wiki); commit and push stay manual +## wiki: Regenerates the wiki working tree (../obiskim.wiki) from scratch; commit and push stay manual wiki: @command -v pmotransdoc >/dev/null || { echo "pmotransdoc not found in PATH" >&2; exit 1; } @test -d $(DOC_WIKI_DIR)/.git || { echo "$(DOC_WIKI_DIR) is not a git checkout of the wiki" >&2; exit 1; } + find $(DOC_WIKI_DIR) -maxdepth 1 -type f -name '*.md' -delete pmotransdoc $(DOC_USER_DIR) $(DOC_WIKI_DIR) .PHONY: clean diff --git a/UserDocMD/theory/kmer_indexing/kmers.md b/UserDocMD/theory/kmer_indexing/kmers.md index 4de43ce3..3a1eeae0 100644 --- a/UserDocMD/theory/kmer_indexing/kmers.md +++ b/UserDocMD/theory/kmer_indexing/kmers.md @@ -1,6 +1,6 @@ # K-mer size -A k-mer is a DNA sequence of length $k$. OBIKmer is designed to index +A k-mer is a DNA sequence of length $k$. obiskim is designed to index large k-mers. Here, *large* refers to a k-mer length for which the probability of observing the same k-mer in several genomes by chance alone is sufficiently small. The k-mer length must therefore be large @@ -8,14 +8,14 @@ enough that, when a k-mer is observed in several genomes of the dataset, the probability that this shared occurrence is due to chance alone is sufficiently low for the match to be considered evidence of homology. -OBIKmer restricts $k$ to odd values in the range +obiskim restricts $k$ to odd values in the range $$ 11 \leq k \leq 31. $$ These limits result from two different considerations. The upper bound -is imposed by the representation used by OBIKmer, whereas the lower +is imposed by the representation used by obiskim, whereas the lower bound defines a practical range of k-mer lengths for genome-scale sequence comparisons. This range covers most practical applications: the lower limit is well below the k-mer size that can be considered large, @@ -25,8 +25,8 @@ involving very large genomes. ## Representation limit -OBIKmer uses two bits to encode each nucleotide. Therefore, a k-mer -requires $2k$ bits. To ensure computational efficiency, OBIKmer limits +obiskim uses two bits to encode each nucleotide. Therefore, a k-mer +requires $2k$ bits. To ensure computational efficiency, obiskim limits the representation of k-mers to a single 64-bit word, thereby restricting their length. @@ -35,12 +35,12 @@ $$ $$ This gives the hard representation limit: $k \leq 32.$ Furthermore, -OBIKmer only considers odd values of $k$, meaning the largest supported +obiskim only considers odd values of $k$, meaning the largest supported k-mer size is $31$. ## Odd k-mer lengths -OBIKmer additionally requires $k$ to be odd. This constraint is +obiskim additionally requires $k$ to be odd. This constraint is independent of the specificity considerations discussed below. For an odd-length DNA sequence, a k-mer cannot be identical to its own @@ -56,7 +56,7 @@ $$ is well defined for both odd and even lengths. Restricting $k$ to odd values guarantees that the two orientations are always distinct, -simplifying the representation and orientation handling used by OBIKmer. +simplifying the representation and orientation handling used by obiskim. ## K-mer specificity @@ -95,7 +95,7 @@ The following section introduces a random-sequence model to quantify the probabi ## Chance sharing across genomes -OBIKmer indexes distinct canonical k-mers and records the genomes in +obiskim indexes distinct canonical k-mers and records the genomes in which each k-mer occurs. This makes it possible to compare the observed sharing of k-mers with the sharing expected under a random-sequence model. The same probability model can be used for two related purposes: @@ -109,7 +109,7 @@ The null hypothesis assumes that the $S$ indexed genomes are unrelated and that each genome is an independent random sequence in which nucleotides are independent and equiprobable. -Since OBIKmer uses odd-length canonical k-mers, reverse-complement +Since obiskim uses odd-length canonical k-mers, reverse-complement canonicalization reduces the number of possible k-mers by half. The size of the canonical k-mer space is therefore diff --git a/UserDocMD/theory/kmer_indexing/minimizer_selection.md b/UserDocMD/theory/kmer_indexing/minimizer_selection.md index e347969d..8c5b42d0 100644 --- a/UserDocMD/theory/kmer_indexing/minimizer_selection.md +++ b/UserDocMD/theory/kmer_indexing/minimizer_selection.md @@ -4,7 +4,7 @@ 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 $mK-mer size -

A k-mer is a DNA sequence of length \(k\). OBIKmer is designed to index +

A k-mer is a DNA sequence of length \(k\). obiskim is designed to index large k-mers. Here, large refers to a k-mer length for which the probability of observing the same k-mer in several genomes by chance alone is sufficiently small. The k-mer length must therefore be large enough that, when a k-mer is observed in several genomes of the dataset, the probability that this shared occurrence is due to chance alone is sufficiently low for the match to be considered evidence of homology.

-

OBIKmer restricts \(k\) to odd values in the range

+

obiskim restricts \(k\) to odd values in the range

\[ 11 \leq k \leq 31. \]

These limits result from two different considerations. The upper bound -is imposed by the representation used by OBIKmer, whereas the lower +is imposed by the representation used by obiskim, whereas the lower bound defines a practical range of k-mer lengths for genome-scale sequence comparisons. This range covers most practical applications: the lower limit is well below the k-mer size that can be considered large, @@ -1743,18 +1743,18 @@ even for the smallest bacterial genomes, whereas the upper limit provides sufficient specificity for most applications, including those involving very large genomes.

Representation limit

-

OBIKmer uses two bits to encode each nucleotide. Therefore, a k-mer -requires \(2k\) bits. To ensure computational efficiency, OBIKmer limits +

obiskim uses two bits to encode each nucleotide. Therefore, a k-mer +requires \(2k\) bits. To ensure computational efficiency, obiskim limits the representation of k-mers to a single 64-bit word, thereby restricting their length.

\[ 2k \leq 64, \]

This gives the hard representation limit: \(k \leq 32.\) Furthermore, -OBIKmer only considers odd values of \(k\), meaning the largest supported +obiskim only considers odd values of \(k\), meaning the largest supported k-mer size is \(31\).

Odd k-mer lengths

-

OBIKmer additionally requires \(k\) to be odd. This constraint is +

obiskim additionally requires \(k\) to be odd. This constraint is independent of the specificity considerations discussed below.

For an odd-length DNA sequence, a k-mer cannot be identical to its own reverse complement. Every k-mer therefore belongs to a pair of distinct @@ -1766,7 +1766,7 @@ s^c=\min_{\mathrm{lex}}\left(s,\operatorname{RC}(s)\right) \]

is well defined for both odd and even lengths. Restricting \(k\) to odd values guarantees that the two orientations are always distinct, -simplifying the representation and orientation handling used by OBIKmer.

+simplifying the representation and orientation handling used by obiskim.

K-mer specificity

A simple way to illustrate the effect of k-mer size is to consider a random DNA sequence in which the four nucleotides are independent and @@ -1823,7 +1823,7 @@ assessed across an indexed set of genomes.

The supported range \(11\leq k\leq31\) should therefore be understood as an engineering and application-oriented compromise, not as a universal biological optimum. Shorter k-mers are more likely to be shared by unrelated regions, whereas longer k-mers provide greater sequence specificity. However, longer k-mers are also more sensitive to substitutions and indels: a single difference can disrupt an exact match across the whole k-mer. The appropriate value within the supported range consequently depends on the size and characteristics of the genomes being compared, as well as on the biological question.

The following section introduces a random-sequence model to quantify the probability of chance sharing across an indexed set of genomes. This provides a formal basis for assessing how the choice of \(k\) affects the interpretation of shared k-mers.

Chance sharing across genomes

-

OBIKmer indexes distinct canonical k-mers and records the genomes in +

obiskim indexes distinct canonical k-mers and records the genomes in which each k-mer occurs. This makes it possible to compare the observed sharing of k-mers with the sharing expected under a random-sequence model. The same probability model can be used for two related purposes: @@ -1834,7 +1834,7 @@ specified number of genomes.

The null hypothesis assumes that the \(S\) indexed genomes are unrelated and that each genome is an independent random sequence in which nucleotides are independent and equiprobable.

-

Since OBIKmer uses odd-length canonical k-mers, reverse-complement +

Since obiskim uses odd-length canonical k-mers, reverse-complement canonicalization reduces the number of possible k-mers by half. The size of the canonical k-mer space is therefore

\[ diff --git a/doc/theory/kmer_indexing/minimizer_selection/index.html b/doc/theory/kmer_indexing/minimizer_selection/index.html index 31b2da2c..d6db7f61 100644 --- a/doc/theory/kmer_indexing/minimizer_selection/index.html +++ b/doc/theory/kmer_indexing/minimizer_selection/index.html @@ -1571,7 +1571,7 @@

Minimizer selection

Definition

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\) (Roberts et al. 2004)1. Canonical form is the same operation defined for a full kmer (see DNA encoding), applied here to an m-mer \(s\) instead: \(s^c = \min_{\mathrm{lex}}\left(s,\operatorname{RC}(s)\right)\).

-

In OBIkmer, canonical m-mers are ordered according to a deterministic hash function \(H\) applied to their canonical form:

+

In obiskim, canonical m-mers are ordered according to a deterministic hash function \(H\) applied to their canonical form:

\[ s_1^c <_h s_2^c \quad\Longleftrightarrow\quad