Skip to main content

apply_errors

Function apply_errors 

Source
pub fn apply_errors(
    model: &impl ErrorModel,
    bases: &mut [u8],
    read_end: ReadEnd,
    rng: &mut impl Rng,
) -> (usize, Vec<u8>)
Expand description

Apply sequencing errors to a read’s bases in place using the given error model, returning the number of errors and quality scores (Phred+33).

For each base position:

  1. Look up error probability and base quality from the model
  2. If a random draw < error probability, substitute a random different base
  3. Assign a quality score by adding noise to the base quality

Returns (n_errors, quality_scores).