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§
source§impl 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
source§impl<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§
source§impl<'de, F> Deserialize<'de> for Scoring<F>where
F: Deserialize<'de> + MatchFunc,
impl<'de, F> Deserialize<'de> for Scoring<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 Scoring<F>
impl<F: Ord + MatchFunc> Ord for Scoring<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<Scoring<F>> for Scoring<F>
impl<F: PartialEq + MatchFunc> PartialEq<Scoring<F>> for Scoring<F>
source§impl<F: PartialOrd + MatchFunc> PartialOrd<Scoring<F>> for Scoring<F>
impl<F: PartialOrd + MatchFunc> PartialOrd<Scoring<F>> for Scoring<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: Copy + MatchFunc> Copy for Scoring<F>
impl<F: Eq + MatchFunc> Eq for Scoring<F>
impl<F: MatchFunc> StructuralEq for Scoring<F>
impl<F: MatchFunc> StructuralPartialEq for Scoring<F>
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§
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.