fn info_content(&self) -> f32 {
        fn ent<'a, I>(probs: I) -> f32
        where
            I: Iterator<Item = &'a f32>,
        {
            probs
                .map(|p| {
                    if *p == 0.0 {
                        0.0
                    } else {
                        -1.0 * *p * p.log(2.0)
                    }
                })
                .sum()
        }
        let bits = Self::get_bits();
        let scores = self.get_scores();
        let mut tot = 0.0;
        for row in scores.genrows() {
            tot += bits - ent(row.iter());
        }
        tot
    }
/// 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
Returns a float representing the information content of a motif; roughly the
inverse of Shannon Entropy.
Returns a float representing the information content of a motif ; roughly the inverse of Shannon Entropy .
fn info_content(&self) -> f32 {
        fn ent<'a, I>(probs: I) -> f32
        where
            I: Iterator<Item = &'a f32>,
        {
            probs
                .map(|p| {
                    if *p == 0.0 {
                        0.0
                    } else {
                        -1.0 * *p * p.log(2.0)
                    }
                })
                .sum()
        }
        let bits = Self::get_bits();
        let scores = self.get_scores();
        let mut tot = 0.0;
        for row in scores.genrows() {
            tot += bits - ent(row.iter());
        }
        tot
    }
fn info_content ( & self ) -> f32 { fn ent < ' a , I > ( probs : I ) -> f32 where I : Iterator < Item = & ' a f32 > , { probs . map ( | p | { if * p == 0.0 { 0.0 } else { - 1.0 * * p * p . log ( 2.0 ) } } ) . sum ( ) } let bits = Self :: get_bits ( ) ; let scores = self . get_scores ( ) ; let mut tot = 0.0 ; for row in scores . genrows ( ) { tot += bits - ent ( row . iter ( ) ) ; } tot }
Returns a float representing the information content of a motif; roughly the
inverse of Shannon Entropy.
Returns a float representing the information content of a motif ; roughly the inverse of Shannon Entropy .
&self
&self