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) – The method that will be used to construct lumped cell state graph. Must be one of {vf or markov}

  • transition_mat_key (str) – The key that corresponds to the transition graph used in the KernelMarkovChain class for lumping.

  • approx (bool) – Whether to use streamplot to get the integration lines from each cell.

  • eignum (int) – 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 (Optional[str]) – 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 (Optional[str]) – 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.

  • arc_sample (bool) – Whether to uniformly sample data points on the arc curve that are generated from vector field cell fate trajectory predictions.

  • sample_num (int) – 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) – Whether to prune the transition graph based on cell similarities in basis bases.

  • kwargs – Additional parameters that will be passed to prune_transition function.

Return type:

AnnData

Returns:

An updated adata object that is added with the group + ‘_graph’ key, including the transition graph and the average transition time.