pub struct SummaryConfig { /* private fields */ }Expand description
Configuration for summary processes. It it used to filter the k-mers during and after graph construction and to make statistical analyses based on k-mer occurrence in the sample groups.
For any statistical analyses regarding the sample groups, the SummaryData
requires a SampleInfo.
The available options are:
- filter the k-mers by
- their number of occurrences
- their quality based on the phred scores from the reads
- their p-values regarding sample groups
- if they occurr in at least a specific fraction of one or both of the sample groups
- filter the k-mer occurrences by the quality - should this disconnect the k-mer, alll occurrences will be used
- set the number of occurrences which is stored with the k-mers to be rounded to a number of significant digits
- choose a statistical test on which the p-value calculation is based, by default this is set to Welch’s t-test; Student’s t-test and the Mann-Whitney U test are also available
By default, all filter options are turned off.
use debruijn::summarizer::{GroupFrac, SummaryConfig, SampleInfo, StatTest};
use debruijn::BaseQuality;
let sample_info = SampleInfo::new(0b1100, 0b0011, vec![100, 100, 100, 100]);
let summary_config = SummaryConfig::new(sample_info.clone())
.with_min_kmer_obs(2)
.with_min_quality(BaseQuality::Medium)
.with_max_p(Some(0.05)) // can also be none which can avoid p-value calculations and save time
.with_group_frac(GroupFrac::One, 0.3);
let summary_config2 = SummaryConfig::new(sample_info.clone())
.with_min_kmer_obs(4)
.with_min_quality_for_edge(BaseQuality::Marginal);
let summary_config3 = SummaryConfig::new(sample_info)
.with_significant(Some(5))
.with_stat_test(StatTest::StudentsTTest);To filter an already constructed graph, please use the original SummaryConfig
and change the settings in plase with the set_... methods. This is so the program
knows that some settings have been changed and corresponding values have
to be re-calculated.
use debruijn::summarizer::{SummaryConfig, SampleInfo, StatTest};
use debruijn::BaseQuality;
let sample_info = SampleInfo::new(0b1100, 0b0011, vec![100, 100, 100, 100]);
let mut summary_config = SummaryConfig::new(sample_info);
// ... construct the graph
summary_config.set_max_p(Some(0.05));
summary_config.set_stat_test(StatTest::StudentsTTest);
// ...By setting the with_min_kmer_obs to 0, k-mers for which all occurences were filtered
out with with_min_quality_for_edge, can still be included, with empty k-mer data.
Implementations§
Source§impl SummaryConfig
impl SummaryConfig
Sourcepub fn new(sample_info: SampleInfo) -> Self
pub fn new(sample_info: SampleInfo) -> Self
make a new SummaryConfig
arguments:
sample_info: aSampleInfowith information about the sample groups, which is required for any statistical analysis
Sourcepub fn empty() -> Self
pub fn empty() -> Self
make an empty SummaryConfig. A proper SampleInfo is required for any
statistical analysis regarding sample groups.
Sourcepub fn with_min_kmer_obs(&self, min_kmer_obs: usize) -> Self
pub fn with_min_kmer_obs(&self, min_kmer_obs: usize) -> Self
produce a new SummaryConfig which will filter k-mers by their number
of observations
Sourcepub fn set_min_kmer_obs(&mut self, min_kmer_obs: usize)
pub fn set_min_kmer_obs(&mut self, min_kmer_obs: usize)
modify the number of k-mers observations required for each k-mer to be included in the graph
Sourcepub fn with_significant(&self, significant_digits: Option<u32>) -> Self
pub fn with_significant(&self, significant_digits: Option<u32>) -> Self
produce a new SummaryConfig which will round the number of observations
of the k-mer to significant_digits
Sourcepub fn set_significant(&mut self, significant_digits: Option<u32>)
pub fn set_significant(&mut self, significant_digits: Option<u32>)
modify the number signigicant digits the number of observations stored with the k-mer will be rounded to
Sourcepub fn with_group_frac(&self, group_frac: GroupFrac, frac_cutoff: f32) -> Self
pub fn with_group_frac(&self, group_frac: GroupFrac, frac_cutoff: f32) -> Self
produce a new SummaryConfig which will require the k-mer to be ovserved
in at least a fraction of frac_cutoff of either one, both or none of the
sample groups
Sourcepub fn set_group_frac(&mut self, group_frac: GroupFrac, frac_cutoff: f32)
pub fn set_group_frac(&mut self, group_frac: GroupFrac, frac_cutoff: f32)
modify the group fract settings which require the k-mer to be ovserved
in at least a fraction of frac_cutoff of either one, both or none of the
sample groups
Sourcepub fn with_max_p(&self, max_p: Option<f32>) -> Self
pub fn with_max_p(&self, max_p: Option<f32>) -> Self
produce a new SummaryConfig which will filter k-mers by their p-value
regarding occurrence in the sample groups
Sourcepub fn set_max_p(&mut self, max_p: Option<f32>)
pub fn set_max_p(&mut self, max_p: Option<f32>)
modify the maximum p-value a k-mer is allowed to have
Sourcepub fn with_stat_test(&self, stat_test: StatTest) -> Self
pub fn with_stat_test(&self, stat_test: StatTest) -> Self
produce a new SummaryConfig which will calculate the p-values based on
the given statistical test
Sourcepub fn set_stat_test(&mut self, stat_test: StatTest)
pub fn set_stat_test(&mut self, stat_test: StatTest)
modify the statistical test, which is used to calculate p-values regarding observations in the two sample groups
Sourcepub fn with_min_quality(&self, min_quality: BaseQuality) -> Self
pub fn with_min_quality(&self, min_quality: BaseQuality) -> Self
produce a new SummaryConfig which will filter k-mers by their quality
Sourcepub fn set_min_quality(&mut self, min_quality: BaseQuality)
pub fn set_min_quality(&mut self, min_quality: BaseQuality)
modify the minimum quality required for each k-mer to be included in the graph
Sourcepub fn with_min_quality_for_edge(
&self,
min_quality_for_edge: BaseQuality,
) -> Self
pub fn with_min_quality_for_edge( &self, min_quality_for_edge: BaseQuality, ) -> Self
produce a new SummaryConfig which will keep k-mers from being counted
if it’s quality is too low - should this disconnect the k-mer it will
still be counted
Sourcepub fn set_min_quality_for_edge(&mut self, min_quality_for_edge: BaseQuality)
pub fn set_min_quality_for_edge(&mut self, min_quality_for_edge: BaseQuality)
modify the minimum quality required for each k-mer observation for its edges to be counted
Sourcepub fn get_markers(&self) -> (Marker, Marker)
pub fn get_markers(&self) -> (Marker, Marker)
get the binary encoded group affiliation of tags
Sourcepub fn sample_info(&self) -> &SampleInfo
pub fn sample_info(&self) -> &SampleInfo
get the SampleInfo stored in the SummaryConfig
Trait Implementations§
Source§impl Clone for SummaryConfig
impl Clone for SummaryConfig
Source§fn clone(&self) -> SummaryConfig
fn clone(&self) -> SummaryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SummaryConfig
impl Debug for SummaryConfig
Source§impl<'de> Deserialize<'de> for SummaryConfig
impl<'de> Deserialize<'de> for SummaryConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SummaryConfig
impl PartialEq for SummaryConfig
Source§impl Serialize for SummaryConfig
impl Serialize for SummaryConfig
impl StructuralPartialEq for SummaryConfig
Auto Trait Implementations§
impl Freeze for SummaryConfig
impl RefUnwindSafe for SummaryConfig
impl Send for SummaryConfig
impl Sync for SummaryConfig
impl Unpin for SummaryConfig
impl UnsafeUnpin for SummaryConfig
impl UnwindSafe for SummaryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.