Skip to content

About

Rust and Python bindings for minibwa — Heng Li's lightweight bwa

Topics

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

minibwa

CI crates.io docs.rs PyPI install with bioconda

Rust and Python bindings for minibwa.

  • minibwa-sys — low-level FFI over vendored minibwa C (compiled via build.rs).
  • minibwa — safe Rust wrapper exposing structured alignment Hits.
  • minibwa-py — Python bindings (pyo3 + maturin).

Quick start (Rust)

use minibwa::{Aligner, Index, Meth, Opts, ThreadBuf};

Index::build_from_fasta("ref.fa", "ref", false, 4)?;
let idx = Index::load("ref", false)?;
let opts = Opts::new();
let aligner = Aligner::new(&idx, &opts);
let mut buf = ThreadBuf::new();
for hit in aligner.map(&mut buf, b"read1", b"ACGT...", Meth::None)? {
    println!("{:?} {}..{}", hit.contig, hit.ref_start, hit.ref_end);
}
# Ok::<(), minibwa::Error>(())

Quick start (Python)

import minibwa

# Build a BWA index from a FASTA file (one-time)
minibwa.Index.build("ref.fa", "ref")

# Load the index
idx = minibwa.Index.load("ref")

# Configure alignment options
opts = minibwa.Opts()

# Map a single read
hits = minibwa.map(idx, opts, "read1", "ACGT...")
for h in hits:
    print(h)

Licensing

MIT. The default build uses only Apache-2.0 libsais for indexing. The GPL bwtgen path is available behind the opt-in gpl-bwtgen feature, which changes the effective license to GPL.

Updating the vendored source

scripts/refresh-minibwa.sh <commit> [--patch <sha>]... [--src <path>]

The pin is recorded as an upstream base commit in minibwa-sys/vendor/COMMIT plus any fork patches carried on top in minibwa-sys/vendor/PATCHES. A nightly workflow watches upstream for new releases and opens a draft refresh PR, so this is usually only run by hand when the automated cherry-pick needs help.

About

Rust and Python bindings for minibwa — Heng Li's lightweight bwa

Topics

Resources

Code of conduct

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages