diff --git a/src/bootstrap.rs b/src/bootstrap.rs index 6384d7f..74bcaf8 100644 --- a/src/bootstrap.rs +++ b/src/bootstrap.rs @@ -1,6 +1,9 @@ use rand::distributions::{Distribution, Uniform}; use rand::Rng; +/// Get a random uniform sample of `n` numbers in the range [0,n). +/// Duplicates are explicitly allowed. The numbers are returned in +/// sorted order. pub fn get_sample_inds(n: usize, rng: &mut R) -> Vec { let dist = Uniform::new(0, n); let mut inds: Vec = dist.sample_iter(rng).take(n).collect(); diff --git a/src/em.rs b/src/em.rs index f4b83ff..55349d8 100644 --- a/src/em.rs +++ b/src/em.rs @@ -65,7 +65,6 @@ fn m_step_par<'a>( /// Then, `curr_counts` is computed by summing over the expected assignment /// likelihood for all reads mapping to each target. #[inline] -#[allow(dead_code)] fn m_step<'a, I: Iterator>( eq_map_iter: I, _tinfo: &[TranscriptInfo], @@ -103,6 +102,15 @@ fn m_step<'a, I: Iterator>( } } +/// The code that actually performs the EM loop in the single-threaded context. +/// The parameters are +/// `em_info` : an [EMInfo] struct that contains the relevant parameters and data +/// `make_iter`: a function that returns an iterator over the alignments and conditional +/// probabilites +/// `do_log`: `true` if logging information is written about this EM run and false otherwise +/// +/// returns: +/// A [Vec] represented the expected read assignments to each transcript. pub fn do_em<'a, I: Iterator + 'a, F: Fn() -> I>( em_info: &'a EMInfo, make_iter: F,