lineage.Analyze
Calls the tHMM functions and outputs the parameters needed to generate the Figures.
Functions
|
Runs the tHMM function through Baum Welch fitting for a list containing a set of data for different concentrations. |
|
This function runs the analyze function for the case when we want to fit multiple conditions at the same time. |
|
A function that can be parallelized to speed up figure creation. |
|
This function calculates several results of fitting a synthetic lineage and stores it in a dictionary. |
|
This function takes the tHMMobj and the predicted states, |
|
Find out the map between the assigned and true states by finding the closest pairs of parameters. |
Module Contents
- lineage.Analyze.fit_list(tHMMobj_list, tolerance=1e-06, max_iter=200, rng=None)
Runs the tHMM function through Baum Welch fitting for a list containing a set of data for different concentrations.
- Parameters:
tHMMobj_list (list[lineage.tHMM.tHMM]) -- all lineage trees we want to fit at once
tolerance (float) -- the stopping criteria for fitting. when the likelihood does not change more than tolerance from one step to the other, the fitting converges.
max_iter (int) -- the maximum number of iterations for fitting
- Return MSD_list:
marginal state distributions for all populations we fit at once
- Return NF:
normalizing factor
- Return betas:
beta values (conditional probability of cell states given cell observations)
- Return gammas:
gamma values (used to calculate the downward reursion)
- Return new_LL:
the log-likelihood of the optimized solution
- Return type:
tuple[list[list[numpy.ndarray]], list[list[list[numpy.ndarray]]], float]
- lineage.Analyze.Analyze_list(pop_list, num_states, fpi=None, fT=None, rng=None, write_states=False)
This function runs the analyze function for the case when we want to fit multiple conditions at the same time. :param pop_list: The list of cell populations to run the analyze function on. :param num_states: The number of states that we want to run the model for. :return tHMMobj_list: The tHMMobj after fitting corresponding to the given LineageTree population. :return pred_states_by_lineage_by_conc: The list of cells in each lineage with states assigned to each cell. :return LL: The log-likelihood of the fitted model.
- Parameters:
pop_list (list)
num_states (int)
- Return type:
tuple[list[lineage.tHMM.tHMM], float, list[list[list[numpy.ndarray]]]]
- lineage.Analyze.run_Analyze_over(list_of_populations, num_states, atonce=False, list_of_fpi=None, list_of_fT=None)
A function that can be parallelized to speed up figure creation.
This function is the outermost for-loop we will end up using when analyzing heterogenous populations or lineages.
Analyze is the bottleneck in the figure creation process. The rest of the code involved in figure creation deals with collecting and computing certain statistics, most of which can be done in an additional for loop over the results from Analyze. :param list_of_populations: The list of cell populations to run the analyze function on. :param num_states: The number of states that we want to run the model for. :return output: The list of results from fitting a lineage.
- Parameters:
list_of_populations (list[list])
num_states (numpy.ndarray)
- Return type:
list[tuple[list[lineage.tHMM.tHMM], float, list[numpy.ndarray]]]
- lineage.Analyze.Results(tHMMobj, LL)
This function calculates several results of fitting a synthetic lineage and stores it in a dictionary. The dictionary contains the total number of lineages, the log likelihood of state assignments, and the total number of cells. It also contains metrics such as the accuracy of state assignment predictions, the distance between two distributions, and the Wasserstein distance between two states. :param tHMMobj: An instantiation of the tHMM class. :param LL: The log-likelihood of the fitted model. :return results_dict: A dictionary containing metrics of accuracy and scoring for the results of fitting a lineage.
- Parameters:
tHMMobj (lineage.tHMM.tHMM)
LL (float)
- Return type:
dict[str, Any]
- lineage.Analyze.permute_states(tHMMobj, switch_map)
This function takes the tHMMobj and the predicted states, and finds out whether we need to switch the state identities or not based on the likelihood. :param tHMMobj: An instantiation of the tHMM class. :param switch_map: An array of the likelihood of predicted states. :return tHMMobj: An instantiation of the tHMM class. :return pred_states_switched: A list of lineages with switched states.
- Parameters:
tHMMobj (lineage.tHMM.tHMM)
switch_map (numpy.ndarray)
- Return type:
tuple[Any, list]
- lineage.Analyze.cheat(tHMMobj)
Find out the map between the assigned and true states by finding the closest pairs of parameters.
- Parameters:
tHMMobj (lineage.tHMM.tHMM)
- Return type:
numpy.ndarray