Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Mar 3, 2024
1 parent a7d4f17 commit 6aa54f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/bootstrap.rs
Original file line number Diff line number Diff line change
@@ -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<R: Rng + ?Sized>(n: usize, rng: &mut R) -> Vec<usize> {
let dist = Uniform::new(0, n);
let mut inds: Vec<usize> = dist.sample_iter(rng).take(n).collect();
Expand Down
10 changes: 9 additions & 1 deletion src/em.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Item = (&'a [AlnInfo], &'a [f32], &'a [f64])>>(
eq_map_iter: I,
_tinfo: &[TranscriptInfo],
Expand Down Expand Up @@ -103,6 +102,15 @@ fn m_step<'a, I: Iterator<Item = (&'a [AlnInfo], &'a [f32], &'a [f64])>>(
}
}

/// 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<f64>] represented the expected read assignments to each transcript.
pub fn do_em<'a, I: Iterator<Item = (&'a [AlnInfo], &'a [f32], &'a [f64])> + 'a, F: Fn() -> I>(
em_info: &'a EMInfo,
make_iter: F,
Expand Down

0 comments on commit 6aa54f2

Please sign in to comment.