Expand description
Position-specific scoring matrix for DNA sequences
Fields
scores: Array2<f32>
matrix holding weights at each position, indexed by [position, base]
min_score: f32
sum of “worst” base at each position
max_score: f32
sum of “best” base at each position
Implementations
sourceimpl DNAMotif
impl DNAMotif
sourcepub fn from_seqs(seqs: &[Vec<u8>], pseudos: Option<&[f32]>) -> Result<Self>
pub fn from_seqs(seqs: &[Vec<u8>], pseudos: Option<&[f32]>) -> Result<Self>
Returns a Motif representing the sequences provided.
Arguments
seqs
- sequences incorporated into motifpseudos
- array slice with a pseudocount for each monomer; defaults to pssm::DEF_PSEUDO for all if None is supplied
FIXME: pseudos should be an array of size MONO_CT, but that is currently impossible - see https://github.com/rust-lang/rust/issues/42863
Trait Implementations
sourceimpl From<ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>> for DNAMotif
impl From<ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>> for DNAMotif
Return a DNAMotif wrapping an Array2 representing amino acid weights at each position. The dimensions and contents of this array are unchecked, and it is incumbent on the user to ensure the correct dimensions are used (ie, SEQ_LEN x 4), and no zeros appear in the array.
sourceimpl Motif for DNAMotif
impl Motif for DNAMotif
sourceconst MONOS: &'static [u8]
const MONOS: &'static [u8]
All monomers, in order corresponding to lookup table
sourcefn rev_lk(idx: usize) -> u8
fn rev_lk(idx: usize) -> u8
Returns the monomer associated with the given index; the reverse of lookup
.
Returns INVALID_MONO if the index isn’t associated with a monomer. Read more
sourcefn get_scores(&self) -> &Array2<f32>
fn get_scores(&self) -> &Array2<f32>
Accessor - returns scores matrix
sourcefn get_min_score(&self) -> f32
fn get_min_score(&self) -> f32
Return sum of “worst” base at each position
sourcefn get_max_score(&self) -> f32
fn get_max_score(&self) -> f32
Return sum of “best” base at each position
sourcefn get_bits() -> f32
fn get_bits() -> f32
Returns information content of a single position.
Used info_content
method.
FIXME: this should be replaced with a CTFE … or maybe just a constant Read more
sourcefn degenerate_consensus(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn degenerate_consensus(&self) -> Vec<u8>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns a representation of the motif using ambiguous codes. Primarily useful for DNA motifs, where ambiguous codes are common (eg, ‘M’ for ‘A or C’); less so for proteins, where we represent any position without a dominant amino acid as an ‘X’ Read more
sourcefn seqs_to_weights(
seqs: &[Vec<u8>],
_pseudos: Option<&[f32]>
) -> Result<Array2<f32>>
fn seqs_to_weights(
seqs: &[Vec<u8>],
_pseudos: Option<&[f32]>
) -> Result<Array2<f32>>
Returns a weight matrix representing the sequences provided.
This code is shared by implementations of from_seqs
Read more
sourcefn lookup(mono: u8) -> Result<usize>
fn lookup(mono: u8) -> Result<usize>
Returns the index of given monomer in the scores matrix using the lookup table LK
Read more
fn is_empty(&self) -> bool
sourcefn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)> where
C: Borrow<u8>,
T: IntoIterator<Item = C>,
fn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)> where
C: Borrow<u8>,
T: IntoIterator<Item = C>,
Returns the un-normalized sum of matching bases, useful for comparing matches from motifs of different lengths Read more
sourcefn score<C, T>(&self, seq_it: T) -> Result<ScoredPos> where
C: Borrow<u8>,
T: IntoIterator<Item = C>,
fn score<C, T>(&self, seq_it: T) -> Result<ScoredPos> where
C: Borrow<u8>,
T: IntoIterator<Item = C>,
Returns a ScoredPos
struct representing the best match within the query sequence
see:
MATCHTM: a tool for searching transcription factor binding sites in DNA sequences
Nucleic Acids Res. 2003 Jul 1; 31(13): 3576–3579
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC169193/ Read more
sourcefn info_content(&self) -> f32
fn info_content(&self) -> f32
Returns a float representing the information content of a motif; roughly the inverse of Shannon Entropy. Adapted from the information content described here: https://en.wikipedia.org/wiki/Sequence_logo#Logo_creation Read more
impl StructuralPartialEq for DNAMotif
Auto Trait Implementations
impl RefUnwindSafe for DNAMotif
impl Send for DNAMotif
impl Sync for DNAMotif
impl Unpin for DNAMotif
impl UnwindSafe for DNAMotif
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more