Expand description
Safe, idiomatic Rust bindings for minibwa — a fast short-read, adaptive, and Hi-C DNA aligner.
§Workflow
- Build an index once from a FASTA with
Index::build_from_fasta. - Load the index with
Index::load; the loaded index isSend + Syncand can be shared across threads. - Create an
Alignerfrom&Indexand&Opts— cheap, no allocation. - Create one
ThreadBufper worker thread — holds the per-thread scratch arena; it isSendbut notSync. - Call
Aligner::maporAligner::map_pairto align reads and get ownedHitvectors.
§Methylation support
Pass Meth::C2T or Meth::G2A to Aligner::map for single-read
bisulfite alignment, or enable Opts::set_methylation together with
Aligner::map_pair for paired-end bisulfite alignment.
§Paired-end support
Use Aligner::map_pair for paired-end alignment. Insert-size parameters
can be tuned with Opts::set_pe_insert_size.
§Parallelism
Thread-level parallelism is caller-owned: create one ThreadBuf per thread
and call Aligner::map / Aligner::map_pair concurrently. The shared
Index is read-only during mapping.
§Example
use minibwa::{Index, Opts, Aligner, ThreadBuf, Meth};
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, "read1", b"ACGT...", Meth::None)? {
println!(
"{} {}..{} {}",
hit.contig.as_deref().unwrap_or("*"),
hit.ref_start,
hit.ref_end,
hit.cigar_string(),
);
}Structs§
- Aligner
- An aligner binding an index and options. Cheap to create; the index is shared.
- CigarOp
- A single CIGAR operation: a kind and a length.
- Hit
- A fully-owned alignment record converted from minibwa’s
mb_hit_t. - Index
- A loaded minibwa index. Immutable after load; safe to share across threads.
- Opts
- Alignment options, wrapping minibwa’s
mb_opt_t. - Thread
Buf - Per-thread scratch buffer for alignment. One per worker thread.
Enums§
- Cigar
Kind - A CIGAR operation kind, mirroring minibwa’s
MB_CIGAR_*. - Error
- Errors returned by the safe minibwa API.
- Meth
- Methylation conversion type for a read, mapped to minibwa’s
mtparameter. - Strand
- Alignment strand.
Type Aliases§
- Result
- Result alias for this crate.