Skip to main content

SummaryConfig

Struct SummaryConfig 

Source
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

Source

pub fn new(sample_info: SampleInfo) -> Self

make a new SummaryConfig

arguments:

  • sample_info: a SampleInfo with information about the sample groups, which is required for any statistical analysis
Source

pub fn empty() -> Self

make an empty SummaryConfig. A proper SampleInfo is required for any statistical analysis regarding sample groups.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn set_max_p(&mut self, max_p: Option<f32>)

modify the maximum p-value a k-mer is allowed to have

Source

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

Source

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

Source

pub fn with_min_quality(&self, min_quality: BaseQuality) -> Self

produce a new SummaryConfig which will filter k-mers by their quality

Source

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

Source

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

Source

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

Source

pub fn get_markers(&self) -> (Marker, Marker)

get the binary encoded group affiliation of tags

Source

pub fn sample_info(&self) -> &SampleInfo

get the SampleInfo stored in the SummaryConfig

Trait Implementations§

Source§

impl Clone for SummaryConfig

Source§

fn clone(&self) -> SummaryConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SummaryConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SummaryConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SummaryConfig

Source§

fn eq(&self, other: &SummaryConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SummaryConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SummaryConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,