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 (or substitution)
.... 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::TracebackCell
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 (see alsobio::alignment::pairwise::Scoring
)
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 (see alsobio::alignment::pairwise::Scoring
)
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).
Auto Trait Implementations
impl<F> RefUnwindSafe for Aligner<F> where
F: RefUnwindSafe,
impl<F> Send for Aligner<F> where
F: Send,
impl<F> Sync for Aligner<F> where
F: Sync,
impl<F> Unpin for Aligner<F> where
F: Unpin,
impl<F> UnwindSafe for Aligner<F> where
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.