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§
source§impl<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).
Trait Implementations§
source§impl<'de, F> Deserialize<'de> for Aligner<F>where
F: Deserialize<'de> + MatchFunc,
impl<'de, F> Deserialize<'de> for Aligner<F>where F: Deserialize<'de> + MatchFunc,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl<F: Ord + MatchFunc> Ord for Aligner<F>
impl<F: Ord + MatchFunc> Ord for Aligner<F>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<F: PartialEq + MatchFunc> PartialEq<Aligner<F>> for Aligner<F>
impl<F: PartialEq + MatchFunc> PartialEq<Aligner<F>> for Aligner<F>
source§impl<F: PartialOrd + MatchFunc> PartialOrd<Aligner<F>> for Aligner<F>
impl<F: PartialOrd + MatchFunc> PartialOrd<Aligner<F>> for Aligner<F>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<F: Eq + MatchFunc> Eq for Aligner<F>
impl<F: MatchFunc> StructuralEq for Aligner<F>
impl<F: MatchFunc> StructuralPartialEq for Aligner<F>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.