mira.time.get_branch_probabilities#
- mira.time.get_branch_probabilities(adata, terminal_cells=None)#
Simulate forward random walks through transport map modeling stochastic differentiation process. For each cell, calculate probability of diffusing through map to each terminal state provided by user.
- Parameters
- adataanndata.AnnData
Adata with a transition matrix in .obsp[“transport_map”]
- terminal_cellsdict of format
{“lineage_name” : int (cell number), …} or {“lineage_name” : str (cell barcode), …} A dictionary mapping lineage names to cells marking terminal states. Cells may be indicated by cell number / index, or by barcode.
- Returns
- adataanndata.AnnData
- .obsm[“branch_probs”]np.ndarray[float] of shape (n_cells,n_lineages)
Probability of reaching each terminal state following random walk through transport map from each cell.
- .obs[“differentiation_entropy”]np.ndarray[float] of shape (n_cells,)
Entropy of differentiation probabilities for each cell.
- .uns[“lineage_names”]list[str]
List of lineage names.
- `.uns[“terminal_cells”]list[str]
List of terminal cell barcodes for each lineage.
- .obs[“<lineage_1>_prob”], …, .obs[“<lineage_L>_prob”]np.ndarray[float] of shape (n_cells,)
Column added for the probability of reaching each terminal state for each cell.
Examples
The user must provide a dictionary with keys as terminal state names and values as the representative terminal cell. The cell may be indicated by barcode/obs_name or index number.
>>> mira.time.get_branch_probabilities(adata, terminal_cells = { ... "A" : "TATGCGCATCGCGCGC", "B" : "GCGTGGCATCGCGCGC" ... }) >>> sc.pl.umap(data, color = [x + '_prob' for x in data.uns['lineage_names']], ... color_map='magma')
Note
This function is part of the mira.time API and works with several others to help users understand lineage structures and dynamic processes in their data. Please refer to the pseudotime trajectory inference tutorial.