Struct bio::alignment::pairwise::Scoring

source ·
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>

source

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 match
  • mismatch_score - the score for a mismatch
source§

impl<F: MatchFunc> Scoring<F>

source

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 also bio::alignment::pairwise::Scoring)
source

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);
source

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);
source

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);
source

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);
source

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);
source

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<F: Clone + MatchFunc> Clone for Scoring<F>

source§

fn clone(&self) -> Scoring<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug + MatchFunc> Debug for Scoring<F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: Default + MatchFunc> Default for Scoring<F>

source§

fn default() -> Scoring<F>

Returns the “default value” for a type. Read more
source§

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>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<F: Hash + MatchFunc> Hash for Scoring<F>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<F: Ord + MatchFunc> Ord for Scoring<F>

source§

fn cmp(&self, other: &Scoring<F>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<F: PartialEq + MatchFunc> PartialEq<Scoring<F>> for Scoring<F>

source§

fn eq(&self, other: &Scoring<F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F: PartialOrd + MatchFunc> PartialOrd<Scoring<F>> for Scoring<F>

source§

fn partial_cmp(&self, other: &Scoring<F>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<F> Serialize for Scoring<F>where F: Serialize + MatchFunc,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<F: Copy + MatchFunc> Copy for Scoring<F>

source§

impl<F: Eq + MatchFunc> Eq for Scoring<F>

source§

impl<F: MatchFunc> StructuralEq for Scoring<F>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<N> NodeTrait for Nwhere N: Copy + Ord + Hash,

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,