pub struct TfmPvalue<A: Alphabet, M: AsRef<ScoringMatrix<A>>> { /* private fields */ }Expand description
The TFM-PVALUE algorithm.
Implementations§
Source§impl<A: Alphabet, M: AsRef<ScoringMatrix<A>>> TfmPvalue<A, M>
impl<A: Alphabet, M: AsRef<ScoringMatrix<A>>> TfmPvalue<A, M>
Sourcepub fn new(matrix: M) -> Self
pub fn new(matrix: M) -> Self
Initialize the TFM-PVALUE algorithm for the given scoring matrix.
Sourcepub fn into_inner(self) -> M
pub fn into_inner(self) -> M
Extract the wrapped matrix reference.
Sourcepub fn pvalue(&mut self, score: f64) -> f64
pub fn pvalue(&mut self, score: f64) -> f64
Compute the exact P-value for the given score.
§Caution
This method internally calls approximate_pvalue without bounds on
the granularity, which may require a very large amount of memory for
some scoring matrices. Use approximate_pvalue directly to add
limits on the number of iterations or on the granularity.
Sourcepub fn approximate_pvalue(&mut self, score: f64) -> PvaluesIterator<'_, A, M> ⓘ
pub fn approximate_pvalue(&mut self, score: f64) -> PvaluesIterator<'_, A, M> ⓘ
Iterate with decreasing granularity to compute an approximate p-value for a score.
§Example
Approximate a p-value for a score of 10.0 with a granularity of
0.001:
// Initialize the TFM-PVALUE algorithm for a lightmotif PSSM
let mut tfmp = lightmotif_tfmpvalue::TfmPvalue::new(&pssm);
// Compute the p-value for a score by iterating
// until granularity or convergence are reached.
let p_value = tfmp.approximate_pvalue(10.0)
.find(|it| it.converged || it.granularity <= 0.001)
.map(|it| *it.range.start())
.unwrap();Sourcepub fn score(&mut self, pvalue: f64) -> f64
pub fn score(&mut self, pvalue: f64) -> f64
Compute the exact score associated with a given p-value.
§Caution
This method internally calls approximate_score without bounds on
the granularity, which may require a very large amount of memory for
some scoring matrices. Use approximate_score directly to add
limits on the number of iterations or on the granularity.
Sourcepub fn approximate_score(&mut self, pvalue: f64) -> ScoresIterator<'_, A, M> ⓘ
pub fn approximate_score(&mut self, pvalue: f64) -> ScoresIterator<'_, A, M> ⓘ
Iterate with decreasing granularity to compute an approximate score for a p-value.