EcDNADistribution

Struct EcDNADistribution 

Source
pub struct EcDNADistribution { /* private fields */ }

Implementations§

Source§

impl EcDNADistribution

Source

pub fn new(distribution: HashMap<u16, u64>, iterations: usize) -> Self

Source

pub fn get_nminus(&self) -> &u64

Source

pub fn is_nplus_empty(&self) -> bool

No cells with ecDNAs are left in the population.

Source

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.

Source

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.

Source

pub fn increase_nminus(&mut self)

Source

pub fn decrease_nplus(&mut self, rng: &mut impl Rng, verbosity: u8)

Source

pub fn decrease_nminus(&mut self)

Source

pub fn compute_nplus(&self) -> u64

Source

pub fn is_empty(&self) -> bool

Source

pub fn load(path2file: &Path, capacity: usize) -> Result<Self>

Source

pub fn save(&self, path2file: &Path, verbosity: u8) -> Result<()>

Source

pub fn into_subsampled<R: Rng>( &self, nb_cells: u64, rng: &mut R, ) -> EcDNADistribution

Source

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.

Source

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.

Source

pub fn create_histogram(&self) -> HashMap<u16, u64>

Source

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.

Source

pub fn drop_nminus(&mut self)

Drop all cells without any ecDNA copies (cells with 0 copies).

Source

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.

Source

pub fn compute_mean(&self) -> f32

Returns f32::NAN if no cells are present.

Source

pub fn compute_variance(&self) -> f32

Compute the variance and returs f32::NAN if no cells are present.

Source

pub fn compute_entropy(&self) -> f32

Source

pub fn compute_frequency(&self) -> f32

Trait Implementations§

Source§

impl Clone for EcDNADistribution

Source§

fn clone(&self) -> EcDNADistribution

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 EcDNADistribution

Source§

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

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

impl Display for EcDNADistribution

Source§

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

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

impl From<Vec<u16>> for EcDNADistribution

Source§

fn from(vec: Vec<u16>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for EcDNADistribution

Source§

fn eq(&self, other: &EcDNADistribution) -> 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 Eq for EcDNADistribution

Source§

impl StructuralPartialEq for EcDNADistribution

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

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

Source§

fn vzip(self) -> V