pub struct Aligner<F: MatchFunc> { /* private fields */ }
Expand description
A generalized Smith-Waterman aligner.
M(i,j) is the best score such that x[i] and y[j] ends in a match …. A G x_i …. C G y_j
I(i,j) is the best score such that x[i] is aligned with a gap …. A G x_i …. G y_j - This is interpreted as an insertion into “x” w.r.t reference “y”
D(i,j) is the best score such that y[j] is aligned with a gap …. A x_i - …. G G y_j This is interpreted as a deletion from “x” w.r.t reference “y”
S(i,j) is the best score for prefixes x[0..i], y[0..j]
To save space, only two columns of these matrices are stored at any point - the current column and the previous one. Moreover M(i,j) is not explicitly stored
Lx is the optimal x suffix clipping lengths from each position of the sequence y Ly is the optimal y suffix clipping lengths from each position of the sequence x Sn is the last column of the matrix. This is needed to keep track of suffix clipping scores
traceback - see bio::alignment::pairwise::Traceback scoring - see bio::alignment::pairwise::Scoring
Implementations
sourceimpl<F: MatchFunc> Aligner<F>
impl<F: MatchFunc> Aligner<F>
sourcepub fn new(gap_open: i32, gap_extend: i32, match_fn: F) -> Self
pub fn new(gap_open: i32, gap_extend: i32, match_fn: F) -> Self
Create new aligner instance with given gap open and gap extend penalties and the score function.
Arguments
gap_open
- the score for opening a gap (should be negative)gap_extend
- the score for extending a gap (should be negative)match_fn
- function that returns the score for substitutions (also see bio::scores)
sourcepub fn with_capacity(
m: usize,
n: usize,
gap_open: i32,
gap_extend: i32,
match_fn: F
) -> Self
pub fn with_capacity(
m: usize,
n: usize,
gap_open: i32,
gap_extend: i32,
match_fn: F
) -> Self
Create new aligner instance. The size hints help to avoid unnecessary memory allocations.
Arguments
m
- the expected size of xn
- the expected size of ygap_open
- the score for opening a gap (should be negative)gap_extend
- the score for extending a gap (should be negative)match_fn
- function that returns the score for substitutions (also see bio::scores)
sourcepub fn with_scoring(scoring: Scoring<F>) -> Self
pub fn with_scoring(scoring: Scoring<F>) -> Self
Create new aligner instance with given the scoring struct
Arguments
scoring
- the scoring struct (see bio::alignment::pairwise::Scoring)
sourcepub fn with_capacity_and_scoring(m: usize, n: usize, scoring: Scoring<F>) -> Self
pub fn with_capacity_and_scoring(m: usize, n: usize, scoring: Scoring<F>) -> Self
Create new aligner instance with scoring and size hint. The size hints help to avoid unnecessary memory allocations.
Arguments
m
- the expected size of xn
- the expected size of yscoring
- the scoring struct
sourcepub fn global(&mut self, x: TextSlice<'_>, y: TextSlice<'_>) -> Alignment
pub fn global(&mut self, x: TextSlice<'_>, y: TextSlice<'_>) -> Alignment
Calculate global alignment of x against y.
sourcepub fn semiglobal(&mut self, x: TextSlice<'_>, y: TextSlice<'_>) -> Alignment
pub fn semiglobal(&mut self, x: TextSlice<'_>, y: TextSlice<'_>) -> Alignment
Calculate semiglobal alignment of x against y (x is global, y is local).