gedi2py.tools.pseudotime

gedi2py.tools.pseudotime(adata, start_cells, *, use_rep=None, key='gedi', key_added='gedi_pseudotime', copy=False)[source]

Compute pseudotime ordering based on GEDI embeddings.

Uses diffusion-based pseudotime computation on the GEDI latent representation to order cells along a trajectory.

Parameters:
  • adata (AnnData) – Annotated data matrix with GEDI results.

  • start_cells (ndarray | list) – Indices or boolean mask of cells to use as trajectory start points.

  • use_rep (str | None, default: None) – Representation to use. Defaults to X_{key}_pca or X_{key}.

  • key (str, default: 'gedi') – Key in adata.uns where GEDI results are stored.

  • key_added (str, default: 'gedi_pseudotime') – Key to store pseudotime in adata.obs.

  • copy (bool, default: False) – If True, return pseudotime array instead of storing in adata.

Return type:

AnnData | ndarray | None

Returns:

  • If ``copy=True``, returns pseudotime array (n_cells,).

  • Otherwise, stores in ``adata.obs[key_added]`` and returns ``None`.`

Notes

This is a simple geodesic distance-based pseudotime. For more sophisticated trajectory inference, consider using specialized tools like scanpy’s PAGA or scvelo.

Examples

>>> import gedi2py as gd
>>> # Use cells in cluster 0 as starting point
>>> start_cells = adata.obs["cluster"] == "0"
>>> gd.tl.pseudotime(adata, start_cells)
>>> adata.obs["gedi_pseudotime"]