refactor: rename project from obikmer to obiskim
Update the project name, binary, and all associated documentation, scripts, and configuration files from `obikmer` to `obiskim`. This change ensures consistency across the codebase, including lock files, VCF outputs, benchmark targets, and user-facing documentation. - Update `mkdocs.yml` and `.crate-kit/VERSION` to reflect the new project name and version 0.3.4. - Rename all references in `DevDocMD/` documentation, including architecture, implementation, and theory sections, from `obikmer` to `obiskim`. - Update `UserDocMD/` files to use `.obiskim.lock` and `.obiskim.gate` for lock files, and update VCF contig IDs to `obiskim_<partition>_<layer>`. - Modify `benchmark/` scripts and Makefiles to use `obiskim` binary names and `obiskim_dist/` directories for distribution and comparison tasks. - Update `prompts/` files to reference the `obiskim` repository and commands instead of `obikmer`. - Rename temporary directories in `scripts/` smoke tests from `obikmer_*` to `obiskim_*`. - Update `src/obikphylo/src/siblings/algorithms/alignment_vcf.rs` to use `obiskim` in VCF source identifiers and assertions. - Update `src/obiskim/Cargo.toml` version to 1.4.9 and update `src/obiskim/src/cmd/phylo/args/outputs.rs` documentation. - Update `src/obisys/src/lock.rs` to use `.obiskim.lock`, `.obiskim.gate`, and `.obiskim.promote` file names.
This commit is contained in:
1 parent
42d5b881ec
commit
917cb26186
48 files changed
+236
-209
No files matched your search
@@ -2,8 +2,8 @@
|
||||
|
||||
`benchmark/Makefile` exercises indexing, merge, and phylo distance
|
||||
reconstruction against simulated bacterial genomes. It now also covers
|
||||
`obikmer query` — the read-matching path — and the sparse packed
|
||||
presence-matrix format (`obikmer pack --sparse`), previously untested by
|
||||
`obiskim query` — the read-matching path — and the sparse packed
|
||||
presence-matrix format (`obiskim pack --sparse`), previously untested by
|
||||
this pipeline.
|
||||
|
||||
## Motivation
|
||||
@@ -42,7 +42,7 @@ without duplicating the exhaustive per-specimen coverage
|
||||
## Sparse global index
|
||||
|
||||
`global_index_presence_sparse/` is built by `pack_sparse.sh`: copy
|
||||
`global_index_presence/` wholesale, then `obikmer pack --sparse` in place.
|
||||
`global_index_presence/` wholesale, then `obiskim pack --sparse` in place.
|
||||
This works directly because `merge`'s pack stage (`merge.rs:252`,
|
||||
`pack_matrices(false)`) keeps the per-genome column files on disk after
|
||||
dense-packing — `pack_sparse_bit_matrix` (`obicompactvec/src/bitmatrix/sparse.rs:447`)
|
||||
@@ -52,7 +52,7 @@ afterward. No separate merge run needed.
|
||||
|
||||
## Query runs
|
||||
|
||||
`query_one.sh dense|sparse SPECIMEN` runs `obikmer query --count-missing`
|
||||
`query_one.sh dense|sparse SPECIMEN` runs `obiskim query --count-missing`
|
||||
against `global_index_presence` or `global_index_presence_sparse`, output
|
||||
gzipped to `query_{dense,sparse}/SPECIMEN.fasta.gz`, Reporter wall/RSS
|
||||
captured to `stats/query_{dense,sparse}/SPECIMEN.stats` (same
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
- `obikindex/src/layer/mphf_layer.rs` — build_approx_evidence(dir, b, z), find_approx()
|
||||
- `obikindex/src/layer/meta.rs` — EvidenceKind::Approx { b, z }, LayerMeta
|
||||
- `obikindex/src/reindex.rs` — KmerIndex::reindex(), conversion exact↔approx en place
|
||||
- `obikmer/src/cmd/reindex.rs` — CLI reindex, options --approx, -z, --evidence-bits, --fp, --block-size
|
||||
- `obikmer/src/cmd/index.rs` — resolve_approx_params(), options --approx, -z, --evidence-bits, --fp
|
||||
- `obikmer/src/cmd/estimate.rs` — commande estimate (dry-run des paramètres)
|
||||
- `obiskim/src/cmd/reindex.rs` — CLI reindex, options --approx, -z, --evidence-bits, --fp, --block-size
|
||||
- `obiskim/src/cmd/index.rs` — resolve_approx_params(), options --approx, -z, --evidence-bits, --fp
|
||||
- `obiskim/src/cmd/estimate.rs` — commande estimate (dry-run des paramètres)
|
||||
|
||||
## Notes
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ Keep k-mers specific to *Betula nana* — present in at least 2 *B. nana* genome
|
||||
and absent from every other genome in the index:
|
||||
|
||||
```sh
|
||||
obikmer filter src --output dst \
|
||||
obiskim filter src --output dst \
|
||||
--ingroup "species=Betula_nana" \
|
||||
--outgroup "*" \
|
||||
--min-count 2 \
|
||||
@@ -217,7 +217,7 @@ Keep k-mers found in at least 2 *Betula nana* genomes and absent from all
|
||||
other *Betula*:
|
||||
|
||||
```sh
|
||||
obikmer filter src --output dst \
|
||||
obiskim filter src --output dst \
|
||||
--ingroup "species=Betula_nana" \
|
||||
--outgroup "genus=Betula" \
|
||||
--min-count 2 \
|
||||
@@ -228,7 +228,7 @@ Use taxonomic paths — keep k-mers present in ≥ 50 % of the *Betula* clade
|
||||
and in fewer than 10 % of everything outside *Betulaceae*:
|
||||
|
||||
```sh
|
||||
obikmer filter src --output dst \
|
||||
obiskim filter src --output dst \
|
||||
--ingroup "taxon~/Betulaceae/Betula" \
|
||||
--outgroup "taxon!~/Betulaceae" \
|
||||
--min-frac 0.5 \
|
||||
@@ -238,7 +238,7 @@ obikmer filter src --output dst \
|
||||
Multiple outgroup predicates (OR): exclude k-mers present in *Alnus* or *Carpinus*:
|
||||
|
||||
```sh
|
||||
obikmer filter src --output dst \
|
||||
obiskim filter src --output dst \
|
||||
--ingroup "genus=Betula" \
|
||||
--outgroup "genus=Alnus" \
|
||||
--outgroup "genus=Carpinus" \
|
||||
@@ -249,7 +249,7 @@ Noise-tolerant core — keep k-mers present in *all but one* ingroup genome
|
||||
(`-1` = `n−1`) and absent from *all but one* of the outgroup:
|
||||
|
||||
```sh
|
||||
obikmer filter src --output dst \
|
||||
obiskim filter src --output dst \
|
||||
--ingroup "genus=Betula" \
|
||||
--outgroup "*" \
|
||||
--min-count -1 \
|
||||
@@ -259,7 +259,7 @@ obikmer filter src --output dst \
|
||||
To dump only k-mers specific to *Betula nana*:
|
||||
|
||||
```sh
|
||||
obikmer dump myindex \
|
||||
obiskim dump myindex \
|
||||
--ingroup "species=Betula_nana" \
|
||||
--outgroup "*" \
|
||||
--min-count 1 \
|
||||
@@ -269,7 +269,7 @@ obikmer dump myindex \
|
||||
To enumerate unitigs of the *Betula*-specific subgraph:
|
||||
|
||||
```sh
|
||||
obikmer unitig myindex \
|
||||
obiskim unitig myindex \
|
||||
--ingroup "genus=Betula" \
|
||||
--outgroup "*" \
|
||||
--min-count 2 \
|
||||
@@ -285,8 +285,8 @@ Iteration terminates immediately — subsequent partitions and layers are not sc
|
||||
Useful for quick inspection of large indexes without loading the entire dataset.
|
||||
|
||||
```sh
|
||||
obikmer dump myindex --head 100
|
||||
obikmer dump myindex --head 20 --ingroup "species=Betula_nana" --min-count 1
|
||||
obiskim dump myindex --head 100
|
||||
obiskim dump myindex --head 20 --ingroup "species=Betula_nana" --min-count 1
|
||||
```
|
||||
|
||||
### `phylo --presence-threshold N`
|
||||
@@ -296,7 +296,7 @@ This option is independent of the `--presence-threshold` used in filtering.
|
||||
|
||||
```sh
|
||||
# Jaccard treating kmers with count ≥ 2 as present
|
||||
obikmer phylo myindex --metric jaccard --presence-threshold 2
|
||||
obiskim phylo myindex --metric jaccard --presence-threshold 2
|
||||
```
|
||||
|
||||
This parameter has no effect on presence/absence indexes (where values are already 0/1) or on metrics other than Jaccard.
|
||||
@@ -309,7 +309,7 @@ This parameter has no effect on presence/absence indexes (where values are alrea
|
||||
once before any iteration; each k-mer row evaluation is a simple index
|
||||
lookup and counter.
|
||||
|
||||
- **`obikmer::cmd::predicate::FilterArgs`** — shared `clap` argument group
|
||||
- **`obiskim::cmd::predicate::FilterArgs`** — shared `clap` argument group
|
||||
embedded via `#[command(flatten)]` in `FilterArgs`, `DumpArgs`, and
|
||||
`UnitigArgs`. `FilterArgs::build_filters()` returns a ready-to-use filter
|
||||
list.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Purpose
|
||||
|
||||
`obikmer merge` combines multiple existing kmer indexes into a single index. The result contains all kmers from all sources, with per-genome presence/absence or count data for every genome across every layer.
|
||||
`obiskim merge` combines multiple existing kmer indexes into a single index. The result contains all kmers from all sources, with per-genome presence/absence or count data for every genome across every layer.
|
||||
|
||||
---
|
||||
|
||||
@@ -64,7 +64,7 @@ Check all sources against the constraints above. Abort on any mismatch.
|
||||
|
||||
### 2. Bootstrap output from the base source
|
||||
|
||||
The base is chosen by `choose_base` (`merge.rs`): the source with the largest total `unitigs.bin` size (restricted to approximate-evidence sources when the output must be approximate). It is not necessarily `sources[0]`, and the genome columns follow the base first. Because `obikmer index` is not byte-reproducible (unitig segmentation varies), two near-equal sources can swap roles between runs. Its directory is copied to `output` (hard links for files `merge_partition` never rewrites, see below). Immediately after the copy:
|
||||
The base is chosen by `choose_base` (`merge.rs`): the source with the largest total `unitigs.bin` size (restricted to approximate-evidence sources when the output must be approximate). It is not necessarily `sources[0]`, and the genome columns follow the base first. Because `obiskim index` is not byte-reproducible (unitig segmentation varies), two near-equal sources can swap roles between runs. Its directory is copied to `output` (hard links for files `merge_partition` never rewrites, see below). Immediately after the copy:
|
||||
|
||||
- `index.meta` is rewritten with the final genome list (all sources, possibly renamed) and the effective evidence kind.
|
||||
- In `Presence` mode, any `counts/` directories inherited from source_0 are removed.
|
||||
@@ -185,7 +185,7 @@ index.meta ← complete genome list + evidence kind written at
|
||||
|
||||
## Known issue (not yet fixed, 2026-08-28)
|
||||
|
||||
Merging an index against itself — literally the same directory passed twice as separate source arguments (e.g. `obikmer merge -o out IDX IDX --rename-duplicates`) — panics deep in the MPHF's rank-select structure (`common_traits::select_in_word`, `assertion failed: rank < self.count_ones()`), inside `MphfLayer::find` called from `merge_partition`'s "is this source kmer already in dst" check against the bootstrap-copied `dst_layers`. Root cause not identified; ruled out so far:
|
||||
Merging an index against itself — literally the same directory passed twice as separate source arguments (e.g. `obiskim merge -o out IDX IDX --rename-duplicates`) — panics deep in the MPHF's rank-select structure (`common_traits::select_in_word`, `assertion failed: rank < self.count_ones()`), inside `MphfLayer::find` called from `merge_partition`'s "is this source kmer already in dst" check against the bootstrap-copied `dst_layers`. Root cause not identified; ruled out so far:
|
||||
|
||||
- **Not an empty-new-layer issue**: a source contributing zero new kmers (verified both as the sole additional source and as a third, fully-redundant source in a 3-way merge) is handled correctly — no layer is created for it, no crash, exit 0.
|
||||
- **Not caused by the hard-link change above**: verified via checksum that a normal (two distinct sources) merge leaves every source file byte-identical.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Problem observed
|
||||
|
||||
Running `obikmer merge` over 109 indexes (108 sources + 1 bootstrap) on a 192-core machine
|
||||
Running `obiskim merge` over 109 indexes (108 sources + 1 bootstrap) on a 192-core machine
|
||||
produces a fatal OOM during the `merge_partitions` stage:
|
||||
|
||||
```
|
||||
@@ -58,7 +58,7 @@ Plausible for the largest partition of 108 Salix/Betula sources (~450 Mbp each).
|
||||
|
||||
## Partition size distribution
|
||||
|
||||
`obikmer utils --partition-stats` measures the sum of `unitigs.bin` file sizes
|
||||
`obiskim utils --partition-stats` measures the sum of `unitigs.bin` file sizes
|
||||
per partition across all source indexes (pure `stat()` syscalls, negligible cost).
|
||||
|
||||
Observed on a 9-genome pilot (256 partitions):
|
||||
|
||||
@@ -38,4 +38,4 @@ Merge discovers values **column by column** (source by source), in **random slot
|
||||
## Related findings
|
||||
|
||||
- The module header of `bitmatrix/sparse.rs` says "not used by any production code path yet". This is stale: `finalize_indexed` packs to sparse by default.
|
||||
- The new layer of a merge is not byte-reproducible run to run: unitig segmentation varies, so the MPHF, evidence and matrix row order vary with it (measured 2026-11-17, `layer_1/*` differs in all 256 partitions; `layer_0` and metadata are identical). `obikmer index` shows the same behaviour. Merge oracles therefore compare sorted dumps, not file hashes. Where the non-determinism originates (parallel graph fill or unitig walk) is not established.
|
||||
- The new layer of a merge is not byte-reproducible run to run: unitig segmentation varies, so the MPHF, evidence and matrix row order vary with it (measured 2026-11-17, `layer_1/*` differs in all 256 partitions; `layer_0` and metadata are identical). `obiskim index` shows the same behaviour. Merge oracles therefore compare sorted dumps, not file hashes. Where the non-determinism originates (parallel graph fill or unitig walk) is not established.
|
||||
@@ -112,8 +112,8 @@ About −5 % wall and −5.5 % CPU, ranges non-overlapping **[measured]**. All o
|
||||
|
||||
Prerequisites: the simulated reads (`benchmark/run/simulated_data/`) and query reads (`benchmark/run/query_data/`) produced by `gmake simulate simulate_query`; macOS BSD `time -l` and `md5 -q` (the script uses both), Python 3.
|
||||
|
||||
1. Build the binary to measure and **copy it** under a name that identifies it (cargo overwrites `target/release/obikmer`): `cp src/target/release/obikmer benchmark/run/bench_mphf/obikmer_<label>`.
|
||||
2. `BINARY=$PWD/run/bench_mphf/obikmer_<label> benchmark/bench_mphf.sh <label>` (from `benchmark/`; `REPS=3` by default, `CPU_MAX=n` to restrict cores). The first call builds the shared data set in `run/bench_mphf/data/` with that binary (≈ 2 min); keep it for every label — the on-disk format must not differ between the binaries compared, otherwise delete `data/` and rebuild.
|
||||
1. Build the binary to measure and **copy it** under a name that identifies it (cargo overwrites `target/release/obiskim`): `cp src/target/release/obiskim benchmark/run/bench_mphf/obiskim_<label>`.
|
||||
2. `BINARY=$PWD/run/bench_mphf/obiskim_<label> benchmark/bench_mphf.sh <label>` (from `benchmark/`; `REPS=3` by default, `CPU_MAX=n` to restrict cores). The first call builds the shared data set in `run/bench_mphf/data/` with that binary (≈ 2 min); keep it for every label — the on-disk format must not differ between the binaries compared, otherwise delete `data/` and rebuild.
|
||||
3. Output: `run/bench_mphf/<label>/results.csv` (wall and peak RSS per step and repetition, plus one row `step:stage` per Reporter stage) and `checksums.txt`.
|
||||
4. Compare: `python3 benchmark/summarize_bench.py <ref_label> <new_label>` (medians and ratio) and `diff run/bench_mphf/<ref>/checksums.txt run/bench_mphf/<new>/checksums.txt` — **any difference is a bug**, not a performance matter.
|
||||
5. A ratio is only a candidate effect. Check the spread by running the **same** binary twice under two labels (the script's own noise floor was ±10–40 % per step on a loaded laptop), or confirm with interleaved A/B runs of the single command (alternate the two binaries, ≥ 8 runs, compare ranges of wall and user CPU from `/usr/bin/time -l`).
|
||||
@@ -214,7 +214,7 @@ Tests: `cargo test --workspace` green; `scripts/smoke_test_index.sh` PASS; `benc
|
||||
|
||||
Follow-up of §14 (search for the same family of problems: file content handled inefficiently at open). Static search over `src/` for `fs::read`, `read_to_end`, `load_full`, `from_reader`, bare `File` readers and mmap `to_vec`: every persistent structure of `obicompactvec`, `obikindex` and the `obikphylo` annexes is already mmapped; the two real findings were *unbuffered* readers.
|
||||
|
||||
**1. `IndexMeta::read_full` (`obikindex/src/index/meta.rs`)** passed a bare `File` to `serde_json::from_reader`, which issues **one `read` syscall per byte**. `index.meta` of the 91-genome index is 20 KB and is read afresh by every `state()`/`genomes()` call (stateless design, §obikindex audit), so each call cost ≈ 0.35 s here (macOS). Profile of `obikmer dump --head 10` (`sample`): ≈ 20 000 samples in `read`, called from `Bytes<File>::next` ← `serde_json` ← `IndexMeta`. Fix: `fs::read` then `serde_json::from_slice`. **`dump --head 10`: 9.0–10.0 s (91–102 s of system CPU) → 0.16–0.84 s**; the same change applies to `SKFileMeta::read` (`obiskio/src/meta.rs`, per-superkmer-file sidecars).
|
||||
**1. `IndexMeta::read_full` (`obikindex/src/index/meta.rs`)** passed a bare `File` to `serde_json::from_reader`, which issues **one `read` syscall per byte**. `index.meta` of the 91-genome index is 20 KB and is read afresh by every `state()`/`genomes()` call (stateless design, §obikindex audit), so each call cost ≈ 0.35 s here (macOS). Profile of `obiskim dump --head 10` (`sample`): ≈ 20 000 samples in `read`, called from `Bytes<File>::next` ← `serde_json` ← `IndexMeta`. Fix: `fs::read` then `serde_json::from_slice`. **`dump --head 10`: 9.0–10.0 s (91–102 s of system CPU) → 0.16–0.84 s**; the same change applies to `SKFileMeta::read` (`obiskio/src/meta.rs`, per-superkmer-file sidecars).
|
||||
|
||||
**2. `SKFileReader::open` (`obiskio/src/reader.rs`)**: for an uncompressed file `niffler::get_reader` returns the sniffed bytes chained to the bare `File`, and `read_superkmer` reads each field with its own small `read_exact`. Fix: wrap the file in a 64 KiB `BufReader` before `niffler`. Effect on `index` (E. coli, 4 interleaved runs each): `count_kmer` 0.51–0.56 s → 0.42–0.50 s (≈ −12 %), total wall unchanged (≈ 1.95 s). Small, low risk, kept.
|
||||
|
||||
@@ -226,7 +226,7 @@ Tests: `cargo test --workspace` 549 passed / 0 failed; `scripts/smoke_test_index
|
||||
|
||||
## 16. Profile of `index` on E. coli reads (2026-10-15)
|
||||
|
||||
`sample` (1 ms stacks) of `obikmer index` on the E. coli K-12 simulated reads (2 × 15x, 16 threads, one run; the `index` stage lasted 2.4 s under the sampler vs ≈ 0.9 s normally, so proportions are approximate). Stage walls: scatter 0.40 s, dereplicate 0.14, count_kmer 0.60, index 2.36.
|
||||
`sample` (1 ms stacks) of `obiskim index` on the E. coli K-12 simulated reads (2 × 15x, 16 threads, one run; the `index` stage lasted 2.4 s under the sampler vs ≈ 0.9 s normally, so proportions are approximate). Stage walls: scatter 0.40 s, dereplicate 0.14, count_kmer 0.60, index 2.36.
|
||||
|
||||
**Threads are mostly idle.** Of ≈ 30 800 thread-samples: 24 900 blocked or yielding, 5 900 active. The ≈ 9 s of *system* CPU per run (§15) is `swtch_pri` (`sched_yield`) — 4 550 samples: ≈ 70 % rayon workers spinning for work (`WorkerThread` wait loop), ≈ 28 % `crossbeam` bounded-channel send/recv spinning, the rest in `obidebruinj` thread-locals. It is waiting, not I/O: no `read` samples remain. It costs no wall time on an otherwise idle machine, but burns CPU (visible in `user + sys` accounting and on a shared 192-core machine).
|
||||
|
||||
@@ -365,4 +365,4 @@ Side effect: `find_strict` was the only reader of the `unitigs` handle that `Hyb
|
||||
|
||||
Checks after the removal: `cargo build --release` without warnings, `cargo test --workspace` 555 passed / 0 failed, `scripts/smoke_test_index.sh` PASS.
|
||||
|
||||
Scratch artifacts of this work were deleted: the intermediate binaries, the two skim indexes (`skim_p4`, `skim_p16`) and the shared data set `benchmark/run/bench_mphf/data` (rebuilt automatically, ≈ 2 min, by the next `bench_mphf.sh`). Kept in `benchmark/run/bench_mphf/`: the original binary `obikmer_baseline` (reference for A/B runs) and the per-label results and checksums (18 MB in all). The 91-genome index converted to the current MPHF format (`/Users/coissac/travail/obiskim/data/phyloalps/bench_mphf/phyloskims_sal_vac_sav_v2`, with its `index.meta` patched, original `index.meta.before_state_fix` beside it) was left in place.
|
||||
Scratch artifacts of this work were deleted: the intermediate binaries, the two skim indexes (`skim_p4`, `skim_p16`) and the shared data set `benchmark/run/bench_mphf/data` (rebuilt automatically, ≈ 2 min, by the next `bench_mphf.sh`). Kept in `benchmark/run/bench_mphf/`: the original binary `obiskim_baseline` (reference for A/B runs) and the per-label results and checksums (18 MB in all). The 91-genome index converted to the current MPHF format (`/Users/coissac/travail/obiskim/data/phyloalps/bench_mphf/phyloskims_sal_vac_sav_v2`, with its `index.meta` patched, original `index.meta.before_state_fix` beside it) was left in place.
|
||||
@@ -104,7 +104,7 @@ make_pipe! {
|
||||
}
|
||||
```
|
||||
|
||||
Two pipes compose with `.then(other)`. Apply to an iterator with `.apply(iter, n_workers, capacity)` to get a `PipeIter<Out>` — an iterator over the pipeline output, backed by a background `WorkerPool`. The scatter step in `obikmer` uses `make_pipe!` and `.apply()` rather than the full `make_pipeline!` / `WorkerPool` pattern.
|
||||
Two pipes compose with `.then(other)`. Apply to an iterator with `.apply(iter, n_workers, capacity)` to get a `PipeIter<Out>` — an iterator over the pipeline output, backed by a background `WorkerPool`. The scatter step in `obiskim` uses `make_pipe!` and `.apply()` rather than the full `make_pipeline!` / `WorkerPool` pattern.
|
||||
|
||||
## Scheduler architecture
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ needed — `obikindex → obikpartitionner` stays the same direction as before.
|
||||
conversation as a side effect of investigating the false "independent
|
||||
lifecycle" claim.
|
||||
- `KmerIndex::partition()`/`partition_mut()` are gone; `scatter()`
|
||||
(`obikmer`) and any write-side code get a transient `PartitionRouter` via
|
||||
(`obiskim`) and any write-side code get a transient `PartitionRouter` via
|
||||
`KmerIndex::partition_router()`.
|
||||
- A real bug caught by the test suite during this move:
|
||||
`PartitionRouter::open` initially defaulted to `closed: true` (inherited
|
||||
@@ -423,7 +423,7 @@ control (tests, `obikphylo`'s test harness) still get it, `run` is a
|
||||
convenience layered on top, not the only way in.
|
||||
|
||||
`run` absorbs the entire body of what used to be the free function
|
||||
`obikmer::steps::scatter` (now deleted, along with the `steps` module
|
||||
`obiskim::steps::scatter` (now deleted, along with the `steps` module
|
||||
entirely) — the `obipipeline::make_pipe!` two-stage pipeline
|
||||
(file→pages→superkmers), throttling, per-file logging. What changed:
|
||||
- Every `ensure_writer(partition)` call now does `Layer::create(&layer0_dir)`
|
||||
@@ -442,7 +442,7 @@ entirely) — the `obipipeline::make_pipe!` two-stage pipeline
|
||||
workspace suite exercises the real CLI's file-reading `scatter` path
|
||||
end-to-end (`obikphylo`'s test harness and `obikpartitionner`'s own
|
||||
tests both call `write_batch` directly, bypassing `run`/file discovery
|
||||
entirely), so the whole suite stayed green while `obikmer index` on
|
||||
entirely), so the whole suite stayed green while `obiskim index` on
|
||||
real FASTA silently indexed 0 kmers. Found by running the actual CLI
|
||||
against a small FASTA and noticing `count.json`'s `f0` (870, correct)
|
||||
didn't match "0 total kmers indexed" at the final stage. Fixed by
|
||||
@@ -581,7 +581,7 @@ Full workspace suite green (`cargo check --workspace --all-targets` +
|
||||
`cargo test --workspace`, exit code 0), plus an end-to-end CLI smoke test
|
||||
against real FASTA data (scatter → dereplicate → count → index-build →
|
||||
query, same numbers as (3)'s smoke test: 870 kmers) — required this time
|
||||
too, per (3)'s own lesson: no test in the suite exercises `obikmer index`'s
|
||||
too, per (3)'s own lesson: no test in the suite exercises `obiskim index`'s
|
||||
real file-driven path.
|
||||
|
||||
Still not done: `count_kmer`/`build_layers` staying where they are, the
|
||||
@@ -842,7 +842,7 @@ equivalent on `Dereplicator`, which has no setters at all) — a real,
|
||||
already-present parameter (`keep_intermediate` at the CLI), not a
|
||||
speculative addition.
|
||||
|
||||
`count_kmer`'s three former callers (`obikmer::cmd::index`, `obikphylo`'s
|
||||
`count_kmer`'s three former callers (`obiskim::cmd::index`, `obikphylo`'s
|
||||
test harness, `obikindexer::algorithms::partitionner`'s own
|
||||
`pipeline_counts` test helper) all updated to `Counter::new(&idx).
|
||||
run(...)` — the last one simplified further: it used to read back
|
||||
@@ -998,7 +998,7 @@ same reason.
|
||||
index's kmer sequences — read by `rebuild_layer.rs` and others, well
|
||||
beyond construction — see [[project_unitigs_always_kept]]),
|
||||
`pack_matrices` (re-runnable maintenance on an already-finished index
|
||||
via `obikmer pack`, not just a pipeline step), `upgrade_layer_meta`
|
||||
via `obiskim pack`, not just a pipeline step), `upgrade_layer_meta`
|
||||
(migration, runnable on any existing index at any time).
|
||||
|
||||
### The general pattern (not obikindexer-specific)
|
||||
@@ -1117,7 +1117,7 @@ what was wanted.
|
||||
|
||||
**A real design decision made while wiring callers up, not a mechanical
|
||||
rename**: `PrivateBuilder` being genuinely `pub(crate)` to `obikindexer`
|
||||
means `obikmer::cmd::index` (a different crate) can no longer call
|
||||
means `obiskim::cmd::index` (a different crate) can no longer call
|
||||
`mark_scattered`/`mark_counted`/`mark_indexed`/`write_spectrum` directly —
|
||||
it never could have, once privacy was real rather than aspirational. Each
|
||||
algorithm now marks its own completion as part of `run()`/`close()`
|
||||
@@ -1200,7 +1200,7 @@ traits, two crates, two different reasons, not a contradiction.
|
||||
internal caller of these four methods needs the trait imported now that
|
||||
they're no longer inherent — `merge.rs`, `select.rs`, `rebuild.rs`,
|
||||
`reindex.rs` (`use crate::index::builder::IndexBuilder;`) and, externally,
|
||||
`obikmer::cmd::index::mod` (`use obikindex::IndexBuilder;`, for the three
|
||||
`obiskim::cmd::index::mod` (`use obikindex::IndexBuilder;`, for the three
|
||||
`idx.state() < IndexState::X` resumability checks). Call syntax at every
|
||||
site is unchanged (`KmerIndex::create_skeleton(...)`,
|
||||
`self.state()`) — only trait-in-scope requirements are new, which is
|
||||
@@ -1210,7 +1210,7 @@ itself.
|
||||
Verification went one step further than (9): beyond
|
||||
`cargo check --workspace --all-targets` + `cargo test --workspace` +
|
||||
`scripts/smoke_test_index.sh` (all green, 870 kmers again), ran
|
||||
`obikmer merge` end to end on two freshly built indexes (exercises
|
||||
`obiskim merge` end to end on two freshly built indexes (exercises
|
||||
`clear_output_for_create`/`finalize_indexed` directly, the two methods
|
||||
`scripts/smoke_test_index.sh` itself never touches) — exit 0, `pack`
|
||||
stage completed. Test suite alone would not have caught a regression
|
||||
@@ -1310,7 +1310,7 @@ field mutation from outside `IndexMeta`). Fixed across:
|
||||
`entropy.rs`/`sankoff_bundle.rs`/`stats.rs`/`tests.rs` — all had
|
||||
`self.meta().genomes.len()`-shaped reads, mechanically fixed to
|
||||
`.genomes().map_err(OKIError::Io)?.len()` (tests: `.unwrap()`).
|
||||
- `obikmer::cmd::*`: `annotate` (rewrote its rename path to load genomes
|
||||
- `obiskim::cmd::*`: `annotate` (rewrote its rename path to load genomes
|
||||
once, mutate the in-memory `Vec`, then `idx.meta().set_genomes(...)`
|
||||
instead of `meta_mut()`), `filter`/`pack`/`dump`/`unitig`/`merge`/`select`/
|
||||
`phylo` (fetch-once-then-use pattern for genome counts/labels),
|
||||
@@ -1442,7 +1442,7 @@ forcing callers' progress closures to `move`-capture (and therefore clone
|
||||
or `Arc`-wrap) local state like `TracedBar`/EMA-rate accumulators that
|
||||
they'd otherwise want to keep using by reference after `run()` returns.
|
||||
|
||||
**Why a new crate, not a submodule of `obikindexer`**: `obikmer::cmd::
|
||||
**Why a new crate, not a submodule of `obikindexer`**: `obiskim::cmd::
|
||||
index::mod` and `obikphylo`'s own test helpers both need to call `.run()`
|
||||
on these algorithms, so the trait has to be reachable from outside
|
||||
`obikindexer` — putting it in `obikindexer` itself would work file-wise
|
||||
@@ -1450,16 +1450,16 @@ but conflates "the trait every algorithm implements" with "one crate's
|
||||
particular four implementations of it", the same reasoning that already
|
||||
separated `obikindex` (data model) from `obikindexer` (algorithms
|
||||
operating on it). `obikalgorithm` has **no dependencies at all** (see
|
||||
above); `obikindexer`, `obikmer`, and `obikphylo` (dev-dependency, for
|
||||
above); `obikindexer`, `obiskim`, and `obikphylo` (dev-dependency, for
|
||||
its test helper) all depend on it.
|
||||
|
||||
**Blast radius**: `obikindexer`'s four algorithm modules (struct field +
|
||||
setter + trait impl each); `obikmer::cmd::index::mod` (three call sites:
|
||||
setter + trait impl each); `obiskim::cmd::index::mod` (three call sites:
|
||||
`.on_progress(cb)` before `.run()`, unqualified now that the trait is in
|
||||
scope); `obikindexer::algorithms::partitionner::tests` and `obikphylo::
|
||||
siblings::tests` (both had direct `.run(None::<fn(Progress)>)`-shaped
|
||||
calls needing the same treatment). New `obikalgorithm` crate registered
|
||||
in the workspace `Cargo.toml`, depended on by `obikindexer`/`obikmer`
|
||||
in the workspace `Cargo.toml`, depended on by `obikindexer`/`obiskim`
|
||||
(regular) and `obikphylo` (dev).
|
||||
|
||||
**Verification**: `cargo check --workspace --all-targets` and `cargo test
|
||||
@@ -1511,7 +1511,7 @@ auto-detection" turned up three unrelated implementations:
|
||||
| `Mat` (now deleted; superseded by `obilayeredmap::Layer`) | `obikphylo::siblings::cache` | one layer, format resolved per instance from an enum of 3 `Layer<D>` variants | yes, via `PartitionCache` |
|
||||
| `QueryLayer` (unchanged, still current) | `obikindex::query_layer` (moved crates since this was written — see "Major restructuring") | one layer, `(MphfLayer, PersistentBitMatrix\|PersistentCompactIntMatrix)` pair, bypasses `TypedLayer<D>`/`Layer` entirely | **no** — opened fresh inside `query_partition_with` on every call |
|
||||
|
||||
`query_partition_with` is `obikmer query`'s normal query path — the one
|
||||
`query_partition_with` is `obiskim query`'s normal query path — the one
|
||||
most exposed to repeated cross-partition lookups — and it is still the one
|
||||
with no cache at all. `obikphylo` built a cache first only because
|
||||
sibling-annex construction hits the cost hardest, not because the need is
|
||||
@@ -1605,7 +1605,7 @@ above). Concretely, in order:
|
||||
`Vec<KmerPartition>` instead of `Vec<Vec<Layer>>`.
|
||||
4. Migrate `obikindex::query_layer::QueryLayer`/`query_partition_with` to
|
||||
use `KmerPartition` too, closing the "no cache at all" gap on
|
||||
`obikmer`'s normal query path (see "Three independent implementations,"
|
||||
`obiskim`'s normal query path (see "Three independent implementations,"
|
||||
historical, above).
|
||||
|
||||
Open before implementing: exact API shape of `KmerPartition` (propose,
|
||||
@@ -1690,7 +1690,7 @@ storage decisions, now a *third* copy of the same logic to keep in sync)
|
||||
## One bug found while reading around this (signalled, not fixed); one earlier claim retracted
|
||||
|
||||
- `obicompactvec::bitmatrix::sparse.rs`'s module doc says
|
||||
"Not used by any production code path yet" — false since `obikmer pack
|
||||
"Not used by any production code path yet" — false since `obiskim pack
|
||||
--sparse` (`cmd/pack/mod.rs`) is wired to `pack_sparse_bit_matrix` and
|
||||
`Mat::open` already reads the result back in the sibling-annex path.
|
||||
Stale comment, not corrected.
|
||||
|
||||
@@ -8,8 +8,8 @@ The construction parameters p, n, and min_count depend on the kmer frequency spe
|
||||
|
||||
Two approaches are supported:
|
||||
|
||||
- **External estimation (preferred):** run [NT-CARD](https://github.com/bcgsc/ntCard) on the input files and pass its histogram output to `obikmer build`. NT-CARD produces a kmer frequency histogram in a single streaming pass using ntHash and a Flajolet-Martin-style estimator; obikmer reads this file and derives p, n, and min_count automatically.
|
||||
- **Internal estimation (future):** an `obikmer estimate` subcommand for users who prefer a single-tool workflow. The implementation would combine two components: (1) **ntHash**, a rolling hash that updates the kmer hash in O(1) per nucleotide by incrementally adding the incoming base and removing the outgoing one — Rust crates exist; (2) a **Flajolet-Martin-style streaming estimator** that maintains a small table of minimum hash values and infers the frequency histogram from their statistical distribution, as described in the NT-CARD paper [@Mohamadi2017-ok].
|
||||
- **External estimation (preferred):** run [NT-CARD](https://github.com/bcgsc/ntCard) on the input files and pass its histogram output to `obiskim build`. NT-CARD produces a kmer frequency histogram in a single streaming pass using ntHash and a Flajolet-Martin-style estimator; obiskim reads this file and derives p, n, and min_count automatically.
|
||||
- **Internal estimation (future):** an `obiskim estimate` subcommand for users who prefer a single-tool workflow. The implementation would combine two components: (1) **ntHash**, a rolling hash that updates the kmer hash in O(1) per nucleotide by incrementally adding the incoming base and removing the outgoing one — Rust crates exist; (2) a **Flajolet-Martin-style streaming estimator** that maintains a small table of minimum hash values and infers the frequency histogram from their statistical distribution, as described in the NT-CARD paper [@Mohamadi2017-ok].
|
||||
|
||||
The histogram gives:
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ are preserved unchanged; only the data matrices are rewritten.
|
||||
## Synopsis
|
||||
|
||||
```sh
|
||||
obikmer select <input-index>
|
||||
obiskim select <input-index>
|
||||
--output <dir>
|
||||
[--group <name>:<pred> ...]
|
||||
[--group-op <name>:<op> ...]
|
||||
@@ -165,14 +165,14 @@ is > N.
|
||||
### Aggregate by metadata group, default operators
|
||||
|
||||
```sh
|
||||
obikmer select myindex --output out --aggregate-by group
|
||||
obiskim select myindex --output out --aggregate-by group
|
||||
# one column per unique value of "group"; presence→any, count→sum
|
||||
```
|
||||
|
||||
### Named groups with different operators
|
||||
|
||||
```sh
|
||||
obikmer select myindex --output out \
|
||||
obiskim select myindex --output out \
|
||||
--group "pub:species=Betula_pubescens" \
|
||||
--group "nan:species=Betula_nana" \
|
||||
--group-op "pub:any" \
|
||||
@@ -183,7 +183,7 @@ obikmer select myindex --output out \
|
||||
### Mix aggregated group and individual genome
|
||||
|
||||
```sh
|
||||
obikmer select myindex --output out \
|
||||
obiskim select myindex --output out \
|
||||
--group "A:group=A" \
|
||||
--select "A,Betula_nana--IGA-24-39"
|
||||
```
|
||||
@@ -191,7 +191,7 @@ obikmer select myindex --output out \
|
||||
### Pure column projection (no aggregation)
|
||||
|
||||
```sh
|
||||
obikmer select myindex --output out \
|
||||
obiskim select myindex --output out \
|
||||
--select "Betula_nana--TROM-V-149986,Betula_nana--AG-P04-25-01"
|
||||
```
|
||||
|
||||
@@ -199,11 +199,11 @@ obikmer select myindex --output out \
|
||||
|
||||
```sh
|
||||
# Step 1: keep only B. nana-specific k-mers
|
||||
obikmer filter myindex --output filtered \
|
||||
obiskim filter myindex --output filtered \
|
||||
--ingroup "species=Betula_nana" --outgroup "*"
|
||||
|
||||
# Step 2: aggregate genome columns by collection site
|
||||
obikmer select filtered --output final --aggregate-by site
|
||||
obiskim select filtered --output final --aggregate-by site
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in new issue
Block a user