dynamo.pd.state_graph
- dynamo.pd.state_graph(adata, group, method='vf', transition_mat_key='pearson_transition_matrix', approx=False, eignum=5, basis='umap', layer=None, arc_sample=False, sample_num=100, prune_graph=False, **kwargs)[source]
Estimate the transition probability between cell types using method of vector field integrations or Markov chain lumping.
- Parameters
adata (
AnnData
) – AnnData object that will be used to calculate a cell type (group) transition graph.group (str) – The attribute to group cells (column names in the adata.obs).
method (str (default: ‘vf’)) – The method that will be used to construct lumped cell state graph. Must be one of {vf or markov}
transition_mat_key (str (default: ‘pearson_transition_matrix’)) – The key that corresponds to the transition graph used in the KernelMarkovChain class for lumping.
approx (bool (default: False)) – Whether to use streamplot to get the integration lines from each cell.
eignum (int (default: 5)) – The number of eigen-vectors when performing the eigen-decomposition to obtain the stationary distribution. 5 should be sufficient as the stationary distribution will be the first eigenvector. This also accelerates the calculation.
basis (str or None (default: umap)) – The embedding data to use for predicting cell fate. If basis is either umap or pca, the reconstructed trajectory will be projected back to high dimensional space via the inverse_transform function.
layer (str or None (default: None)) – Which layer of the data will be used for predicting cell fate with the reconstructed vector field function. The layer once provided, will override the basis argument and then predicting cell fate in high dimensional space.
sample_num (int (default: 100)) – The number of cells to sample in each group that will be used for calculating the transitoin graph between cell groups. This is required for facilitating the calculation.
prune_graph (bool (default: False)) – Whether to prune the transition graph based on cell similarities in basis bases.
kwargs – Additional parameters that will be passed to prune_transition function.
- Returns
An updated adata object that is added with the group + ‘_graph’ key, including the transition graph
and the average transition time.