lineage.states.StateDistributionGamma

This file is completely user defined. We have provided a general starting point for the user to use as an example.

Module Contents

class lineage.states.StateDistributionGamma.StateDistribution(bern_p=0.9, gamma_a=7, gamma_scale=4.5)

StateDistribution for cells with gamma distributed times.

rvs(self, size: int, rng=None)

User-defined way of calculating a random variable given the parameters of the state stored in their object.

dist(self, other)

Calculate the Wasserstein distance between two gamma distributions that each correspond to a state. This is our way of calculating the distance between two state, when their bernoulli distribution is kept the same. For more information about wasserstein distance, please see https://en.wikipedia.org/wiki/Wasserstein_metric.

dof(self)

Return the degrees of freedom. In this case, each state has 1 bernoulli distribution parameter, and 2 gamma distribution parameters.

logpdf(self, x: np.ndarray)

User-defined way of calculating the log likelihood of the observation stored in a cell. In the case of a univariate observation, the user still has to define how the likelihood is calculated, but has the ability to just return the output of a known scipy.stats.<distribution>.<{pdf,pmf}> function. In the case of a multivariate observation, the user has to decide how the likelihood is calculated. In our example, we assume the observation’s are uncorrelated across the dimensions (across the different distribution observations), so the total log likelihood of observing the multivariate observation is just the sum of the individual observation log likelihoods.

estimator(self, X: list, gammas: np.ndarray)

User-defined way of estimating the parameters given a list of the tuples of observations from a group of cells.

assign_times(self, full_lineage: list[CellVar])

Assigns the start and end time for each cell in the lineage. The time observation will be stored in the cell’s observation parameter list in the second position (index 1). See the other time functions to understand. This is used in the creation of LineageTrees.

censor_lineage(self, censor_condition: int, full_lineage: list[CellVar], desired_experiment_time=2000000000000.0)

This function removes those cells that are intended to be removed. These cells include the descendants of a cell that has died, or has lived beyonf the experimental end time. It takes in LineageTree object, walks through all the cells in the output binary tree, applies the censorship to each cell that is supposed to be removed, and returns the lineage of cells that are supposed to be alive and accounted for.

lineage.states.StateDistributionGamma.fate_censor(cell)

Checks whether a cell has died based on its fate, and if so, it will remove its subtree. Our example is based on the standard requirement that the first observation (index 0) is a measure of the cell’s fate (1 being alive, 0 being dead).

lineage.states.StateDistributionGamma.time_censor(cell, desired_experiment_time: Union[int, float])

Checks whether a cell has lived beyond the experiment end time and if so, it will remove its subtree. Our example is based on the standard requirement that the second observation (index 1) is a measure of the cell’s lifetime.

lineage.states.StateDistributionGamma.atonce_estimator(all_tHMMobj: list, x_list: list, gammas_list: list, phase: str, state_j: int)

Estimating the parameters for one state, in this case bernoulli nad gamma distirbution parameters, given a list of the tuples of observations from a group of cells. gammas_list is only for one state.