refactor: rename obikmer to obiskim

Rename the `obikmer` binary, crate, and documentation to `obiskim`. This change updates all references in source code, build scripts, CI workflows, and user documentation to reflect the new tool name.

- Move `src/obikmer` to `src/obiskim`, renaming the package and binary in `Cargo.toml` and updating `main.rs` and `cli.rs` to use the new name.
- Update `src/Cargo.toml` and `src/Cargo.lock` to replace the `obikmer` workspace member with `obiskim`.
- Update `Makefile` targets (`build`, `release`, `debug`, `profile-build`) and variables (`CARGO_TOML`, `bump-version`) to build and manage `obiskim`.
- Update `.gitea/workflows/release.yml` to build and upload `obiskim` artifacts for Linux and macOS.
- Rename all files in `src/obiskim/src/cmd/` from `obikmer` to `obiskim` paths, updating error messages and help text in `index/mod.rs`, `phylo/args/mod.rs`, and `phylo/tnt.rs`.
- Update documentation in `UserDocMD/` (including `index.md`, `installation.md`, `architecture.md`, and usage guides) to reference `obiskim` commands and behavior.
- Update `benchmark/` scripts and Python verification tools to use `obiskim` binary paths and arguments.
- Update `scripts/` (including `smoke_test_*.sh`, `bench_merge_oracle.sh`, and Docker debug scripts) to test and build `obiskim`.
- Update comments and error messages in library crates (`obicompactvec`, `obifastwrite`, `obikentropy`, `obikfilter`, `obikindex`, `obikindexer`, `obikphylo`, `obikselect`, `obikseq`, `obiread`, `obisys`) to reference `obiskim`.
This commit is contained in:
Eric Coissac committed 2026-12-01 18:15:13 +01:00
1 parent a71e59d6f0
commit 42d5b881ec
106 files changed
+223 -223

No files matched your search

+7 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# bench_merge_oracle.sh — golden-output + timing oracle for `obikmer merge`
# bench_merge_oracle.sh — golden-output + timing oracle for `obiskim merge`
# on the real-data benchmark (benchmark/run/specimen_index_presence, 20
# presence indexes built from real genomes).
#
@@ -9,10 +9,10 @@
# to a dedicated directory, never to benchmark/run/global_index_presence.
#
# What it does:
# 1. builds the release `obikmer`
# 1. builds the release `obiskim`
# 2. merges every specimen presence index (sorted, as merge_presence.sh)
# and keeps the stderr log (stage report: wall/RSS of merge_partitions)
# 3. `obikmer dump --debug` of the result → header first, rows sorted
# 3. `obiskim dump --debug` of the result → header first, rows sorted
# (LC_ALL=C) → sha256 of that sorted text, plus a zstd copy
# 4. --record DIR: writes DIR/merged (the merged index), DIR/merge.stderr.log, DIR/dump.sha256,
# DIR/dump.sorted.csv.zst, and (informative cross-check)
@@ -46,7 +46,7 @@ case "$DIR" in /*) ;; *) DIR="$PWD/$DIR" ;; esac
RUN_DIR="$REPO_ROOT/benchmark/run"
IDX_DIR="$RUN_DIR/specimen_index_presence"
GLOBAL_OLD="$RUN_DIR/global_index_presence"
BIN="$REPO_ROOT/src/target/release/obikmer"
BIN="$REPO_ROOT/src/target/release/obiskim"
mkdir -p "$DIR" "$RUN_DIR/merge_oracle"
# Scratch space on the same file system as the benchmark data (merge's
@@ -63,7 +63,7 @@ fail() {
}
# ── 1. build ────────────────────────────────────────────────────────────────
if ! (cd "$REPO_ROOT/src" && cargo build --release -q -p obikmer --bin obikmer) > "$WORK/build.log" 2>&1; then
if ! (cd "$REPO_ROOT/src" && cargo build --release -q -p obiskim --bin obiskim) > "$WORK/build.log" 2>&1; then
cat "$WORK/build.log" >&2
fail "cargo build --release failed"
fi
@@ -71,7 +71,7 @@ fi
sorted_dump() { # sorted_dump INDEX OUT_TXT — header first, rows sorted
local raw="$WORK/dump.raw.csv"
"$BIN" dump --debug "$1" > "$raw" 2> "$WORK/dump.log" \
|| { cat "$WORK/dump.log" >&2; fail "obikmer dump $1 exited non-zero"; }
|| { cat "$WORK/dump.log" >&2; fail "obiskim dump $1 exited non-zero"; }
{ head -n 1 "$raw"
tail -n +2 "$raw" | LC_ALL=C sort -S 25% --parallel=8 -T "$WORK"
} > "$2"
@@ -103,7 +103,7 @@ echo "merging ${#SOURCES[@]} presence indexes → $MERGED"
if ! "$BIN" merge --output "$MERGED" --force --force-presence "${SOURCES[@]}" \
> /dev/null 2> "$LOG"; then
tail -n 40 "$LOG" >&2
fail "obikmer merge exited non-zero"
fail "obiskim merge exited non-zero"
fi
WALL="$(stage_field "$LOG" wall_secs)"
RSS="$(stage_field "$LOG" rss)"
+1 -1
View File
@@ -3,4 +3,4 @@
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
PLATFORM="${PLATFORM:-linux/amd64}"
docker build --platform "$PLATFORM" -t "obikmer-debug:${PLATFORM//\//-}" .
docker build --platform "$PLATFORM" -t "obiskim-debug:${PLATFORM//\//-}" .
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Index compatibility test between two obikmer binaries that differ only by
# Index compatibility test between two obiskim binaries that differ only by
# their ptr_hash version (A = baseline, B = candidate).
#
# Usage: compat_ptrhash.sh VOL_A VOL_B OUT
@@ -22,9 +22,9 @@ mkdir -p "$OUT"
docker run --rm --platform linux/amd64 \
-v "$VOL_A:/va:ro" -v "$VOL_B:/vb:ro" \
-v "$REPO/benchmark/run/genomes:/genomes_ro:ro" -v "$OUT:/out" \
obikmer-debug:linux-amd64 bash -c '
obiskim-debug:linux-amd64 bash -c '
set -u
R=x86_64-unknown-linux-musl/release/obikmer
R=x86_64-unknown-linux-musl/release/obiskim
mkdir -p /tmp/bin && cp /va/$R /tmp/bin/A && cp /vb/$R /tmp/bin/B
A=/tmp/bin/A; B=/tmp/bin/B
W=/tmp/w; rm -rf $W; mkdir -p $W/ia $W/ib
+2 -2
View File
@@ -6,9 +6,9 @@ VOL_A="$1"; VOL_B="$2"; OUT="$3"
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; REPO="$(cd "$HERE/../.." && pwd)"
mkdir -p "$OUT"
docker run --rm --platform linux/amd64 -v "$VOL_A:/va:ro" -v "$VOL_B:/vb:ro" \
-v "$REPO/benchmark/run/genomes:/genomes_ro:ro" -v "$OUT:/out" obikmer-debug:linux-amd64 bash -c '
-v "$REPO/benchmark/run/genomes:/genomes_ro:ro" -v "$OUT:/out" obiskim-debug:linux-amd64 bash -c '
set -u
R=x86_64-unknown-linux-musl/release/obikmer
R=x86_64-unknown-linux-musl/release/obiskim
mkdir -p /tmp/bin && cp /va/$R /tmp/bin/A && cp /vb/$R /tmp/bin/B; A=/tmp/bin/A; B=/tmp/bin/B
W=/tmp/w; rm -rf $W; mkdir -p $W/i1 $W/i2 $W/ib $W/fa
exec > >(tee /out/report2.txt) 2>&1
+7 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# run.sh — builds obikmer (release, debug symbols) and merges the benchmark presence
# run.sh — builds obiskim (release, debug symbols) and merges the benchmark presence
# indexes in the container while sampling mappings/RSS/commit in parallel.
#
# Env:
@@ -26,8 +26,8 @@ TOOL="${TOOL:-none}"
TARGET="${TARGET:-gnu}"
OUT="${OUT:-$HERE/out/$(date +%Y%m%d-%H%M%S)}"
mkdir -p "$OUT"
IMG="obikmer-debug:${PLATFORM//\//-}"
VOL="obikmer-debug-target-${PLATFORM//\//-}-${TARGET}${VARIANT:+-$VARIANT}"
IMG="obiskim-debug:${PLATFORM//\//-}"
VOL="obiskim-debug-target-${PLATFORM//\//-}-${TARGET}${VARIANT:+-$VARIANT}"
docker run --rm --privileged --platform "$PLATFORM" \
-v "${SRC_DIR:-$REPO/src}:/work/src:$([ -n "${SRC_DIR:-}" ] && echo rw || echo ro)" \
@@ -50,11 +50,11 @@ for v in MALLOC_ARENA_MAX MALLOC_MMAP_THRESHOLD_ MALLOC_TRIM_THRESHOLD_ RUST_LOG
done
if [ "$TARGET" = musl ]; then
PKG_CONFIG_ALLOW_CROSS=1 cargo zigbuild --release $LOCKED_FLAG --target x86_64-unknown-linux-musl \
--manifest-path /work/src/Cargo.toml --bin obikmer 2>&1 | tail -3
BIN=/target/x86_64-unknown-linux-musl/release/obikmer
--manifest-path /work/src/Cargo.toml --bin obiskim 2>&1 | tail -3
BIN=/target/x86_64-unknown-linux-musl/release/obiskim
else
cargo build --release $LOCKED_FLAG --manifest-path /work/src/Cargo.toml --bin obikmer 2>&1 | tail -3
BIN=/target/release/obikmer
cargo build --release $LOCKED_FLAG --manifest-path /work/src/Cargo.toml --bin obiskim 2>&1 | tail -3
BIN=/target/release/obiskim
fi
file "$BIN" 2>/dev/null | cut -c1-150 || true
# merge writes into its sources (lock files…): work on a copy, never on benchmark/
+12 -12
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# smoke_test_index.sh — end-to-end smoke test of `obikmer index` + `obikmer query`
# smoke_test_index.sh — end-to-end smoke test of `obiskim index` + `obiskim query`
#
# The unit/integration test suite never exercises obikmer's real,
# The unit/integration test suite never exercises obiskim's real,
# file-driven CLI path (every test builds indexes by calling library APIs
# directly — see DevDocMD/implementation/partition_layer_cache.md, "(3)
# done"/"(6) done": a green `cargo test --workspace` has twice missed a
@@ -9,14 +9,14 @@
# substitute for hand-rolling that check each time.
#
# What it does:
# 1. builds `obikmer` (debug, via `cargo run`)
# 1. builds `obiskim` (debug, via `cargo run`)
# 2. generates a small deterministic random FASTA
# 3. runs `obikmer index` on it
# 3. runs `obiskim index` on it
# 4. picks a real k-mer from the source sequence, avoiding low-complexity
# substrings (a homopolymer run tripped up an earlier manual run of
# this check — it gets rejected by query's own entropy filter, which
# looks like a bug but isn't one)
# 5. runs `obikmer query` and checks the k-mer round-trips
# 5. runs `obiskim query` and checks the k-mer round-trips
# 6. prints total-kmers-indexed and a clear PASS/FAIL, exit code matches
#
# Usage:
@@ -74,12 +74,12 @@ EOF
# ── 2. build + run index ────────────────────────────────────────────────────
cd "$REPO_ROOT/src"
INDEX_LOG="$WORK/index.log"
if ! cargo run -q -p obikmer --bin obikmer -- \
if ! cargo run -q -p obiskim --bin obiskim -- \
index -k "$K" -m "$M" --theta 0 -p "$PARTITIONS" \
-o "$WORK/out.idx" "$WORK/test.fasta" > "$INDEX_LOG" 2>&1
then
cat "$INDEX_LOG" >&2
fail "obikmer index exited non-zero"
fail "obiskim index exited non-zero"
fi
N_KMERS="$(grep -o '[0-9]* total kmers indexed' "$INDEX_LOG" | grep -o '^[0-9]*' || true)"
@@ -108,11 +108,11 @@ QUERY_LOG="$WORK/query.log"
FOUND=0
for QUERY_KMER in "${CANDIDATES[@]}"; do
printf ">q1\n%s\n" "$QUERY_KMER" > "$WORK/query.fasta"
if ! cargo run -q -p obikmer --bin obikmer -- \
if ! cargo run -q -p obiskim --bin obiskim -- \
query "$WORK/out.idx" "$WORK/query.fasta" > "$QUERY_LOG" 2>&1
then
cat "$QUERY_LOG" >&2
fail "obikmer query exited non-zero"
fail "obiskim query exited non-zero"
fi
if grep -q '"kmer_count":1' "$QUERY_LOG"; then
FOUND=1
@@ -129,12 +129,12 @@ fi
# them empty (no layer 0 on disk) — must still build; (b) an NCBI-style
# `.fna.gz` name must be read, not silently skipped (it used to be
# taken for a directory and ignored, yielding an empty index).
count_kmers() { # $1 = output index dir, rest = obikmer index args
count_kmers() { # $1 = output index dir, rest = obiskim index args
local out="$1"; shift
local log="$WORK/regress.log"
( cd "$REPO_ROOT/src" && cargo run -q -p obikmer --bin obikmer -- \
( cd "$REPO_ROOT/src" && cargo run -q -p obiskim --bin obiskim -- \
index -k "$K" -m "$M" --theta 0 -o "$out" "$@" ) > "$log" 2>&1 \
|| { cat "$log" >&2; fail "obikmer index $* exited non-zero"; }
|| { cat "$log" >&2; fail "obiskim index $* exited non-zero"; }
grep -o '[0-9]* total kmers indexed' "$log" | grep -o '^[0-9]*' || echo 0
}
+10 -10
View File
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# smoke_test_merge.sh — end-to-end golden-output oracle for `obikmer merge`
# smoke_test_merge.sh — end-to-end golden-output oracle for `obiskim merge`
#
# Non-regression oracle for refactors of obikmerge (see
# DevDocMD/implementation/merge_mmap_audit.md). Like smoke_test_index.sh it
# drives the real CLI, never the library APIs.
#
# What it does:
# 1. builds `obikmer` (debug)
# 1. builds `obiskim` (debug)
# 2. generates (on --record) 4 small deterministic FASTA files A, B, C, D sharing
# fragments, so that merge both hits k-mers already present in the
# destination ("existing layer" path) and creates new ones ("new layer"
@@ -26,7 +26,7 @@
# see `can_be_destination` in obikmerge); `choose_base` therefore picks
# an unpacked source, and merging only packed indexes is refused with a
# clear error, which this script also checks.
# 5. dumps every result with `obikmer dump --debug` (partition + layer
# 5. dumps every result with `obiskim dump --debug` (partition + layer
# columns included, so a k-mer moving between layers is caught), keeps
# the CSV header first and sorts the rows (LC_ALL=C)
# 6. --record DIR writes the sorted dumps to DIR;
@@ -70,17 +70,17 @@ fail() {
}
# ── 1. build ────────────────────────────────────────────────────────────────
if ! (cd "$REPO_ROOT/src" && cargo build -q -p obikmer --bin obikmer) > "$WORK/build.log" 2>&1; then
if ! (cd "$REPO_ROOT/src" && cargo build -q -p obiskim --bin obiskim) > "$WORK/build.log" 2>&1; then
cat "$WORK/build.log" >&2
fail "cargo build failed"
fi
BIN="$REPO_ROOT/src/target/debug/obikmer"
BIN="$REPO_ROOT/src/target/debug/obiskim"
run() { # run LOGNAME CMD... — runs obikmer, dumps its log on failure
run() { # run LOGNAME CMD... — runs obiskim, dumps its log on failure
local log="$WORK/$1.log"; shift
if ! "$BIN" "$@" > "$log" 2>&1; then
cat "$log" >&2
fail "obikmer $1 exited non-zero"
fail "obiskim $1 exited non-zero"
fi
}
@@ -105,7 +105,7 @@ for name, parts in genomes.items():
EOF
# ── 3. source indexes: built on --record, frozen in DIR/sources, reused on
# --check. `obikmer index` is not byte-stable run to run (unitig
# --check. `obiskim index` is not byte-stable run to run (unitig
# segmentation, hence unitigs.bin size, varies — measured 2026-11-17),
# and the merge base is the source with the largest unitigs.bin
# (`choose_base`), so re-indexing on every check would make the merge
@@ -134,7 +134,7 @@ dump() { # dump NAME INDEX — header first, rows sorted
local raw="$WORK/$1.dump.csv"
if ! "$BIN" dump --debug "$2" > "$raw" 2> "$WORK/dump_$1.log"; then
cat "$WORK/dump_$1.log" >&2
fail "obikmer dump $1 exited non-zero"
fail "obiskim dump $1 exited non-zero"
fi
{ head -n 1 "$raw"; tail -n +2 "$raw" | LC_ALL=C sort; } > "$OUT/$1.csv"
}
@@ -154,7 +154,7 @@ run s2_ab merge -o "$WORK/s2_ab.idx" "$WORK/A.pres.idx" "$WORK/B.pres.idx"
run s2 merge -o "$WORK/s2.idx" "$WORK/s2_ab.idx" "$WORK/C.pres.idx" "$WORK/D.pres.idx"
for N in s1_pres s2; do
"$BIN" dump "$WORK/$N.idx" > "$WORK/plain_$N.csv" 2> "$WORK/dump_plain_$N.log" \
|| { cat "$WORK/dump_plain_$N.log" >&2; fail "obikmer dump $N exited non-zero"; }
|| { cat "$WORK/dump_plain_$N.log" >&2; fail "obiskim dump $N exited non-zero"; }
done
cat > "$WORK/compare_tables.py" <<'PY'
import csv, sys
+1 -1
View File
@@ -18,7 +18,7 @@
# env: INTERVAL=5 MAPS_MAX=500000 RSS_MAX_GB=400 VMSIZE_MAX_GB=440
#
# Typical use (Linux only):
# nohup scripts/watch_merge.sh "$(pgrep -f 'obikmer merge' | head -1)" /tmp/watch.csv &
# nohup scripts/watch_merge.sh "$(pgrep -f 'obiskim merge' | head -1)" /tmp/watch.csv &
set -u
PID=${1:?usage: watch_merge.sh PID OUT.csv}
OUT=${2:?usage: watch_merge.sh PID OUT.csv}