Struct lightmotif::pwm::CountMatrix
source · pub struct CountMatrix<A: Alphabet> { /* private fields */ }Expand description
A matrix storing symbol occurrences at each position.
Implementations§
source§impl<A: Alphabet> CountMatrix<A>
impl<A: Alphabet> CountMatrix<A>
sourcepub fn new(data: DenseMatrix<u32, A::K>) -> Result<Self, InvalidData>
pub fn new(data: DenseMatrix<u32, A::K>) -> Result<Self, InvalidData>
Create a new count matrix from the given data.
The matrix must contain count data, for sequences of the same length, i.e. rows should all sum to the same value.
sourcepub fn from_sequences<'seq, I>(sequences: I) -> Result<Self, InvalidData>
pub fn from_sequences<'seq, I>(sequences: I) -> Result<Self, InvalidData>
Create a new count matrix from the given sequences.
§Errors
This function returns Err(InvalidData) when the sequences do not
all have the same length:
let result = CountMatrix::<Dna>::from_sequences([
EncodedSequence::new(vec![T, T, A, T]),
EncodedSequence::new(vec![T, C, A]),
]);
assert!(result.is_err());sourcepub fn to_freq<P>(&self, pseudo: P) -> FrequencyMatrix<A>where
P: Into<Pseudocounts<A>>,
pub fn to_freq<P>(&self, pseudo: P) -> FrequencyMatrix<A>where
P: Into<Pseudocounts<A>>,
Build a probability matrix from this count matrix using pseudo-counts.
sourcepub fn entropy(&self) -> Vec<f32>
pub fn entropy(&self) -> Vec<f32>
Compute the entropy of each column of the matrix.
The entropy of a column, sometimes refered to as “uncertainty”, is
computed by treating each motif position as a random variable taking
values in alphabet A.
sourcepub fn information_content(&self) -> f32
pub fn information_content(&self) -> f32
Compute the information content of the matrix.
source§impl<A: ComplementableAlphabet> CountMatrix<A>
impl<A: ComplementableAlphabet> CountMatrix<A>
sourcepub fn reverse_complement(&self) -> Self
pub fn reverse_complement(&self) -> Self
Get the reverse-complement of this count matrix.
source§impl<A: Alphabet> CountMatrix<A>
impl<A: Alphabet> CountMatrix<A>
sourcepub fn matrix(&self) -> &DenseMatrix<u32, A::K>
pub fn matrix(&self) -> &DenseMatrix<u32, A::K>
The raw data storage for the matrix.
Trait Implementations§
source§impl<A: Alphabet> AsRef<CountMatrix<A>> for CountMatrix<A>
impl<A: Alphabet> AsRef<CountMatrix<A>> for CountMatrix<A>
source§impl<A: Alphabet> AsRef<DenseMatrix<u32, <A as Alphabet>::K>> for CountMatrix<A>
impl<A: Alphabet> AsRef<DenseMatrix<u32, <A as Alphabet>::K>> for CountMatrix<A>
source§impl<A: Clone + Alphabet> Clone for CountMatrix<A>
impl<A: Clone + Alphabet> Clone for CountMatrix<A>
source§fn clone(&self) -> CountMatrix<A>
fn clone(&self) -> CountMatrix<A>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<A: PartialEq + Alphabet> PartialEq for CountMatrix<A>
impl<A: PartialEq + Alphabet> PartialEq for CountMatrix<A>
source§fn eq(&self, other: &CountMatrix<A>) -> bool
fn eq(&self, other: &CountMatrix<A>) -> bool
self and other values to be equal, and is used
by ==.