Eric Coissac b2222afbe3
Release / create-release (push) Successful in 32s
Release / build-linux-x86_64 (push) Successful in 6m51s
Release / build-macos-arm64 (push) Failing after 40s
refactor: remove obipipeline crate and migrate dependencies
Delete the `obipipeline` crate and update all dependent crates to use the
published `obipipeline` version 0.2 from the `obi` registry. Migrate
specific pipeline logic into consuming crates: move error handling to
`obikindexer` and batch iteration logic to `obiskio`. Update build
scripts to support MSRV checking and improved dependency management.

- Delete `src/obipipeline/` entirely, removing the pipeline runtime,
  scheduler, macros, and throttle implementations.
- Move `fmt` (now `pipeline_error`) from `obipipeline` error handling to
  `src/obikindexer/src/graph_pipeline.rs` for graph building errors.
- Move `apply` (now `iter_canonical_kmer_batches_owned`) from
  `obipipeline` pipe logic to `src/obiskio/src/unitig_index/reader.rs`
  to provide lazy batch iteration for canonical kmers.
- Update `src/obikindexer`, `src/obikmerge`, `src/obikphylo`, and
  `src/obiskim` to depend on `obipipeline` version 0.2 from the `obi`
  registry instead of the local path.
- Refactor `src/obikindexer/src/graph_pipeline.rs` to use the new
  `pipeline_error` function and update `build_graph` to accept an
  iterator-returning `open` function.
- Refactor `src/obikmerge` to use `iter_canonical_kmer_batches_owned`
  for streaming batches in `merge_partition` and `run_pass2`, replacing
  previous pipeline stage logic.
- Refactor `src/obikphylo` to handle errors via `OKIError::InvalidData`
  in `build_layer_sibling_annex` and `scan_layer_families`.
- Refactor `src/obiskim` to use `.expect("pipeline error")` for batch
  processing in `query` and `superkmer` commands.
- Add `src/obiskio/src/unitig_index/reader.rs` method
  `iter_canonical_kmer_batches_owned` for lazy batch iteration.
- Add `.crate-kit/scripts/msrv-check.sh` to verify the declared
  `rust-version` builds successfully with the specified toolchain.
- Update `.crate-kit/scripts/deps-check.sh` and `deps-lib.sh` to
  support `cargo update` with specific arguments and improved lockfile
  handling.
- Update `.crate-kit/scripts/bump-version.sh` to use `sed -E` for
  robust version string replacement in `README.md`.
- Update `.crate-kit/scripts/publish-guard.sh` and `publish.sh` to
  enforce registry settings and exclude internal files from packages.
- Update `.gitea/workflows/release.yml` to pass the private cargo
  registry index environment variable during macOS binary builds.
- Remove `Cargo.lock` from the repository root and update
  `src/Cargo.lock` to reflect the new `obipipeline` dependency version.
- Update `src/Cargo.toml` workspace members to remove `obikseq` and
  add `obifastwrite`.
2026-12-02 16:16:40 +01:00
2026-12-01 18:15:13 +01:00

obiskim

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.

Key principles

Compact k-mer encoding. Each k-mer is stored in a u64 at 2 bits/base. k is odd, k ∈ [11, 31], fixed at runtime. The canonical form min(kmer, revcomp(kmer)) halves the effective space by collapsing both strands.

Superkmer-based partitioning. Sequences are decomposed into superkmers — maximal runs of k-mers sharing the same minimizer. Superkmers route naturally to partitions via the minimizer hash, enabling partition-parallel indexing and querying with no cross-partition communication.

Layered MPHF index. Each partition holds a stack of layers. Each layer is a minimal perfect hash function (MPHF) over the k-mers of one input genome, paired with a per-genome presence/count matrix. Queries scatter k-mers to their partition, probe each layer in order, and aggregate results.

Approximate indexing (Findere). With -z Z, the index stores k-mers of size s = k − z + 1 instead of k. At query time, results are produced at size s, then a per-genome sliding window of size z aggregates z consecutive s-mer hits into one confirmed k-mer answer. This reduces the false-positive rate from 1/2^b per s-mer to 1/2^(b·z) per k-mer, at the cost of z−1 unconfirmed positions at each sequence break. The aggregation window spans the full query sequence, not individual superkmers, to avoid false negatives at superkmer boundaries.

Multi-genome. A single index can hold any number of genomes. Each k-mer slot carries a per-genome count or presence vector. Distance matrices, NJ/UPGMA trees, and classification are derived from these vectors without rebuilding the index.

Input formats

Command              Formats accepted
───────────────────  ──────────────────────────────────────────────────────────────
index, superkmer     FASTA (.fa .fasta), FASTQ (.fq .fastq), GenBank flat file
                     (.gb .gbk .gbff), all optionally gzip-compressed.
                     Directories expanded recursively. Streaming stdin via -.
query                FASTA, FASTQ, optionally gzip-compressed. Stdin via -.

Non-ACGT characters act as hard breaks between k-mer segments in all formats.

Commands

Command    Role
─────────  ────────────────────────────────────────────────────────────────────
index      Build a genome index from sequence files.
           Runs scatter → dereplicate → count → layered MPHF.
           Resumes automatically if interrupted.
merge      Merge multiple independently built indexes into one.
           Schedules partitions largest-first under a memory budget semaphore
           to avoid OOM on machines with many cores. The worst partition runs
           alone first to calibrate the expansion estimator; subsequent
           partitions run in parallel within the budget.
           --budget-fraction F  fraction of available RAM to use as budget
                                (default 0.5; reduce if OOM persists).
filter     Filter and compact an existing index: apply count thresholds,
           drop layers, rewrite as a single-layer index.
reindex    Convert evidence in-place across all layers:
           exact (evidence.bin) ↔ approximate (fingerprint.bin).
           Does not touch the MPHF or unitigs.
query      Query an index with FASTA/FASTQ sequences.
           Annotates each sequence with per-genome k-mer match counts
           and optional per-position coverage vectors (--detail).
           Parallel over sequence chunks.
phylo      Compute pairwise evolutionary-distance proxies between all
           indexed genomes (Bray-Curtis, Jaccard, etc.), optionally
           a Newick NJ/UPGMA tree, and optionally a central-position
           SNP/Sankoff calibration with exports for external
           phylogenetic tools (TNT, PhyG, IQ-TREE).
annotate   Add or update genome metadata (taxonomy, etc.) from a CSV
           file; or dump the current metadata as CSV.
estimate   Dry-run: resolve and print approximate-index parameters
           (z, evidence bits b, FP rates) given any two of (b, z, fp).
           Does not touch any index.
dump       Dump all indexed k-mers as CSV with per-genome counts or
           presence flags.
superkmer  Extract superkmers from a sequence file and write to stdout.
           Diagnostic / pipeline use.
unitig     Dump the unitig sequences stored in a built index. Debug use.
utils      Miscellaneous utilities.
           --new-label NEW=OLD      rename a genome label in-place.
           --bits-per-kmer          print MPHF / evidence / matrix size breakdown.
           --stats                  per-genome k-mer counts as CSV.
           --partition-stats        partition size distribution across one or more
                                    indexes (markdown report to stdout). Useful to
                                    diagnose minimizer imbalance before a large merge.
           --csv FILE               write per-(partition, source) raw data to FILE
                                    (used with --partition-stats).

Quick start

# Build an exact index for each genome independently
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
obiskim merge --output index/ index_a/ index_b/

# Convert to approximate index (z=5, 8-bit fingerprints)
obiskim reindex --approx -z 5 --evidence-bits 8 index/

# Query reads
obiskim query index/ reads.fq.gz > annotated.fa

# Pairwise distances
obiskim phylo index/ > distances.tsv

Parameter constraints

Parameter              Constraint
─────────────────────  ──────────────
k  (--kmer-size)       odd, 11 ≤ k ≤ 31
m  (--minimizer-size)  odd, 3 ≤ m ≤ k−1
z  (-z, --approx only) 1 ≤ z ≤ k−1

Documentation

Extended architecture and implementation notes are in DevDocMD/. Build with make doc (requires Python + MkDocs Material). User-facing documentation is in UserDocMD/, built with make doc-user.

S
Description
No description provided
Readme
384 MiB
0 Stars 1 Watchers 0 Forks
v1.4.10
Latest
2026-12-02 15:17:20 +00:00
Languages
HTML 54.7%
Rust 37.1%
Shell 3.2%
Python 1.9%
TeX 1.7%
Other 1.3%