pub struct EcDNADistribution { /* private fields */ }Implementations§
Source§impl EcDNADistribution
impl EcDNADistribution
pub fn new(distribution: HashMap<u16, u64>, iterations: usize) -> Self
pub fn get_nminus(&self) -> &u64
Sourcepub fn is_nplus_empty(&self) -> bool
pub fn is_nplus_empty(&self) -> bool
No cells with ecDNAs are left in the population.
Sourcepub fn pick_remove_random_nplus(
&mut self,
rng: &mut impl Rng,
) -> Result<DNACopy>
pub fn pick_remove_random_nplus( &mut self, rng: &mut impl Rng, ) -> Result<DNACopy>
Returns ecDNA copies of a nplus cell and remove it from the ecDNA distribution. Note that all cells with ecDNAs have the same probability of being choosen, which is true only when we consider constant fitness.
§Fails
Fails when there are no cells with ecDNA in the population, that is
EcDNADistribution::is_nplus_empty.
Sourcepub fn increase_nplus(&mut self, copies: Vec<DNACopy>, verbosity: u8)
pub fn increase_nplus(&mut self, copies: Vec<DNACopy>, verbosity: u8)
Update the ecdna distribution by adding copies to the population
of cells with ecDNAs.
pub fn increase_nminus(&mut self)
pub fn decrease_nplus(&mut self, rng: &mut impl Rng, verbosity: u8)
pub fn decrease_nminus(&mut self)
pub fn compute_nplus(&self) -> u64
pub fn is_empty(&self) -> bool
pub fn load(path2file: &Path, capacity: usize) -> Result<Self>
pub fn save(&self, path2file: &Path, verbosity: u8) -> Result<()>
pub fn into_subsampled<R: Rng>( &self, nb_cells: u64, rng: &mut R, ) -> EcDNADistribution
Sourcepub fn sample<R: Rng>(
&mut self,
nb_cells: u64,
strategy: &SamplingStrategy,
rng: &mut R,
)
pub fn sample<R: Rng>( &mut self, nb_cells: u64, strategy: &SamplingStrategy, rng: &mut R, )
Draw a random sample without replacement from the
EcDNADistribution according to the SamplingStrategy.
§Panics
Panics when nb_cells is greater than the cells in the
distribution or when nb_cells is 0.
Sourcepub fn ks_distance(&self, ecdna: &EcDNADistribution) -> f32
pub fn ks_distance(&self, ecdna: &EcDNADistribution) -> f32
The ks distance represents the maximal absolute distance between the
empirical cumulative distributions of two EcDNADistributions.
§Panics
When the distributions are smaller than 8 samples.
pub fn create_histogram(&self) -> HashMap<u16, u64>
Sourcepub fn drop_cells_with_k_copies(self, k: DNACopy) -> EcDNADistribution
pub fn drop_cells_with_k_copies(self, k: DNACopy) -> EcDNADistribution
Create a new EcDNADistribution without cells with k copies.
If you want to drop cells with 0 copies, use
EcDNADistribution::drop_nminus which doesn’t consume self.
Sourcepub fn drop_nminus(&mut self)
pub fn drop_nminus(&mut self)
Drop all cells without any ecDNA copies (cells with 0 copies).
Sourcepub fn scale_by(self, c: f32) -> Self
pub fn scale_by(self, c: f32) -> Self
Scale (divide) the ecDNA distribution by a constant c.
Since the ecDNA copies DNACopy are integers and, by dividing by
a float, floats can arise, we round the scaled copies using
ceil from std::f32.
§Panics
When c is smaller or equal than 0, is f32::NAN or
f32::INFINITY.
Sourcepub fn compute_mean(&self) -> f32
pub fn compute_mean(&self) -> f32
Returns f32::NAN if no cells are present.
Sourcepub fn compute_variance(&self) -> f32
pub fn compute_variance(&self) -> f32
Compute the variance and returs f32::NAN if no cells are present.
pub fn compute_entropy(&self) -> f32
pub fn compute_frequency(&self) -> f32
Trait Implementations§
Source§impl Clone for EcDNADistribution
impl Clone for EcDNADistribution
Source§fn clone(&self) -> EcDNADistribution
fn clone(&self) -> EcDNADistribution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more