Module bio::pattern_matching::pssm
source · Expand description
Create a weight matrix representing a set of aligned reference sequences that constitute a motif, and use this matrix to scan query sequences for occurrences of this motif. Complexity: O(n*m) for motif length n and query length m
The position-specific scoring matrix (PSSM), aka position weight matrix (PWM), algorithm is implemented for both DNA and amino-acid sequences.
Examples
use bio::pattern_matching::pssm::DNAMotif; let pssm = DNAMotif::from_seqs(vec![ b“AAAA“.to_vec(), b“AATA“.to_vec(), b“AAGA“.to_vec(), b“AAAA“.to_vec(), ].as_ref(), None).unwrap(); let start_pos = pssm.score(b“CCCCCAATA“).unwrap().loc; println!(“motif found at position {}”, start_pos);
/* amino acid sequences are supported, too */ use pssm::pattern_matching::pssm::ProtMotif; let pssm = ProtMotif::from_seqs(vec![ b“ARNNYM“.to_vec(), b“ARNRYM“.to_vec(), b“ARNNCM“.to_vec(), b“ARNNYM“.to_vec(), ].as_ref(), None).unwrap();