1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
//! 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`.
#![cfg_attr(feature = "mca", feature(asm))]
//use wee_alloc::WeeAlloc;
//#[global_allocator]
//static ALLOC: WeeAlloc = WeeAlloc::INIT;
// special SIMD instruction set modules adapted for this library
// their types and lengths are abstracted out
#[cfg(feature = "simd_avx2")]
#[macro_use]
#[doc(hidden)]
/// cbindgen:ignore
pub mod avx2;
#[cfg(feature = "simd_avx2")]
pub use avx2::L;
#[cfg(feature = "simd_wasm")]
#[macro_use]
#[doc(hidden)]
/// cbindgen:ignore
pub mod simd128;
#[cfg(feature = "simd_wasm")]
pub use simd128::L;
#[cfg(feature = "simd_neon")]
#[macro_use]
#[doc(hidden)]
/// cbindgen:ignore
pub mod neon;
#[cfg(feature = "simd_neon")]
pub use neon::L;
#[cfg(any(feature = "simd_avx2", feature = "simd_wasm", feature = "simd_neon"))]
pub mod scan_block;
#[cfg(any(feature = "simd_avx2", feature = "simd_wasm", feature = "simd_neon"))]
pub mod scores;
#[cfg(any(feature = "simd_avx2", feature = "simd_wasm", feature = "simd_neon"))]
pub mod cigar;
#[cfg(any(feature = "simd_avx2", feature = "simd_wasm", feature = "simd_neon"))]
pub mod simulate;
#[cfg(any(feature = "simd_avx2", feature = "simd_neon"))]
#[doc(hidden)]
pub mod ffi;