pub struct Scoring<F: MatchFunc> {
pub gap_open: i32,
pub gap_extend: i32,
pub match_fn: F,
pub match_scores: Option<(i32, i32)>,
pub xclip_prefix: i32,
pub xclip_suffix: i32,
pub yclip_prefix: i32,
pub yclip_suffix: i32,
}
Expand description
Details of scoring are encapsulated in this structure.
An affine gap score model
is used so that the gap score for a length k
is:
GapScore(k) = gap_open + gap_extend * k
Fields
gap_open: i32
gap_extend: i32
match_fn: F
match_scores: Option<(i32, i32)>
xclip_prefix: i32
xclip_suffix: i32
yclip_prefix: i32
yclip_suffix: i32
Implementations
sourceimpl Scoring<MatchParams>
impl Scoring<MatchParams>
sourcepub fn from_scores(
gap_open: i32,
gap_extend: i32,
match_score: i32,
mismatch_score: i32
) -> Self
pub fn from_scores(
gap_open: i32,
gap_extend: i32,
match_score: i32,
mismatch_score: i32
) -> Self
Create new Scoring instance with given gap open, gap extend penalties
match and mismatch scores. The clip penalties are set to MIN_SCORE
by default
Arguments
gap_open
- the score for opening a gap (should not be positive)gap_extend
- the score for extending a gap (should not be positive)match_score
- the score for a matchmismatch_score
- the score for a mismatch
sourceimpl<F: MatchFunc> Scoring<F>
impl<F: MatchFunc> Scoring<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 Scoring instance with given gap open, gap extend penalties
and the score function. The clip penalties are set to MIN_SCORE
by default
Arguments
gap_open
- the score for opening a gap (should not be positive)gap_extend
- the score for extending a gap (should not be positive)match_fn
- function that returns the score for substitutions (see alsobio::alignment::pairwise::Scoring
)
sourcepub fn xclip(self, penalty: i32) -> Self
pub fn xclip(self, penalty: i32) -> Self
Sets the prefix and suffix clipping penalties for x to the input value
Arguments
penalty
- Clipping penalty for x (both prefix and suffix, should not be positive)
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).xclip(-5);
assert!(scoring.xclip_prefix == -5);
assert!(scoring.yclip_prefix == MIN_SCORE);
assert!(scoring.xclip_suffix == -5);
assert!(scoring.yclip_suffix == MIN_SCORE);
sourcepub fn xclip_prefix(self, penalty: i32) -> Self
pub fn xclip_prefix(self, penalty: i32) -> Self
Sets the prefix clipping penalty for x to the input value
Arguments
penalty
- Prefix clipping penalty for x (should not be positive)
Example
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).xclip_prefix(-5);
assert!(scoring.xclip_prefix == -5);
assert!(scoring.yclip_prefix == MIN_SCORE);
assert!(scoring.xclip_suffix == MIN_SCORE);
assert!(scoring.yclip_suffix == MIN_SCORE);
sourcepub fn xclip_suffix(self, penalty: i32) -> Self
pub fn xclip_suffix(self, penalty: i32) -> Self
Sets the suffix clipping penalty for x to the input value
Arguments
penalty
- Suffix clipping penalty for x (should not be positive)
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).xclip_suffix(-5);
assert!(scoring.xclip_prefix == MIN_SCORE);
assert!(scoring.yclip_prefix == MIN_SCORE);
assert!(scoring.xclip_suffix == -5);
assert!(scoring.yclip_suffix == MIN_SCORE);
sourcepub fn yclip(self, penalty: i32) -> Self
pub fn yclip(self, penalty: i32) -> Self
Sets the prefix and suffix clipping penalties for y to the input value
Arguments
penalty
- Clipping penalty for y (both prefix and suffix, should not be positive)
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).yclip(-5);
assert!(scoring.xclip_prefix == MIN_SCORE);
assert!(scoring.yclip_prefix == -5);
assert!(scoring.xclip_suffix == MIN_SCORE);
assert!(scoring.yclip_suffix == -5);
sourcepub fn yclip_prefix(self, penalty: i32) -> Self
pub fn yclip_prefix(self, penalty: i32) -> Self
Sets the prefix clipping penalty for y to the input value
Arguments
penalty
- Prefix clipping penalty for y (should not be positive)
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).yclip_prefix(-5);
assert!(scoring.xclip_prefix == MIN_SCORE);
assert!(scoring.yclip_prefix == -5);
assert!(scoring.xclip_suffix == MIN_SCORE);
assert!(scoring.yclip_suffix == MIN_SCORE);
sourcepub fn yclip_suffix(self, penalty: i32) -> Self
pub fn yclip_suffix(self, penalty: i32) -> Self
Sets the suffix clipping penalty for y to the input value
Arguments
penalty
- Suffix clipping penalty for y (should not be positive)
use bio::alignment::pairwise::{Scoring, MIN_SCORE};
let scoring = Scoring::from_scores(0, -2, 1, -2).yclip_suffix(-5);
assert!(scoring.xclip_prefix == MIN_SCORE);
assert!(scoring.yclip_prefix == MIN_SCORE);
assert!(scoring.xclip_suffix == MIN_SCORE);
assert!(scoring.yclip_suffix == -5);
Trait Implementations
Auto Trait Implementations
impl<F> RefUnwindSafe for Scoring<F> where
F: RefUnwindSafe,
impl<F> Send for Scoring<F> where
F: Send,
impl<F> Sync for Scoring<F> where
F: Sync,
impl<F> Unpin for Scoring<F> where
F: Unpin,
impl<F> UnwindSafe for Scoring<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.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more