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<I>(sequences: I) -> Result<Self, InvalidData>
pub fn from_sequences<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 sequence_count(&self) -> usize
pub fn sequence_count(&self) -> usize
Get the number of sequences used to build 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.
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>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<A: Alphabet> Correlation for CountMatrix<A>
impl<A: Alphabet> Correlation for CountMatrix<A>
Source§fn dot(&self, other: &Self, i: usize, j: usize) -> f32
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 auto_correlation(&self, delay: usize) -> f32
fn auto_correlation(&self, delay: usize) -> f32
Compute the auto-correlation with the given delay.
Source§fn cross_correlation(&self, other: &Self) -> f32
fn cross_correlation(&self, other: &Self) -> f32
Compute the cross-correlation between two matrices.
impl<A: Eq + Alphabet> Eq for CountMatrix<A>
impl<A: Alphabet> StructuralPartialEq for CountMatrix<A>
Auto Trait Implementations§
impl<A> Freeze for CountMatrix<A>
impl<A> RefUnwindSafe for CountMatrix<A>
impl<A> Send for CountMatrix<A>where
A: Send,
impl<A> Sync for CountMatrix<A>where
A: Sync,
impl<A> Unpin for CountMatrix<A>
impl<A> UnwindSafe for CountMatrix<A>
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
Mutably borrows from an owned value. Read more