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:
1 parent
a71e59d6f0
commit
42d5b881ec
106 files changed
+223
-223
No files matched your search
@@ -76,12 +76,12 @@ jobs:
|
||||
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
|
||||
run: |
|
||||
mkdir -p /tmp/dist
|
||||
cp target/x86_64-unknown-linux-musl/release/obikmer /tmp/dist/obikmer-linux-x86_64
|
||||
strip /tmp/dist/obikmer-linux-x86_64
|
||||
cp target/x86_64-unknown-linux-musl/release/obiskim /tmp/dist/obiskim-linux-x86_64
|
||||
strip /tmp/dist/obiskim-linux-x86_64
|
||||
curl -s -X POST \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@/tmp/dist/obikmer-linux-x86_64"
|
||||
-F "attachment=@/tmp/dist/obiskim-linux-x86_64"
|
||||
|
||||
build-macos-arm64:
|
||||
needs: create-release
|
||||
@@ -112,7 +112,7 @@ jobs:
|
||||
docker start -a "$CID"
|
||||
STATUS=$(docker wait "$CID")
|
||||
mkdir -p /tmp/dist
|
||||
docker cp "$CID:/src/src/target/aarch64-apple-darwin/release/obikmer" /tmp/dist/obikmer-macos-arm64
|
||||
docker cp "$CID:/src/src/target/aarch64-apple-darwin/release/obiskim" /tmp/dist/obiskim-macos-arm64
|
||||
docker rm "$CID" > /dev/null
|
||||
[ "$STATUS" -eq 0 ]
|
||||
|
||||
@@ -124,4 +124,4 @@ jobs:
|
||||
curl -s -X POST \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@/tmp/dist/obikmer-macos-arm64"
|
||||
-F "attachment=@/tmp/dist/obiskim-macos-arm64"
|
||||
@@ -47,11 +47,11 @@ help:
|
||||
@echo "$(GREEN)Available commands:$(NC)"
|
||||
@sed -n "s/^## *\([^:]*\): */\1$$(printf '\t')/p" $(MAKEFILE_LIST) | column -t -s "$$(printf '\t')" | sed -e 's/^/ /'
|
||||
|
||||
## build: Release build of the obikmer binary (alias of release)
|
||||
## build: Release build of the obiskim binary (alias of release)
|
||||
build: release
|
||||
|
||||
## release: Release build of the obikmer binary
|
||||
release: obikmer
|
||||
## release: Release build of the obiskim binary
|
||||
release: obiskim
|
||||
|
||||
## test: Workspace tests
|
||||
test:
|
||||
@@ -77,25 +77,25 @@ clippy:
|
||||
ci: deps-check fmt-check clippy test
|
||||
@echo "$(GREEN)✓ All CI checks passed$(NC)"
|
||||
|
||||
# ── obikmer binary ───────────────────────────────────────────────────────────
|
||||
# ── obiskim binary ───────────────────────────────────────────────────────────
|
||||
|
||||
PROFILE_FILE := profile.pb
|
||||
PPROF_PORT := 8081
|
||||
|
||||
.PHONY: obikmer
|
||||
## obikmer: Release build of the obikmer binary
|
||||
obikmer:
|
||||
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
||||
.PHONY: obiskim
|
||||
## obiskim: Release build of the obiskim binary
|
||||
obiskim:
|
||||
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml --bin obiskim
|
||||
|
||||
.PHONY: debug
|
||||
## debug: Debug build of the obikmer binary
|
||||
## debug: Debug build of the obiskim binary
|
||||
debug:
|
||||
cargo build --manifest-path $(CARGO_DIR)/Cargo.toml --bin obikmer
|
||||
cargo build --manifest-path $(CARGO_DIR)/Cargo.toml --bin obiskim
|
||||
|
||||
.PHONY: profile-build
|
||||
profile-build:
|
||||
cargo build --release --manifest-path $(CARGO_DIR)/Cargo.toml \
|
||||
--bin obikmer --features obikmer/profiling
|
||||
--bin obiskim --features obiskim/profiling
|
||||
|
||||
.PHONY: profile-view
|
||||
profile-view:
|
||||
@@ -148,12 +148,12 @@ clean: clean-doc clean-doc-user
|
||||
rm -rf $(VENV)
|
||||
|
||||
# ── release (jj only; the kit's norms for a repository that is not a crate) ───────
|
||||
# Version: patch bump of the obikmer crate (RELEASE=x.y.z forces it). Tag: v<version> (what release.yml
|
||||
# Version: patch bump of the obiskim crate (RELEASE=x.y.z forces it). Tag: v<version> (what release.yml
|
||||
# triggers on), created and pushed with jj, lightweight: the CI release body is the tagged commit's
|
||||
# message. Release notes: ReleaseNotes/version-<version>.md (jj release-notes), committed with the release.
|
||||
# No git command is run. The user runs `make jjrelease`; it never runs by itself.
|
||||
|
||||
CARGO_TOML := $(CARGO_DIR)/obikmer/Cargo.toml
|
||||
CARGO_TOML := $(CARGO_DIR)/obiskim/Cargo.toml
|
||||
RELEASE_NOTES_DIR := ReleaseNotes
|
||||
API_DIR := api
|
||||
RELEASE_PROJECT_DESC := obiskim (Rust k-mer genomics tool)
|
||||
@@ -165,7 +165,7 @@ export RELEASE_NOTES_DIR API_DIR RELEASE_PROJECT_DESC TAG_PREFIX
|
||||
|
||||
.PHONY: bump-version jjpush jjrelease bookmark-check print-%
|
||||
|
||||
## bump-version: Next patch version of the obikmer crate, or fixed RELEASE=x.y.z (refused if the tag exists)
|
||||
## bump-version: Next patch version of the obiskim crate, or fixed RELEASE=x.y.z (refused if the tag exists)
|
||||
bump-version:
|
||||
@jj git fetch
|
||||
@current=$$(grep '^version = ' $(CARGO_TOML) | head -n 1 | sed 's/version = "\(.*\)"/\1/'); \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# obikmer
|
||||
# obiskim
|
||||
|
||||
`obikmer` is a Rust toolkit for indexing, querying, and comparing DNA sequences
|
||||
`obiskim` is a Rust toolkit for indexing, querying, and comparing DNA sequences
|
||||
represented as sets of k-mers. It targets individual genome datasets (tens of
|
||||
Gbases) with maximum efficiency in computation, memory, and disk usage.
|
||||
|
||||
@@ -95,20 +95,20 @@ Non-ACGT characters act as hard breaks between k-mer segments in all formats.
|
||||
|
||||
```sh
|
||||
# Build an exact index for each genome independently
|
||||
obikmer index --kmer-size 31 --label genome_a genome_a.fa --output index_a/
|
||||
obikmer index --kmer-size 31 --label genome_b genome_b.fa --output index_b/
|
||||
obiskim index --kmer-size 31 --label genome_a genome_a.fa --output index_a/
|
||||
obiskim index --kmer-size 31 --label genome_b genome_b.fa --output index_b/
|
||||
|
||||
# Merge into a single multi-genome index
|
||||
obikmer merge --output index/ index_a/ index_b/
|
||||
obiskim merge --output index/ index_a/ index_b/
|
||||
|
||||
# Convert to approximate index (z=5, 8-bit fingerprints)
|
||||
obikmer reindex --approx -z 5 --evidence-bits 8 index/
|
||||
obiskim reindex --approx -z 5 --evidence-bits 8 index/
|
||||
|
||||
# Query reads
|
||||
obikmer query index/ reads.fq.gz > annotated.fa
|
||||
obiskim query index/ reads.fq.gz > annotated.fa
|
||||
|
||||
# Pairwise distances
|
||||
obikmer phylo index/ > distances.tsv
|
||||
obiskim phylo index/ > distances.tsv
|
||||
```
|
||||
|
||||
## Parameter constraints
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Architecture notes for advanced use
|
||||
|
||||
This page describes execution-level behavior relevant to sizing and running `obikmer` on large datasets or multi-socket machines. It complements the [index format](formats/index_layout.md) and [theory](theory/kmer_indexing/indexing_architecture.md) pages.
|
||||
This page describes execution-level behavior relevant to sizing and running `obiskim` on large datasets or multi-socket machines. It complements the [index format](formats/index_layout.md) and [theory](theory/kmer_indexing/indexing_architecture.md) pages.
|
||||
|
||||
## Sequence invariant
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Nothing here comes from a reference genome. The file has no real coordinates, an
|
||||
## Producing the file
|
||||
|
||||
```
|
||||
obikmer phylo --vcf --n-sites 5000000 -o run1 my_index
|
||||
obiskim phylo --vcf --n-sites 5000000 -o run1 my_index
|
||||
```
|
||||
|
||||
`--vcf` implies `--pseudo-alignment`, so `--n-sites N|all` is required, (the sibling annex it reads is built automatically if missing; see [`phylo`](../usage/phylo.md)). `--fasta` and `--vcf` can be given together to get both files from the same draw; with neither, only the FASTA is written. Every option that shapes the draw (`--free-loss`, `--no-ambiguity`, `--only-diploid`, `--quartet`, `--exclude-genome`, ...) applies to the VCF exactly as to the FASTA, since both describe the same sites.
|
||||
@@ -32,7 +32,7 @@ obikmer_0_0 1511 CACGANTGTAG A G,T . . . GT 0/0 0/0
|
||||
obikmer_0_1 9 TTACGNAGCTA C * . . . GT 0/0 0/0 1/1 0/0
|
||||
```
|
||||
|
||||
There is one sample column per genome that takes part in the draw, named after the genome label, in the index's own order. A genome removed with `--exclude-genome` or `--min-shared-family` has no column at all. `QUAL`, `FILTER` and `INFO` are always `.`: obikmer applies no variant filter and attaches no annotation, and leaving them empty keeps a file of millions of sites compact.
|
||||
There is one sample column per genome that takes part in the draw, named after the genome label, in the index's own order. A genome removed with `--exclude-genome` or `--min-shared-family` has no column at all. `QUAL`, `FILTER` and `INFO` are always `.`: obiskim applies no variant filter and attaches no annotation, and leaving them empty keeps a file of millions of sites compact.
|
||||
|
||||
## Coordinates: `CHROM` and `POS`
|
||||
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
# obikmer
|
||||
# obiskim
|
||||
|
||||
`obikmer` is a command-line tool for counting, indexing, querying and comparing DNA sequences represented as kmer sets. It targets individual genome datasets of tens of gigabases, with an emphasis on computational, memory, and disk efficiency.
|
||||
`obiskim` is a command-line tool for counting, indexing, querying and comparing DNA sequences represented as kmer sets. It targets individual genome datasets of tens of gigabases, with an emphasis on computational, memory, and disk efficiency.
|
||||
|
||||
All functionality is exposed through a single binary, `obikmer`, organized as subcommands.
|
||||
All functionality is exposed through a single binary, `obiskim`, organized as subcommands.
|
||||
|
||||
## Core principles
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
### Rust toolchain
|
||||
|
||||
`obikmer` requires **Rust 1.85 or later** (edition 2024). Install or update via [rustup](https://rustup.rs):
|
||||
`obiskim` requires **Rust 1.85 or later** (edition 2024). Install or update via [rustup](https://rustup.rs):
|
||||
|
||||
```bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
@@ -13,7 +13,7 @@ rustup update stable
|
||||
|
||||
### C build environment (required for hwloc)
|
||||
|
||||
`obikmer` embeds [hwloc](https://www.open-mpi.org/projects/hwloc/) (Hardware Locality) for NUMA-aware thread placement on multi-socket machines. hwloc is built from source at compile time, which requires a standard C build environment.
|
||||
`obiskim` embeds [hwloc](https://www.open-mpi.org/projects/hwloc/) (Hardware Locality) for NUMA-aware thread placement on multi-socket machines. hwloc is built from source at compile time, which requires a standard C build environment.
|
||||
|
||||
#### Linux (Debian/Ubuntu)
|
||||
|
||||
@@ -47,11 +47,11 @@ brew install automake libtool autoconf pkg-config
|
||||
|
||||
```bash
|
||||
git clone <repository-url>
|
||||
cd obikmer/src
|
||||
cd obiskim/src
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
The compiled binary is at `target/release/obikmer`.
|
||||
The compiled binary is at `target/release/obiskim`.
|
||||
|
||||
### Building on HPC clusters (network filesystems)
|
||||
|
||||
@@ -66,7 +66,7 @@ CARGO_TARGET_DIR=/scratch/$USER/cargo-target cargo build --release
|
||||
Adapt the path to the scratch space available on your cluster (`/var/tmp`, `/tmp`, `/scratch/local`, etc.). Once built, copy the binary to a permanent location:
|
||||
|
||||
```bash
|
||||
cp /scratch/$USER/cargo-target/release/obikmer ~/bin/
|
||||
cp /scratch/$USER/cargo-target/release/obiskim ~/bin/
|
||||
```
|
||||
|
||||
## NUMA support
|
||||
@@ -80,5 +80,5 @@ NUMA-aware thread placement is active automatically on multi-socket Linux machin
|
||||
## Verifying the installation
|
||||
|
||||
```bash
|
||||
obikmer --help
|
||||
obiskim --help
|
||||
```
|
||||
@@ -1,6 +1,6 @@
|
||||
# Low-complexity kmer filter
|
||||
|
||||
Low-complexity kmers (homopolymer runs, tandem repeats) can dominate an index without carrying useful information. `obikmer` detects and excludes them during index construction using a normalized Shannon entropy score.
|
||||
Low-complexity kmers (homopolymer runs, tandem repeats) can dominate an index without carrying useful information. `obiskim` detects and excludes them during index construction using a normalized Shannon entropy score.
|
||||
|
||||
## Sub-word frequencies
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Applying the minimizer to consecutive k-mers partitions a sequence into super-km
|
||||
|
||||
## 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 [@Zheng2020-ji; @Zheng2021-cc; @Pan2024-hb; @Kille2023-px; @Golan2025-xf].
|
||||
`obiskim` 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 [@Zheng2020-ji; @Zheng2021-cc; @Pan2024-hb; @Kille2023-px; @Golan2025-xf].
|
||||
|
||||
Instead, a well-distributed hash function $H$ is applied to the canonical (lexicographically minimal) form of each m-mer, and the m-mer with the smallest $H$ value wins. Because $H$ is a bijective mixing function with good avalanche properties [@Steele2014-cz], its output behaves approximately as a composition-independent pseudorandom ordering of distinct m-mers. Under the usual random-hash assumption, each distinct m-mer in a window has approximately the same probability of being the minimum, independently of nucleotide composition.
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ $$\hat\alpha = \frac{\hat\mu^2}{V - \hat\mu/\bar L}$$
|
||||
|
||||
If the measured variance $V$ doesn't exceed the Poisson floor $\hat\mu/\bar L$ (no detectable over-dispersion across partitions — the data are consistent with a single shared rate), $\alpha$ is left undefined: the correction is silently disabled for that run rather than applying a fabricated value, and a warning is logged.
|
||||
|
||||
**This is not Jin & Nei's (1990) original estimator.** Their publication defines the $+\Gamma$ distance formula itself and, absent an estimate, recommends the fixed default $\alpha = 1$ — it does not propose a way to estimate $\alpha$ from data. The method-of-moments estimator above is a standard consequence of the Poisson–Gamma relationship between substitution counts and gamma-distributed rate variation, applied per-partition; it is `obikmer`'s own addition, not part of the cited correction.
|
||||
**This is not Jin & Nei's (1990) original estimator.** Their publication defines the $+\Gamma$ distance formula itself and, absent an estimate, recommends the fixed default $\alpha = 1$ — it does not propose a way to estimate $\alpha$ from data. The method-of-moments estimator above is a standard consequence of the Poisson–Gamma relationship between substitution counts and gamma-distributed rate variation, applied per-partition; it is `obiskim`'s own addition, not part of the cited correction.
|
||||
|
||||
See [`phylo`](../../../usage/phylo.md#distance-estimation-and-tree-reconstruction) for how to select a fixed $\alpha$ or request automatic estimation.
|
||||
@@ -3,8 +3,8 @@
|
||||
Add or update genome metadata of an index from a CSV file, or dump the current metadata as CSV.
|
||||
|
||||
```bash
|
||||
obikmer annotate INDEX --csv FILE [OPTIONS]
|
||||
obikmer annotate INDEX --dump
|
||||
obiskim annotate INDEX --csv FILE [OPTIONS]
|
||||
obiskim annotate INDEX --dump
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Convert an existing index's evidence representation in place, between exact, approximate, and hybrid.
|
||||
|
||||
```bash
|
||||
obikmer convert INDEX (--exact-evidence | --approx-evidence BITS | --hybrid-evidence) [OPTIONS]
|
||||
obiskim convert INDEX (--exact-evidence | --approx-evidence BITS | --hybrid-evidence) [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Dump all kmers of an index as CSV, one row per kmer, with per-genome counts or presence.
|
||||
|
||||
```bash
|
||||
obikmer dump INDEX [OPTIONS]
|
||||
obiskim dump INDEX [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
`estimate` has two independent uses. Without `--index`, it estimates approximate-index parameters (z, evidence bits, false-positive rate) before building an index with `--approx`, without touching any files. With `--index`, it compares the k-mer sharing observed in an existing index with the sharing expected by chance (see the last section).
|
||||
|
||||
```bash
|
||||
obikmer estimate [OPTIONS]
|
||||
obiskim estimate [OPTIONS]
|
||||
```
|
||||
|
||||
## Options
|
||||
@@ -20,7 +20,7 @@ Any two of `-z`, `--evidence-bits`, `--fp` may be given; the third is derived us
|
||||
## Comparing an index with random sharing
|
||||
|
||||
```bash
|
||||
obikmer estimate --index INDEX [--presence-threshold N] [-o FILE]
|
||||
obiskim estimate --index INDEX [--presence-threshold N] [-o FILE]
|
||||
```
|
||||
|
||||
With `--index`, `estimate` reads an existing index instead of computing approximate-index parameters, and it cannot be combined with `-k`, `-z`, `--evidence-bits` or `--fp`. Its purpose is to tell how much of the k-mer sharing between the genomes of the index goes beyond what chance alone would produce, which is the question behind the choice of $k$ (see [K-mer size](../theory/kmer_indexing/kmers.md)).
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Apply row-level selection to an index: retain only kmers matching ingroup/outgroup predicates over genome membership, plus optional total-count and complexity thresholds. The output is a new, single-layer index.
|
||||
|
||||
```bash
|
||||
obikmer filter SOURCE -o OUTPUT [OPTIONS]
|
||||
obiskim filter SOURCE -o OUTPUT [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Build a genome index from one or more sequence files. Construction proceeds in phases (scatter → dereplicate → count → layered MPHF), described in [On-disk storage](../formats/index_layout.md).
|
||||
|
||||
```bash
|
||||
obikmer index -o OUTPUT [OPTIONS] [INPUTS...]
|
||||
obiskim index -o OUTPUT [OPTIONS] [INPUTS...]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Merge multiple built indexes into a single index.
|
||||
|
||||
```bash
|
||||
obikmer merge -o OUTPUT SOURCE... [OPTIONS]
|
||||
obiskim merge -o OUTPUT SOURCE... [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Pack an index's per-column matrix files into a single-file format to reduce query-time I/O (fewer file opens per query).
|
||||
|
||||
```bash
|
||||
obikmer pack INDEX [--sparse]
|
||||
obiskim pack INDEX [--sparse]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -10,7 +10,7 @@ Distance matrices can be used to build Neighbor-Joining or UPGMA trees. SNP-base
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
obikmer phylo INDEX [OPTIONS]
|
||||
obiskim phylo INDEX [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
@@ -70,7 +70,7 @@ SNP-based analyses can use every eligible variable family, or a sample drawn fro
|
||||
|
||||
`--n-sites`, `--free-loss`, `--no-ambiguity`, `--quartet`, `--pair-balance`, `--entropy`/`--entropy-sd` are shared by `--pseudo-alignment`, `--sankoff` (and everything it implies: `--tnt`/`--phyg`/`--iqtree`), and a `snp-*` `--distance` value — one draw feeds all of them in a single invocation. `--n-sites` is mandatory for `--pseudo-alignment`/`--sankoff`, where it takes either a number of sites or `all`; for a `snp-*` `--distance` value it is optional, and omitting it is the same as `all` (every non-monomorphic family in the index, not an approximation).
|
||||
|
||||
Combining `--sankoff` (or `--tnt`/`--phyg`/`--iqtree`) with a `snp-*` `--distance` value in the same command reuses that one draw for both — the distance and the Sankoff calibration/alignment are guaranteed to be computed from the *identical* set of sampled sites, never two independent samples, so the two outputs are directly comparable. This only holds within a single command; running them as two separate `obikmer phylo` invocations draws two independent samples even with the same flags.
|
||||
Combining `--sankoff` (or `--tnt`/`--phyg`/`--iqtree`) with a `snp-*` `--distance` value in the same command reuses that one draw for both — the distance and the Sankoff calibration/alignment are guaranteed to be computed from the *identical* set of sampled sites, never two independent samples, so the two outputs are directly comparable. This only holds within a single command; running them as two separate `obiskim phylo` invocations draws two independent samples even with the same flags.
|
||||
|
||||
Every invocation draws its own fresh random sample: running the same command twice gives two different (but equally valid) samples, which is useful for measuring sampling variance and is kept that way deliberately.
|
||||
|
||||
|
||||
@@ -42,5 +42,5 @@ A rank-qualified query, `key@rank=value`, matches only when the path's segment a
|
||||
### Example
|
||||
|
||||
```bash
|
||||
obikmer filter source -o output --ingroup "taxon~/Betulaceae/Betula"
|
||||
obiskim filter source -o output --ingroup "taxon~/Betulaceae/Betula"
|
||||
```
|
||||
@@ -3,7 +3,7 @@
|
||||
Query an index with sequences and annotate each query with the kmer matches found.
|
||||
|
||||
```bash
|
||||
obikmer query INDEX INPUTS... [OPTIONS]
|
||||
obiskim query INDEX INPUTS... [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Project and/or aggregate the genome columns of an index into a new index. Where [`filter`](filter.md) selects rows (kmers), `select` operates on columns (genomes): grouping several genomes into one aggregated column, reordering columns, or dropping some.
|
||||
|
||||
```bash
|
||||
obikmer select SOURCE --output OUTPUT [OPTIONS]
|
||||
obiskim select SOURCE --output OUTPUT [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
@@ -42,7 +42,7 @@ At least one output column must be defined; every name listed in `--select` must
|
||||
To replace an index with a selected version of itself, select to a temporary directory and swap it in:
|
||||
|
||||
```bash
|
||||
obikmer select INDEX --output INDEX.tmp --group ... --group-op ... --select ...
|
||||
obiskim select INDEX --output INDEX.tmp --group ... --group-op ... --select ...
|
||||
rm -rf INDEX
|
||||
mv INDEX.tmp INDEX
|
||||
```
|
||||
@@ -3,7 +3,7 @@
|
||||
Extract super-kmers from one or more sequence files and write them to stdout, without building a full index. Useful for inspecting or piping the super-kmer decomposition of a dataset.
|
||||
|
||||
```bash
|
||||
obikmer superkmer [OPTIONS] [INPUTS...]
|
||||
obiskim superkmer [OPTIONS] [INPUTS...]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Dump the unitigs of an index as FASTA. A unitig is a maximal non-branching path through the de Bruijn graph implied by the index's kmers; the concatenation of every unitig reconstructs every stored kmer exactly once.
|
||||
|
||||
```bash
|
||||
obikmer unitig INDEX [OPTIONS]
|
||||
obiskim unitig INDEX [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Miscellaneous index maintenance and inspection utilities.
|
||||
|
||||
```bash
|
||||
obikmer utils INDEXES... [OPTIONS]
|
||||
obiskim utils INDEXES... [OPTIONS]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
# Requires GNU Make >= 4.3 (grouped targets &:) — use gmake on macOS
|
||||
BINARY := ../src/target/release/obikmer
|
||||
BINARY := ../src/target/release/obiskim
|
||||
VENV_PY := ../.venv/bin/python3
|
||||
|
||||
# All generated/downloaded artifacts live under RUN/ so the whole tree can be
|
||||
@@ -121,7 +121,7 @@ $(REF_DIST_CSVS) &: $(REF_NPZS) build_reference_dist.py
|
||||
|
||||
reference_dist: $(REF_DIST_CSVS)
|
||||
|
||||
# ── obikmer phylo (presence index) ──────────────────────────────────────────
|
||||
# ── obiskim phylo (presence index) ──────────────────────────────────────────
|
||||
|
||||
$(OBIKMER_PRESENCE_DIST) &: $(RUN)/global_index_presence/index.done $(BINARY)
|
||||
mkdir -p $(RUN)/obikmer_dist/presence
|
||||
@@ -136,7 +136,7 @@ $(OBIKMER_PRESENCE_DIST) &: $(RUN)/global_index_presence/index.done $(BINARY)
|
||||
|
||||
obikmer_dist_presence: $(OBIKMER_PRESENCE_DIST)
|
||||
|
||||
# ── obikmer phylo (count index) ─────────────────────────────────────────────
|
||||
# ── obiskim phylo (count index) ─────────────────────────────────────────────
|
||||
|
||||
$(OBIKMER_COUNT_DIST) &: $(RUN)/global_index_count/index.done $(BINARY)
|
||||
mkdir -p $(RUN)/obikmer_dist/count
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: bench_mphf.sh LABEL
|
||||
#
|
||||
# Measures the obikmer commands that sit on MPHF lookups (see
|
||||
# Measures the obiskim commands that sit on MPHF lookups (see
|
||||
# DevDocMD/implementation/mphf_batch_queries.md for the site inventory), on the
|
||||
# 20-genome benchmark data already built under run/ (`gmake all` first).
|
||||
# Nothing under run/ other than run/bench_mphf/ is written.
|
||||
#
|
||||
# Env:
|
||||
# BINARY obikmer binary to measure (default ../src/target/release/obikmer)
|
||||
# BINARY obiskim binary to measure (default ../src/target/release/obiskim)
|
||||
# REPS repetitions per step (default 3)
|
||||
# CPU_MAX passed as --cpu-max when set (default: all cores)
|
||||
#
|
||||
@@ -19,7 +19,7 @@ set -euo pipefail
|
||||
LABEL="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${BINARY:-${SCRIPT_DIR}/../src/target/release/obikmer}"
|
||||
BINARY="${BINARY:-${SCRIPT_DIR}/../src/target/release/obiskim}"
|
||||
REPS="${REPS:-3}"
|
||||
OUT="${RUN_DIR}/bench_mphf/${LABEL}"
|
||||
CPU=()
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
"""Compute reference pairwise distance matrices from per-specimen .npz kmer indexes.
|
||||
|
||||
Reads all .npz files in reference_index/ (each containing sorted uint64 `kmers`
|
||||
and uint32 `counts`), computes all distance metrics supported by `obikmer phylo`,
|
||||
and uint32 `counts`), computes all distance metrics supported by `obiskim phylo`,
|
||||
and writes one CSV per metric to reference_dist/.
|
||||
|
||||
Output CSV format matches `obikmer phylo --output`:
|
||||
Output CSV format matches `obiskim phylo --output`:
|
||||
- first row: "genome", then specimen names
|
||||
- subsequent rows: specimen name, then float or int values
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare all reference distance matrices against obikmer phylo outputs.
|
||||
"""Compare all reference distance matrices against obiskim phylo outputs.
|
||||
|
||||
Reads from:
|
||||
reference_dist/ — ground-truth matrices computed by build_reference_dist.py
|
||||
obikmer_dist/ — matrices produced by `obikmer phylo`
|
||||
obikmer_dist/ — matrices produced by `obiskim phylo`
|
||||
|
||||
Handles label reordering: both matrices are sorted by genome label before
|
||||
element-wise comparison, so column/row order differences are irrelevant.
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
# Usage: filter_one_count.sh SPECIES
|
||||
# Filters global_index_count to keep only kmers specific to SPECIES,
|
||||
# then selects the SPECIES column (to a temp dir, swapped over the
|
||||
# original — obikmer select has no --in-place mode, but its output hard-
|
||||
# original — obiskim select has no --in-place mode, but its output hard-
|
||||
# links each layer's unchanged kmer-identity files rather than copying
|
||||
# them, so this costs no extra disk for those).
|
||||
# Outputs:
|
||||
# specific_index_count/SPECIES/index.done (written by obikmer select)
|
||||
# specific_index_count/SPECIES/index.done (written by obiskim select)
|
||||
# stats/specific_kmer_count/SPECIES.stats (one CSV data row, no header)
|
||||
set -euo pipefail
|
||||
|
||||
SPECIES="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
|
||||
SOURCE="${RUN_DIR}/global_index_count"
|
||||
OUTPUT="${RUN_DIR}/specific_index_count/${SPECIES}"
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
# Usage: filter_one_presence.sh SPECIES
|
||||
# Filters global_index_presence to keep only kmers specific to SPECIES,
|
||||
# then selects the SPECIES column (to a temp dir, swapped over the
|
||||
# original — obikmer select has no --in-place mode, but its output hard-
|
||||
# original — obiskim select has no --in-place mode, but its output hard-
|
||||
# links each layer's unchanged kmer-identity files rather than copying
|
||||
# them, so this costs no extra disk for those).
|
||||
# Outputs:
|
||||
# specific_index_presence/SPECIES/index.done (written by obikmer select)
|
||||
# specific_index_presence/SPECIES/index.done (written by obiskim select)
|
||||
# stats/specific_kmer_presence/SPECIES.stats (one CSV data row, no header)
|
||||
set -euo pipefail
|
||||
|
||||
SPECIES="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
|
||||
SOURCE="${RUN_DIR}/global_index_presence"
|
||||
OUTPUT="${RUN_DIR}/specific_index_presence/${SPECIES}"
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# Usage: index_one_count.sh SPECIMEN
|
||||
# SPECIMEN = "species--strain" (Make pattern stem)
|
||||
# Outputs:
|
||||
# specimen_index_count/SPECIMEN/index.done (written by obikmer)
|
||||
# specimen_index_count/SPECIMEN/index.done (written by obiskim)
|
||||
# stats/indexing_count/SPECIMEN.stats (one CSV data row, no header)
|
||||
set -euo pipefail
|
||||
|
||||
SPECIMEN="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
|
||||
species="${SPECIMEN%%--*}"
|
||||
strain="${SPECIMEN#*--}"
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# Usage: index_one_presence.sh SPECIMEN
|
||||
# SPECIMEN = "species--strain" (Make pattern stem)
|
||||
# Outputs:
|
||||
# specimen_index_presence/SPECIMEN/index.done (written by obikmer)
|
||||
# specimen_index_presence/SPECIMEN/index.done (written by obiskim)
|
||||
# stats/indexing_presence/SPECIMEN.stats (one CSV data row, no header)
|
||||
set -euo pipefail
|
||||
|
||||
SPECIMEN="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
|
||||
species="${SPECIMEN%%--*}"
|
||||
strain="${SPECIMEN#*--}"
|
||||
|
||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
IDX_DIR="${RUN_DIR}/specimen_index_count"
|
||||
OUTPUT="${RUN_DIR}/global_index_count"
|
||||
STATS_DIR="${RUN_DIR}/stats/merge_count"
|
||||
|
||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
IDX_DIR="${RUN_DIR}/specimen_index_presence"
|
||||
OUTPUT="${RUN_DIR}/global_index_presence"
|
||||
STATS_DIR="${RUN_DIR}/stats/merge_presence"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# sparse by default (2026-08-28), so the dense comparison arm needs an
|
||||
# explicit rebuild.
|
||||
#
|
||||
# `obikmer pack --dense` cannot do this: it only converts the raw, freshly-
|
||||
# `obiskim pack --dense` cannot do this: it only converts the raw, freshly-
|
||||
# built columnar (per-genome-file, unpacked) matrix into a packed format —
|
||||
# `finalize_indexed` already packs (sparse by default) as the last step of
|
||||
# every index-building command, so there is no columnar leftover for a
|
||||
@@ -13,7 +13,7 @@
|
||||
# directory", `obicompactvec::bitmatrix::packed::pack_bit_matrix` looking
|
||||
# for a `meta.json` that packing already cleaned up).
|
||||
#
|
||||
# `obikmer select` doesn't have that limitation — it always rebuilds its
|
||||
# `obiskim select` doesn't have that limitation — it always rebuilds its
|
||||
# output from scratch via `MatrixBuilder`, reading the source through the
|
||||
# format-agnostic `PersistentBitMatrix`/`PersistentIntMatrix` (Sparse
|
||||
# included, both content kinds — see `obicompactvec::batch_presence_counts`/
|
||||
@@ -31,7 +31,7 @@ set -euo pipefail
|
||||
KIND="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
SOURCE="${RUN_DIR}/global_index_${KIND}"
|
||||
OUTPUT="${RUN_DIR}/global_index_${KIND}_dense"
|
||||
STATS_DIR="${RUN_DIR}/stats/pack_dense_${KIND}"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# explicitly repacked global_index_KIND_dense (see pack_dense.sh).
|
||||
# SPECIMEN = "species--strain" (Make pattern stem), reads from query_data/
|
||||
# Outputs:
|
||||
# query_KIND_MODE/SPECIMEN.fasta.gz (obikmer query output, --count-missing)
|
||||
# query_KIND_MODE/SPECIMEN.fasta.gz (obiskim query output, --count-missing)
|
||||
# stats/query_KIND_MODE/SPECIMEN.stats (one CSV data row, no header)
|
||||
set -euo pipefail
|
||||
|
||||
@@ -15,7 +15,7 @@ MODE="$2"
|
||||
SPECIMEN="$3"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
|
||||
case "${KIND}" in
|
||||
presence|count) ;;
|
||||
|
||||
@@ -14,7 +14,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ISS="${SCRIPT_DIR}/../.venv/bin/iss"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
COVERAGE="${COVERAGE:-1}"
|
||||
SEED="${SEED:-1}"
|
||||
READ_LENGTH=150
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare an obikmer count index against a reference kmer set (presence + counts).
|
||||
"""Compare an obiskim count index against a reference kmer set (presence + counts).
|
||||
|
||||
Loads the reference .npz (sorted uint64 kmers + uint32 counts from build_reference.py),
|
||||
streams `obikmer dump` from a --with-counts index, then reports:
|
||||
streams `obiskim dump` from a --with-counts index, then reports:
|
||||
- false negatives : kmers in reference absent from the index
|
||||
- false positives : kmers in the index absent from the reference
|
||||
- count mismatches: kmers present in both but with differing counts
|
||||
@@ -44,7 +44,7 @@ def decode_kmer(val: int, k: int) -> str:
|
||||
# ── dump parsing ──────────────────────────────────────────────────────────────
|
||||
|
||||
def load_index(obikmer_bin: str, index_dir: str) -> tuple[np.ndarray, np.ndarray]:
|
||||
"""Stream `obikmer dump` and return (kmers_sorted_uint64, counts_uint32)."""
|
||||
"""Stream `obiskim dump` and return (kmers_sorted_uint64, counts_uint32)."""
|
||||
cmd = [obikmer_bin, 'dump', index_dir]
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
text=True)
|
||||
@@ -59,7 +59,7 @@ def load_index(obikmer_bin: str, index_dir: str) -> tuple[np.ndarray, np.ndarray
|
||||
counts.append(int(parts[1]))
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
print(f'ERROR: obikmer dump exited {proc.returncode}', file=sys.stderr)
|
||||
print(f'ERROR: obiskim dump exited {proc.returncode}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
order = np.argsort(np.array(kmers, dtype=np.uint64), kind='stable')
|
||||
return (np.array(kmers, dtype=np.uint64)[order],
|
||||
@@ -104,9 +104,9 @@ def main() -> None:
|
||||
ap.add_argument('reference', metavar='REF_NPZ', nargs='?',
|
||||
help='Reference .npz file')
|
||||
ap.add_argument('index', metavar='INDEX_DIR', nargs='?',
|
||||
help='obikmer index directory (built with --with-counts)')
|
||||
ap.add_argument('--obikmer', default='obikmer',
|
||||
help='Path to obikmer binary')
|
||||
help='obiskim index directory (built with --with-counts)')
|
||||
ap.add_argument('--obiskim', default='obiskim',
|
||||
help='Path to obiskim binary')
|
||||
ap.add_argument('--species', default='')
|
||||
ap.add_argument('--strain', default='')
|
||||
ap.add_argument('--header', action='store_true',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the merged count index against all per-specimen reference sets.
|
||||
|
||||
Streams `obikmer dump` once on the merged index, accumulates per-specimen
|
||||
Streams `obiskim dump` once on the merged index, accumulates per-specimen
|
||||
kmer+count pairs from each column, then compares each against its reference .npz.
|
||||
|
||||
Output to stdout: one CSV row per specimen (same columns as verify_count.py)
|
||||
@@ -70,7 +70,7 @@ def stream_merged_dump(obikmer_bin: str, index_dir: str,
|
||||
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
print(f'ERROR: obikmer dump exited {proc.returncode}', file=sys.stderr)
|
||||
print(f'ERROR: obiskim dump exited {proc.returncode}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
return specimen_names, per_specimen
|
||||
@@ -156,7 +156,7 @@ def main() -> None:
|
||||
help='Merged count index directory')
|
||||
ap.add_argument('ref_dir', metavar='REF_DIR', nargs='?',
|
||||
help='Directory containing per-specimen .npz reference files')
|
||||
ap.add_argument('--obikmer', default='obikmer')
|
||||
ap.add_argument('--obiskim', default='obiskim')
|
||||
ap.add_argument('--header', action='store_true',
|
||||
help='Print CSV header and exit')
|
||||
ap.add_argument('--save-fn', metavar='DIR',
|
||||
|
||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
INDEX="${RUN_DIR}/global_index_count"
|
||||
REF_DIR="${RUN_DIR}/reference_index"
|
||||
STATS_DIR="${RUN_DIR}/stats/verify_merge_count"
|
||||
@@ -17,7 +17,7 @@ CURRENT="${STATS_DIR}/current.csv"
|
||||
"${PYTHON}" "${VERIFY_PY}" --header >"${CURRENT}"
|
||||
|
||||
"${PYTHON}" "${VERIFY_PY}" \
|
||||
--obikmer "${BINARY}" \
|
||||
--obiskim "${BINARY}" \
|
||||
"${INDEX}" "${REF_DIR}" \
|
||||
>>"${CURRENT}"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the merged presence index against all per-specimen reference sets.
|
||||
|
||||
Streams `obikmer dump` once on the merged index, accumulates per-specimen
|
||||
Streams `obiskim dump` once on the merged index, accumulates per-specimen
|
||||
kmer sets from each column, then compares each against its reference .npz.
|
||||
|
||||
Output to stdout: one CSV row per specimen (same columns as verify_presence.py)
|
||||
@@ -66,7 +66,7 @@ def stream_merged_dump(obikmer_bin: str, index_dir: str,
|
||||
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
print(f'ERROR: obikmer dump exited {proc.returncode}', file=sys.stderr)
|
||||
print(f'ERROR: obiskim dump exited {proc.returncode}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
return specimen_names, per_specimen
|
||||
@@ -130,7 +130,7 @@ def main() -> None:
|
||||
help='Merged presence index directory')
|
||||
ap.add_argument('ref_dir', metavar='REF_DIR', nargs='?',
|
||||
help='Directory containing per-specimen .npz reference files')
|
||||
ap.add_argument('--obikmer', default='obikmer')
|
||||
ap.add_argument('--obiskim', default='obiskim')
|
||||
ap.add_argument('--header', action='store_true',
|
||||
help='Print CSV header and exit')
|
||||
ap.add_argument('--save-fn', metavar='DIR',
|
||||
|
||||
@@ -3,7 +3,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
INDEX="${RUN_DIR}/global_index_presence"
|
||||
REF_DIR="${RUN_DIR}/reference_index"
|
||||
STATS_DIR="${RUN_DIR}/stats/verify_merge_presence"
|
||||
@@ -17,7 +17,7 @@ CURRENT="${STATS_DIR}/current.csv"
|
||||
"${PYTHON}" "${VERIFY_PY}" --header >"${CURRENT}"
|
||||
|
||||
"${PYTHON}" "${VERIFY_PY}" \
|
||||
--obikmer "${BINARY}" \
|
||||
--obiskim "${BINARY}" \
|
||||
"${INDEX}" "${REF_DIR}" \
|
||||
>>"${CURRENT}"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ set -euo pipefail
|
||||
SPECIMEN="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
PYTHON="${SCRIPT_DIR}/../.venv/bin/python3"
|
||||
VERIFY_PY="${SCRIPT_DIR}/verify_count.py"
|
||||
|
||||
@@ -24,7 +24,7 @@ mkdir -p "${STATS_DIR}"
|
||||
echo "[${SPECIMEN}] verifying count"
|
||||
|
||||
"${PYTHON}" "${VERIFY_PY}" \
|
||||
--obikmer "${BINARY}" \
|
||||
--obiskim "${BINARY}" \
|
||||
--species "${species}" \
|
||||
--strain "${strain}" \
|
||||
"${REF_NPZ}" "${INDEX_DIR}" \
|
||||
|
||||
@@ -7,7 +7,7 @@ set -euo pipefail
|
||||
SPECIMEN="$1"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUN_DIR="${SCRIPT_DIR}/run"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obikmer"
|
||||
BINARY="${SCRIPT_DIR}/../src/target/release/obiskim"
|
||||
PYTHON="${SCRIPT_DIR}/../.venv/bin/python3"
|
||||
VERIFY_PY="${SCRIPT_DIR}/verify_presence.py"
|
||||
|
||||
@@ -24,7 +24,7 @@ mkdir -p "${STATS_DIR}"
|
||||
echo "[${SPECIMEN}] verifying presence"
|
||||
|
||||
"${PYTHON}" "${VERIFY_PY}" \
|
||||
--obikmer "${BINARY}" \
|
||||
--obiskim "${BINARY}" \
|
||||
--species "${species}" \
|
||||
--strain "${strain}" \
|
||||
"${REF_NPZ}" "${INDEX_DIR}" \
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare an obikmer index against a reference kmer set (presence/absence).
|
||||
"""Compare an obiskim index against a reference kmer set (presence/absence).
|
||||
|
||||
Loads the reference .npz (sorted uint64 kmers built by build_reference.py),
|
||||
streams the output of `obikmer dump`, encodes each kmer string to uint64,
|
||||
streams the output of `obiskim dump`, encodes each kmer string to uint64,
|
||||
then reports false negatives and false positives using numpy set operations.
|
||||
|
||||
Output to stdout: one CSV row
|
||||
@@ -41,7 +41,7 @@ def decode_kmer(val: int, k: int) -> str:
|
||||
# ── dump parsing ──────────────────────────────────────────────────────────────
|
||||
|
||||
def load_index_kmers(obikmer_bin: str, index_dir: str) -> np.ndarray:
|
||||
"""Stream `obikmer dump` and return a sorted uint64 array of kmer integers."""
|
||||
"""Stream `obiskim dump` and return a sorted uint64 array of kmer integers."""
|
||||
cmd = [obikmer_bin, 'dump', index_dir]
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
text=True)
|
||||
@@ -55,7 +55,7 @@ def load_index_kmers(obikmer_bin: str, index_dir: str) -> np.ndarray:
|
||||
kmers.append(encode_kmer(kmer_str))
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
print(f'ERROR: obikmer dump exited {proc.returncode}', file=sys.stderr)
|
||||
print(f'ERROR: obiskim dump exited {proc.returncode}', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
arr = np.array(kmers, dtype=np.uint64)
|
||||
arr.sort()
|
||||
@@ -77,8 +77,8 @@ def main() -> None:
|
||||
ap = argparse.ArgumentParser(description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument('reference', metavar='REF_NPZ', nargs='?', help='Reference .npz file')
|
||||
ap.add_argument('index', metavar='INDEX_DIR', nargs='?', help='obikmer index directory')
|
||||
ap.add_argument('--obikmer', default='obikmer', help='Path to obikmer binary')
|
||||
ap.add_argument('index', metavar='INDEX_DIR', nargs='?', help='obiskim index directory')
|
||||
ap.add_argument('--obiskim', default='obiskim', help='Path to obiskim binary')
|
||||
ap.add_argument('--species', default='', help='Species label for CSV row')
|
||||
ap.add_argument('--strain', default='', help='Strain label for CSV row')
|
||||
ap.add_argument('--header', action='store_true', help='Print CSV header and exit')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare dense vs sparse obikmer query output for one specimen.
|
||||
"""Compare dense vs sparse obiskim query output for one specimen.
|
||||
|
||||
Both files are `obikmer query --count-missing` output: OBITools4-style
|
||||
Both files are `obiskim query --count-missing` output: OBITools4-style
|
||||
FASTA, one record per read — `>id {"kmer_count":N,"kmer_missing":M,
|
||||
"kmer_strict_matches":{"label":count,...}}`. Packing format (dense vs
|
||||
sparse presence matrix) must not change query results — only I/O access
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
site_name: obikmer — User Guide
|
||||
site_name: obiskim — User Guide
|
||||
docs_dir: UserDocMD
|
||||
site_dir: doc
|
||||
|
||||
|
||||
@@ -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)"
|
||||
|
||||
@@ -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//\//-}" .
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
Generated
+34
-34
@@ -1529,40 +1529,6 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "obikmer"
|
||||
version = "1.4.8"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"csv",
|
||||
"ndarray",
|
||||
"obifastwrite",
|
||||
"obikalgorithm",
|
||||
"obikdump",
|
||||
"obikfilter",
|
||||
"obikidxcache",
|
||||
"obikindex",
|
||||
"obikindexer",
|
||||
"obikmerge",
|
||||
"obikphylo",
|
||||
"obikquery",
|
||||
"obikrebuild",
|
||||
"obikrope",
|
||||
"obikselect",
|
||||
"obikseq",
|
||||
"obikstats",
|
||||
"obipipeline",
|
||||
"obiread",
|
||||
"obiskbuilder",
|
||||
"obisys",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"tikv-jemallocator",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "obikmerge"
|
||||
version = "0.1.0"
|
||||
@@ -1722,6 +1688,40 @@ dependencies = [
|
||||
"obiread",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "obiskim"
|
||||
version = "1.4.8"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"csv",
|
||||
"ndarray",
|
||||
"obifastwrite",
|
||||
"obikalgorithm",
|
||||
"obikdump",
|
||||
"obikfilter",
|
||||
"obikidxcache",
|
||||
"obikindex",
|
||||
"obikindexer",
|
||||
"obikmerge",
|
||||
"obikphylo",
|
||||
"obikquery",
|
||||
"obikrebuild",
|
||||
"obikrope",
|
||||
"obikselect",
|
||||
"obikseq",
|
||||
"obikstats",
|
||||
"obipipeline",
|
||||
"obiread",
|
||||
"obiskbuilder",
|
||||
"obisys",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"tikv-jemallocator",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "obiskio"
|
||||
version = "0.1.0"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["obikseq", "obiread", "obiskbuilder", "obifastwrite", "obikmer","obikrope","obipipeline", "obiskio","obidebruinj", "obicompactvec", "obisys", "obikindex", "obikindexer", "obikquery", "obikdump", "obikfilter", "obikselect", "obikrebuild", "obikmerge", "obikstats", "obikidxcache", "obitaxonomy", "obikentropy", "obikphylo", "obikalgorithm", "obiksession"]
|
||||
members = ["obikseq", "obiread", "obiskbuilder", "obifastwrite", "obiskim","obikrope","obipipeline", "obiskio","obidebruinj", "obicompactvec", "obisys", "obikindex", "obikindexer", "obikquery", "obikdump", "obikfilter", "obikselect", "obikrebuild", "obikmerge", "obikstats", "obikidxcache", "obitaxonomy", "obikentropy", "obikphylo", "obikalgorithm", "obiksession"]
|
||||
[profile.release]
|
||||
debug = 1
|
||||
@@ -67,7 +67,7 @@ impl PersistentBitMatrix {
|
||||
io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
format!(
|
||||
"no presence matrix and no layer_meta.json in {} — run 'obikmer upgrade'",
|
||||
"no presence matrix and no layer_meta.json in {} — run 'obiskim upgrade'",
|
||||
layer_dir.display()
|
||||
),
|
||||
)
|
||||
|
||||
@@ -411,7 +411,7 @@ impl PersistentIntMatrix {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::NotFound,
|
||||
format!(
|
||||
"no count matrix found in {} — run 'obikmer upgrade'",
|
||||
"no count matrix found in {} — run 'obiskim upgrade'",
|
||||
layer_dir.display()
|
||||
),
|
||||
))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! FASTA serialisation for obikmer sequence types.
|
||||
//! FASTA serialisation for obiskim sequence types.
|
||||
//!
|
||||
//! Three public functions cover the main output cases:
|
||||
//!
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//! sequence) — drives the window through [`EntropyTracker`] one base at a
|
||||
//! time, exactly like the streaming path, so a `theta` threshold means the
|
||||
//! same thing whether applied during index construction or after the fact
|
||||
//! (e.g. `obikmer filter`).
|
||||
//! (e.g. `obiskim filter`).
|
||||
|
||||
use obikseq::CanonicalKmer;
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ impl KmerFilter for GroupQuorumFilter {
|
||||
// ── Complexity filter (post-hoc, sequence-based) ──────────────────────────────
|
||||
|
||||
/// Reject k-mers with normalized entropy below `theta` — the same complexity
|
||||
/// metric `obikmer index`'s `--theta`/`--level-max` apply *during* superkmer
|
||||
/// metric `obiskim index`'s `--theta`/`--level-max` apply *during* superkmer
|
||||
/// construction (see [`obikentropy::KmerEntropy`]), applied here after the
|
||||
/// fact, to k-mers already committed to a built index.
|
||||
///
|
||||
|
||||
@@ -143,7 +143,7 @@ impl KmerIndex {
|
||||
self.lock.is_free_of_writer()
|
||||
}
|
||||
|
||||
/// Return `true` if `path` points to a valid obikmer index directory.
|
||||
/// Return `true` if `path` points to a valid obiskim index directory.
|
||||
///
|
||||
/// A directory is considered an index only when it contains an `index.meta`
|
||||
/// file. The absence of that file means the directory is not an index, even
|
||||
@@ -295,7 +295,7 @@ impl KmerIndex {
|
||||
/// `obikrebuild` — because `finalize_indexed` calls it internally as the
|
||||
/// shared tail of every index-building algorithm (`select`/`filter`/
|
||||
/// `merge`), and `obikindex` cannot depend on `obikrebuild` (wrong
|
||||
/// direction). Standalone re-packing (`obikmer2 pack`) calls this same
|
||||
/// direction). Standalone re-packing (`obiskim pack`) calls this same
|
||||
/// method directly.
|
||||
pub fn pack_matrices(&self, sparse: bool) -> OKIResult<()> {
|
||||
use obicompactvec::{
|
||||
|
||||
@@ -24,7 +24,7 @@ use obikalgorithm::Algorithm;
|
||||
// ── Pipeline plumbing, private to `run` ─────────────────────────────────────
|
||||
|
||||
/// Carrier enum for `obipipeline::make_pipe!`'s two-stage transform — local
|
||||
/// to this crate, not `obikmer`'s own `PipelineData` (which stays scoped to
|
||||
/// to this crate, not `obiskim`'s own `PipelineData` (which stays scoped to
|
||||
/// its other CLI commands): a library crate can't depend on the binary
|
||||
/// that consumes it, so this is a self-contained duplicate of the same
|
||||
/// shape, not a shared type.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Library-level phylogenetic functionality for `obikmer`, built as
|
||||
//! Library-level phylogenetic functionality for `obiskim`, built as
|
||||
//! extension traits over `obikindex`/`obikidxcache`'s foreign types — the
|
||||
//! `phylo` CLI command is a consumer of this crate, not the owner of this
|
||||
//! logic (see `DevDocMD/architecture/siblings.md`).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! Resolving CLI-level group/column definitions into a concrete
|
||||
//! `Vec<OutputCol>` — the logic `obikmer2`'s `select` command delegates to,
|
||||
//! `Vec<OutputCol>` — the logic `obiskim`'s `select` command delegates to,
|
||||
//! so the command itself stays argument parsing + the `Select` call. Named
|
||||
//! groups defined by a metadata predicate reuse `obikfilter::GenomeSelector`
|
||||
//! (the same predicate parser `filter`'s `--ingroup`/`--outgroup` use)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Sequence encoding and manipulation primitives for obikmer.
|
||||
//! Sequence encoding and manipulation primitives for obiskim.
|
||||
//!
|
||||
//! Provides [`superkmer::SuperKmer`]: a compact 2-bit–encoded DNA sequence
|
||||
//! with in-place reverse complement and canonical-form support.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Streaming sequence file reader for obikmer.
|
||||
//! Streaming sequence file reader for obiskim.
|
||||
//!
|
||||
//! Yields rope chunks from FASTA or FASTQ files, each ending
|
||||
//! on a complete sequence record boundary.
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "obikmer"
|
||||
name = "obiskim"
|
||||
version = "1.4.8"
|
||||
edition = "2024"
|
||||
license = "CECILL-2.1"
|
||||
repository = "https://forge.metabarcoding.org/obi/obiskim"
|
||||
|
||||
[[bin]]
|
||||
name = "obikmer"
|
||||
name = "obiskim"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -203,7 +203,7 @@ pub fn run(args: IndexArgs) {
|
||||
});
|
||||
} else if output.exists() {
|
||||
eprintln!(
|
||||
"error: {} exists but is not an obikmer index, it cannot be deleted",
|
||||
"error: {} exists but is not an obiskim index, it cannot be deleted",
|
||||
output.display()
|
||||
);
|
||||
std::process::exit(1);
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
||||
//! Command-line arguments of `obikmer phylo`.
|
||||
//! Command-line arguments of `obiskim phylo`.
|
||||
//!
|
||||
//! The options are split by theme into flattened groups, each carrying its own
|
||||
//! help heading and its own help texts (short for `-h`, long for `--help`).
|
||||
@@ -20,21 +20,21 @@ pub use outputs::{AlignArgs, CostsArgs};
|
||||
pub use sampling::SamplingArgs;
|
||||
pub use select::{AnnexArgs, SelectArgs};
|
||||
|
||||
/// Text shown at the end of `obikmer phylo --help`.
|
||||
/// Text shown at the end of `obiskim phylo --help`.
|
||||
pub const WORKFLOW_HELP: &str = "\
|
||||
Typical workflows
|
||||
|
||||
Compare genome-wide k-mer content and infer a Neighbor-Joining tree:
|
||||
obikmer phylo INDEX --distance jaccard --nj -o out
|
||||
obiskim phylo INDEX --distance jaccard --nj -o out
|
||||
|
||||
Compute SNP-based distances and infer a Neighbor-Joining tree:
|
||||
obikmer phylo INDEX --distance snp-k2p --n-sites 200000 --nj -o out
|
||||
obiskim phylo INDEX --distance snp-k2p --n-sites 200000 --nj -o out
|
||||
|
||||
Generate a SNP pseudo-alignment:
|
||||
obikmer phylo INDEX --pseudo-alignment --n-sites 200000 -o out
|
||||
obiskim phylo INDEX --pseudo-alignment --n-sites 200000 -o out
|
||||
|
||||
Prepare a maximum-likelihood analysis for IQ-TREE:
|
||||
obikmer phylo INDEX --iqtree --n-sites 200000 -o out
|
||||
obiskim phylo INDEX --iqtree --n-sites 200000 -o out
|
||||
|
||||
Option dependencies
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -57,7 +57,7 @@ pub(super) fn write_sankoff_tnt(
|
||||
|
||||
writeln!(
|
||||
f,
|
||||
"'obikmer central-position SNP families, calibrated Sankoff 16-state encoding'"
|
||||
"'obiskim central-position SNP families, calibrated Sankoff 16-state encoding'"
|
||||
)
|
||||
.unwrap();
|
||||
writeln!(f, "{n_sites} {}", kept_labels.len()).unwrap();
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user