Crate minimap2

source ·
Expand description

API providing a rusty interface to minimap2 or mm2-fast libraries.

This library supports statically linking and compiling minimap2 directly, no separate install is required.

§Implementation

This is a wrapper library around minimap2-sys, which are lower level bindings for minimap2.

§Caveats

Setting threads with the builder pattern applies only to building the index, not the mapping. For an example of using multiple threads with mapping, see: fakeminimap2

§Crate Features

This crate has multiple create features available.

  • map-file - Enables the ability to map a file directly to a reference. Enabled by deafult
  • mm2-fast - Uses the mm2-fast library instead of standard minimap2
  • htslib - Provides an interface to minimap2 that returns rust_htslib::Records
  • simde - Enables SIMD Everywhere library in minimap2
  • sse - Enables the use of SSE instructions

§Examples

§Mapping a file to a reference

use minimap2::{Aligner, Preset};
let mut aligner = Aligner::builder()
.map_ont()
.with_index_threads(8)
.with_cigar()
.with_index("ReferenceFile.fasta", None)
.expect("Unable to build index");

let seq = b"ACTGACTCACATCGACTACGACTACTAGACACTAGACTATCGACTACTGACATCGA";
let alignment = aligner
.map(seq, false, false, None, None)
.expect("Unable to align");

§Mapping a file to an individual target sequence

use minimap2::{Aligner, Preset};
let aligner = Aligner::builder().map_ont().with_seq(seq.as_bytes()).expect("Unable to build index");
let query = b"CGGCACCAGGTTAAAATCTGAGTGCTGCAATAGGCGATTACAGTACAGCACCCAGCCTCCG";
let hits = aligner.map(query, false, false, None, None);
assert_eq!(hits.unwrap().len(), 1);

Modules§

  • Provides an interface to minimap2 that returns rust_htslib::Records

Structs§

  • Aligner struct, mimicking minimap2’s python interface
  • Alignment struct when alignment flag is set
  • Mapping result

Enums§

Type Aliases§