Skip to main content

IlluminaErrorModel

Struct IlluminaErrorModel 

Source
pub struct IlluminaErrorModel { /* private fields */ }
Expand description

Illumina-style position-dependent error model.

Error rate starts at min_error_rate for early cycles and linearly ramps to max_error_rate by the last cycle. The ramp begins at approximately 70% of the read length, mimicking the quality decay caused by phasing and dephasing in Illumina sequencing.

Read 2 has a higher error rate than read 1 (controlled by r2_multiplier), reflecting the typically worse quality of the second read in a pair.

Error probabilities and base quality scores are precomputed at construction time for each cycle and read end, so the per-base hot path is a table lookup rather than repeated floating-point math.

Implementations§

Source§

impl IlluminaErrorModel

Source

pub fn new(read_length: usize, min_error_rate: f64, max_error_rate: f64) -> Self

Create a new Illumina error model with default R2 multiplier (1.5x).

§Arguments
  • read_length — Number of cycles (bases) per read.
  • min_error_rate — Per-base error rate at the start of reads.
  • max_error_rate — Per-base error rate at the end of reads.
§Panics

Panics if read_length is 0 or if min_error_rate > max_error_rate.

Source

pub fn with_r2_multiplier( read_length: usize, min_error_rate: f64, max_error_rate: f64, r2_multiplier: f64, ) -> Self

Create a new Illumina error model with a custom R2 multiplier.

The r2_multiplier scales the entire error curve for read 2 relative to read 1. A value of 1.0 means R1 and R2 have identical error rates.

§Panics

Panics if read_length is 0 or if min_error_rate > max_error_rate.

Trait Implementations§

Source§

impl ErrorModel for IlluminaErrorModel

Source§

fn error_probability(&self, cycle: usize, read_end: ReadEnd) -> f64

Return the probability of a sequencing error at the given cycle position (0-based) for the given read end.
Source§

fn base_quality_phred33(&self, cycle: usize, read_end: ReadEnd) -> u8

Return the Phred+33 base quality score for the given cycle and read end (before per-base noise). Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V