Crate block_aligner
source ·Expand description
SIMD-accelerated library for computing global and X-drop affine gap penalty sequence-to-sequence or sequence-to-profile alignments using an adaptive block-based algorithm.
Currently, AVX2, Neon, 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 mut a = Block::<true, false>::new(q.len(), r.len(), block_size);
a.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 });
let mut cigar = Cigar::new(res.query_idx, res.reference_idx);
a.trace().cigar(res.query_idx, res.reference_idx, &mut cigar);
assert_eq!(cigar.to_string(), "2M6I16M3D");Using a minimum block size of 32 is recommended for most applications.
When building your code that uses this library, it is important to specify the
correct feature flags: simd_avx2, simd_neon, or simd_wasm.
Modules
Data structures and functions for working with CIGAR strings.
Main block aligner algorithm and supporting data structures.
Structs for representing match/mismatch scoring matrices.
Utility functions for simulating random sequences.
Constants
Number of 16-bit lanes in a SIMD vector.