capital.tl.trajectory_tree

capital.tl.trajectory_tree(adata, root_node=None, method='euclid', dimension='pca', tree=None, groupby='leiden')

Calculate a trajectory tree.

Specify AnnData and the root name in the trajectory.

You can pass your metadata in adata.obs by passing a key in adata.obs to groupby.

You can also define your own tree by drawing it as nx.DiGraph and pass it to tree.

Parameters:
  • adata (AnnData) – The annotated data matrix.

  • root_node (Optional[str]) – A given cluster is used as the root for the tree. If None, it calculates a most likely root of the tree, but this will not be reliable for the moment. Please set the root cluster, by default None.

  • method (Literal["euclid", "gauss", "paga"]) – Method for calculating the tree, by default “euclid.”

  • dimension (Literal["pca", "diffmap"]) – The data for calculating the trajectory tree, by default “pca.”

  • tree (Optional[nx.DiGraph]) – If None, it calculates the trajectory tree. If nx.DiGraph is given, the tree is constructed from the nx.DiGraph, by default None.

  • groupby (str) – Key for categorical in adata.obs. You can pass your metadata of clusters, by default “leiden.”