Struct ScoringMatrix

Source
pub struct ScoringMatrix<A: Alphabet> { /* private fields */ }
Expand description

A matrix storing log-odds ratio of symbol occurrences at each position.

Implementations§

Source§

impl<A: ComplementableAlphabet> ScoringMatrix<A>

Source

pub fn reverse_complement(&self) -> Self

Get the reverse-complement of this scoring matrix.

Source§

impl<A: Alphabet> ScoringMatrix<A>

Source

pub fn new(background: Background<A>, data: DenseMatrix<f32, A::K>) -> Self

Create a new scoring matrix from the given log-odds matrix.

Source

pub fn background(&self) -> &Background<A>

The background frequencies of the position weight matrix.

Source

pub fn min_score(&self) -> f32

The lowest score that can be obtained with this scoring matrix.

Source

pub fn max_score(&self) -> f32

The highest score that can be obtained with this scoring matrix.

Source

pub fn information_content(&self) -> f32

Compute the information content of the matrix.

Source

pub fn score<S, C>(&self, seq: S) -> StripedScores<f32, C>

Compute the PSSM scores for every position of the given sequence.

§Note

Uses platform-accelerated implementation when available.

Source

pub fn score_position<S, C>(&self, seq: S, pos: usize) -> f32

Compute the score for a single sequence position.

Source

pub fn to_discrete(&self) -> DiscreteMatrix<A>

Get a discrete matrix from this position-specific scoring matrix.

Source

pub fn to_score_distribution(&self) -> ScoreDistribution<A>

Get the score distribution for this position-specific scoring matrix.

See crate::pwm::dist module for more information.

§Note

Generating a ScoreDistribution takes time, so this method should be called only once per ScoringMatrix and the result cached for optimal performance.

Source§

impl<A: Alphabet> ScoringMatrix<A>

Source

pub fn matrix(&self) -> &DenseMatrix<f32, A::K>

The raw data storage for the matrix.

Source

pub fn len(&self) -> usize

Get the length of the motif encoded in this matrix.

Source

pub fn is_empty(&self) -> bool

Check whether the matrix is empty.

Trait Implementations§

Source§

impl<A: Alphabet> AsRef<DenseMatrix<f32, <A as Alphabet>::K>> for ScoringMatrix<A>

Source§

fn as_ref(&self) -> &DenseMatrix<f32, A::K>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: Alphabet> AsRef<ScoringMatrix<A>> for ScoringMatrix<A>

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<A: Clone + Alphabet> Clone for ScoringMatrix<A>
where A::K: Clone,

Source§

fn clone(&self) -> ScoringMatrix<A>

Returns a duplicate 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<A: Alphabet> Correlation for ScoringMatrix<A>

Source§

fn num_rows(&self) -> usize

The number of rows in the matrix.
Source§

fn dot(&self, other: &Self, i: usize, j: usize) -> f32

Compute the dot product between row i of self and row j of other.
Source§

fn norm(&self, i: usize) -> f32

Compute the Euclidean norm of row i.
Source§

fn auto_correlation(&self, delay: usize) -> f32

Compute the auto-correlation with the given delay.
Source§

fn cross_correlation(&self, other: &Self) -> f32

Compute the cross-correlation between two matrices.
Source§

impl<A: Debug + Alphabet> Debug for ScoringMatrix<A>
where A::K: Debug,

Source§

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

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

impl<A: Alphabet> From<&ScoringMatrix<A>> for DiscreteMatrix<A>

Source§

fn from(s: &ScoringMatrix<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> From<ScoringMatrix<A>> for DiscreteMatrix<A>

Source§

fn from(value: ScoringMatrix<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> From<ScoringMatrix<A>> for WeightMatrix<A>

Source§

fn from(pwm: ScoringMatrix<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> From<WeightMatrix<A>> for ScoringMatrix<A>

Source§

fn from(pwm: WeightMatrix<A>) -> Self

Converts to this type from the input type.
Source§

impl<A: Alphabet> Index<usize> for ScoringMatrix<A>

Source§

type Output = <DenseMatrix<f32, <A as Alphabet>::K> as Index<usize>>::Output

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<A: PartialEq + Alphabet> PartialEq for ScoringMatrix<A>
where A::K: PartialEq,

Source§

fn eq(&self, other: &ScoringMatrix<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A: Alphabet> StructuralPartialEq for ScoringMatrix<A>

Auto Trait Implementations§

§

impl<A> Freeze for ScoringMatrix<A>
where <<A as Alphabet>::K as ArrayLength>::ArrayType<f32>: Freeze,

§

impl<A> RefUnwindSafe for ScoringMatrix<A>

§

impl<A> Send for ScoringMatrix<A>
where A: Send,

§

impl<A> Sync for ScoringMatrix<A>
where A: Sync,

§

impl<A> Unpin for ScoringMatrix<A>
where <<A as Alphabet>::K as ArrayLength>::ArrayType<f32>: Unpin, A: Unpin,

§

impl<A> UnwindSafe for ScoringMatrix<A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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 for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V