Crate block_aligner[−][src]
Expand description
SIMD-accelerated library for computing global and X-drop affine gap sequence alignments using an adaptive block-based algorithm.
Currently, AVX2 and WASM SIMD are supported.
Example
use block_aligner::scan_block::*; use block_aligner::scores::*; use block_aligner::cigar::*; let block_size = 16; let gaps = Gaps { open: -2, extend: -1 }; let r = PaddedBytes::from_bytes::<NucMatrix>(b"TTAAAAAAATTTTTTTTTTTT", block_size); let q = PaddedBytes::from_bytes::<NucMatrix>(b"TTTTTTTTAAAAAAATTTTTTTTT", block_size); // Align with traceback, but no x drop threshold. let a = Block::<_, true, false>::align(&q, &r, &NW1, gaps, block_size..=block_size, 0); let res = a.res(); assert_eq!(res, AlignResult { score: 7, query_idx: 24, reference_idx: 21 }); assert_eq!(a.trace().cigar(res.query_idx, res.reference_idx).to_string(), "2M6I16M3D");
When building your code that uses this library, it is important to specify the correct flags to turn on specific target features that this library uses.
For x86 AVX2:
RUSTFLAGS="-C target-cpu=native" cargo build --release
or
RUSTFLAGS="-C target-feature=+avx2" cargo build --release
For WASM SIMD:
RUSTFLAGS="-C target-feature=+simd128" cargo build --target=wasm32-wasi --release
Modules
Constants
Number of 16-bit lanes in a SIMD vector.