pub struct ProtMotif {
pub scores: Array2<f32>,
pub min_score: f32,
pub max_score: f32,
}Expand description
Position-specific scoring matrix for protein sequences
Fields§
§scores: Array2<f32>matrix holding weights at each position, indexed by [position, base]
min_score: f32sum of “worst” base at each position
max_score: f32sum of “best” base at each position
Implementations§
Source§impl ProtMotif
impl ProtMotif
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§
Source§impl From<ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>> for ProtMotif
Return a ProtMotif 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 20), and no zeros
appear in the array.
impl From<ArrayBase<OwnedRepr<f32>, Dim<[usize; 2]>>> for ProtMotif
Return a ProtMotif 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 20), and no zeros appear in the array.
Source§impl Motif for ProtMotif
impl Motif for ProtMotif
Source§const MONOS: &'static [u8] = b"ARNDCEQGHILKMFPSTWYV"
const MONOS: &'static [u8] = b"ARNDCEQGHILKMFPSTWYV"
All monomers, in order corresponding to lookup table
Source§fn 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 moreSource§fn incr(mono: u8) -> Result<Array1<f32>>
fn incr(mono: u8) -> Result<Array1<f32>>
Returns an array of length MONO_CT summing to 1. used to build a PSSM
from sequences, potentially including ambiguous monomers (eg, M is either A or C) Read more
Source§fn get_scores(&self) -> &Array2<f32>
fn get_scores(&self) -> &Array2<f32>
Accessor - returns scores matrix
Source§fn get_min_score(&self) -> f32
fn get_min_score(&self) -> f32
Return sum of “worst” base at each position
Source§fn get_max_score(&self) -> f32
fn get_max_score(&self) -> f32
Return sum of “best” base at each position
Source§fn 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 constantSource§fn degenerate_consensus(&self) -> Vec<u8> ⓘ
fn degenerate_consensus(&self) -> Vec<u8> ⓘ
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’
Source§fn 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 moreSource§fn 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 morefn is_empty(&self) -> bool
Source§fn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)>
fn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)>
Returns the un-normalized sum of matching bases, useful for comparing matches from
motifs of different lengths Read more
Source§fn score<C, T>(&self, seq_it: T) -> Result<ScoredPos>
fn score<C, T>(&self, seq_it: T) -> Result<ScoredPos>
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 moreSource§fn 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
impl StructuralPartialEq for ProtMotif
Auto Trait Implementations§
impl Freeze for ProtMotif
impl RefUnwindSafe for ProtMotif
impl Send for ProtMotif
impl Sync for ProtMotif
impl Unpin for ProtMotif
impl UnwindSafe for ProtMotif
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.