Files
Eric Coissac 42d5b881ec 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`.
2026-12-01 18:15:13 +01:00

83 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# 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
# VOL_A / VOL_B docker volumes holding a musl release build (CARGO_TARGET_DIR)
# OUT host directory receiving report.txt
#
# What it checks (everything compared by md5 of dump/query output):
# T0 on-disk bytes of an index built by A vs by B (informational)
# T1 A-built single-genome indexes read by A and by B
# T2 merges: A merging A-built sources (reference), B merging A-built
# sources, B merging B-built sources; each result dumped by A and by B
# T3 queries (hits and misses) on indexes read by A and by B
# T4 incremental merge into an existing A-built merged index, by A and B
set -u
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" \
obiskim-debug:linux-amd64 bash -c '
set -u
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
exec > >(tee /out/report.txt) 2>&1
echo "A sha: $(sha256sum $A | cut -c1-16) B sha: $(sha256sum $B | cut -c1-16)"
mapfile -t G < <(ls -S /genomes_ro/*.fna.gz | sed -n 8,12p)
echo "genomes: ${#G[@]}"; printf " %s\n" "${G[@]##*/}"
mkdir -p $W/fa; n=0; for gz in "${G[@]}"; do n=$((n+1)); g=$W/fa/L$n.fasta; zcat "$gz" > "$g"
$A index -k 21 -m 9 --theta 0 -p 256 --label L$n -o $W/ia/L$n.idx "$g" 2>$W/ia/L$n.err >/dev/null || { echo "A index failed L$n"; tail -2 $W/ia/L$n.err; }
$B index -k 21 -m 9 --theta 0 -p 256 --label L$n -o $W/ib/L$n.idx "$g" 2>$W/ib/L$n.err >/dev/null || { echo "B index failed L$n"; tail -2 $W/ib/L$n.err; }
done
echo; echo "== T0 on-disk bytes, index built by A vs by B"
nd=$(diff -rq $W/ia $W/ib | wc -l); nt=$(find $W/ia -type f | wc -l)
echo "files differing: $nd / $nt"
diff -rq $W/ia $W/ib | sed "s#$W/##g" | awk "{print \$2}" | sed -E "s#/partitions/.*/#/…/#" | sort | uniq -c | sort -rn | head -8
h() { md5sum | cut -c1-12; }
echo; echo "== T1 A-built single-genome indexes: dump by A vs by B"
for i in 1 2 3 4 5; do
a=$($A dump $W/ia/L$i.idx 2>/dev/null | h); b=$($B dump $W/ia/L$i.idx 2>/dev/null | h)
echo "L$i A:$a B:$b $([ "$a" = "$b" ] && echo OK || echo DIFF)"
done
cp_src() { rm -rf $2; mkdir -p $2; for i in $1; do cp -r $3/L$i.idx $2/; done; }
echo; echo "== T2 merges of 4 genomes (presence)"
cp_src "1 2 3 4" $W/s_aa $W/ia; cp_src "1 2 3 4" $W/s_ba $W/ia; cp_src "1 2 3 4" $W/s_bb $W/ib
$A merge --output $W/M_AA --force --force-presence $W/s_aa/L*.idx 2>$W/m_aa.err; echo "M_AA rc=$?"
$B merge --output $W/M_BA --force --force-presence $W/s_ba/L*.idx 2>$W/m_ba.err; echo "M_BA rc=$? (B merging A-built sources)"
$B merge --output $W/M_BB --force --force-presence $W/s_bb/L*.idx 2>$W/m_bb.err; echo "M_BB rc=$? (B merging B-built sources)"
for X in M_AA M_BA M_BB; do for T in A B; do
eval "BIN=\$$T"; $BIN dump $W/$X 2>/dev/null > $W/d_${X}_$T.csv
echo "dump $X by $T: $(wc -l < $W/d_${X}_$T.csv) lines raw:$(h < $W/d_${X}_$T.csv) sorted:$(LC_ALL=C sort -S 2G $W/d_${X}_$T.csv | h)"
done; done
echo; echo "== T3 queries"
head -c 60000 $W/fa/L1.fasta > $W/q.fa
python3 - <<PY >> $W/q.fa
import random
random.seed(1)
print(">rand")
print("".join(random.choice("ACGT") for _ in range(5000)))
PY
for X in ia/L1.idx M_AA M_BA M_BB; do for T in A B; do
eval "BIN=\$$T"; echo "query $X by $T: $($BIN query $W/$X $W/q.fa 2>/dev/null | h)"
done; done
echo; echo "== T4 incremental merge (existing A-built merged index + a 5th genome)"
for T in A B; do
eval "BIN=\$$T"; rm -rf $W/inc_$T $W/dst_$T; cp -r $W/M_AA $W/dst_$T; cp -r $W/ia/L5.idx $W/l5_$T.idx
$BIN merge --output $W/inc_$T --force --force-presence $W/dst_$T $W/l5_$T.idx 2>$W/inc_$T.err; echo "inc by $T rc=$?"
$BIN dump $W/inc_$T 2>/dev/null | h
done
echo; echo done
'