Expand description
API providing a rusty interface to minimap2
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
- htslib - Provides an interface to minimap2 that returns rust_htslib::Records
- simde - Enables SIMD Everywhere library in minimap2
- zlib-ng - Enables the use of zlib-ng for faster compression
- curl - Enables curl for htslib
- static - Builds minimap2 as a static library
- sse2only - Builds minimap2 with only SSE2 support
§Previously Supported Features
- mm2-fast - Uses the mm2-fast library instead of standard minimap2
If needed, this can be re-enabled.
§Compile-time options
I recommend the following:
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1
§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, Some(b"Sample Query"))
.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, Some(b"Query Name"));
assert_eq!(hits.unwrap().len(), 1);
Re-exports§
pub use minimap2_sys as ffi;
Modules§
- htslib
- Provides an interface to minimap2 that returns rust_htslib::Records
Structs§
- Aligner
- Aligner struct, mimicking minimap2’s python interface
- Alignment
- Alignment struct when alignment flag is set
- Built
- Mapping
- Mapping result
- Preset
Set - Unset
Enums§
- Alignment
Type - Alignment type
- File
Format - Preset
- Preset’s for minimap2 config
- Strand
- Strand enum