fn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)>
    where
        C: Borrow<u8>,
        T: IntoIterator<Item = C>,
    {
        let pssm_len = self.len();

        let mut best_start = 0;
        let mut best_score = -1.0;
        let mut best_m = Vec::new();
        // we have to look at slices, so a simple iterator won't do
        let seq = seq_it.into_iter().map(|c| *c.borrow()).collect_vec();
        let scores = self.get_scores();
        for start in 0..=seq.len() - pssm_len {
            let m: Vec<f32> = match (0..pssm_len)
                .map(|i| match Self::lookup(seq[start + i]) {
                    Err(e) => Err(e),
                    Ok(pos) => Ok(scores[[i, pos]]),
                })
                .collect()
            {
                Ok(m) => m,
                Err(e) => return Err(e),
            };
            let tot = m.iter().sum();
            if tot > best_score {
                best_score = tot;
                best_start = start;
                best_m = m;
            }
        }
        Ok((best_start, best_score, best_m))
    }
/// Returns the un-normalized sum of matching bases, useful for comparing matches from
/// motifs of different lengths
///
/// # Arguments
/// * `seq_it` - iterator representing the query sequence
///
/// # Errors
/// * `Error::InvalidMonomer(mono)` - sequence `seq_it` contained invalid monomer `mono`
Returns the un-normalized sum of matching bases, useful for comparing matches from
motifs of different lengths
Returns the un - normalized sum of matching bases useful for comparing matches from motifs of different lengths
fn raw_score<C, T>(&self, seq_it: T) -> Result<(usize, f32, Vec<f32>)>
    where
        C: Borrow<u8>,
        T: IntoIterator<Item = C>,
    {
        let pssm_len = self.len();
        let mut best_start = 0;
        let mut best_score = -1.0;
        let mut best_m = Vec::new();
        // we have to look at slices, so a simple iterator won't do
        let seq = seq_it.into_iter().map(|c| *c.borrow()).collect_vec();
        let scores = self.get_scores();
        for start in 0..=seq.len() - pssm_len {
            let m: Vec<f32> = match (0..pssm_len)
                .map(|i| match Self::lookup(seq[start + i]) {
                    Err(e) => Err(e),
                    Ok(pos) => Ok(scores[[i, pos]]),
                })
                .collect()
            {
                Ok(m) => m,
                Err(e) => return Err(e),
            };
            let tot = m.iter().sum();
            if tot > best_score {
                best_score = tot;
                best_start = start;
                best_m = m;
            }
        }
        Ok((best_start, best_score, best_m))
    }
fn raw_score < C , T > ( & self , seq_it : T ) -> Result < ( usize , f32 , Vec < f32 > ) > where C : Borrow < u8 > , T : IntoIterator < Item = C > , { let pssm_len = self . len ( ) ; let mut best_start = 0 ; let mut best_score = - 1.0 ; let mut best_m = Vec :: new ( ) ; // we have to look at slices, so a simple iterator won't do let seq = seq_it . into_iter ( ) . map ( | c | * c . borrow ( ) ) . collect_vec ( ) ; let scores = self . get_scores ( ) ; for start in 0 ..= seq . len ( ) - pssm_len { let m : Vec < f32 > = match ( 0 .. pssm_len ) . map ( | i | match Self :: lookup ( seq [ start + i ] ) { Err ( e ) => Err ( e ) , Ok ( pos ) => Ok ( scores [ [ i , pos ] ] ) , } ) . collect ( ) { Ok ( m ) => m , Err ( e ) => return Err ( e ) , } ; let tot = m . iter ( ) . sum ( ) ; if tot > best_score { best_score = tot ; best_start = start ; best_m = m ; } } Ok ( ( best_start , best_score , best_m ) ) }
Returns the un-normalized sum of matching bases, useful for comparing matches from
motifs of different lengths
Returns the un - normalized sum of matching bases useful for comparing matches from motifs of different lengths
&self
seq_it
T
&self
seq_it
T
errors
`Error::InvalidMonomer(mono)` - sequence `seq_it` contained invalid monomer `mono`
` Error :: InvalidMonomer ( mono ) ` - sequence ` seq_it ` contained invalid monomer ` mono `