cellrank.pl.cluster_lineage(adata, model, genes, lineage, backward=False, time_range=None, clusters=None, n_points=200, time_key='latent_time', norm=True, recompute=False, callback=None, ncols=3, sharey=False, key=None, random_state=None, use_leiden=False, show_progress_bar=True, n_jobs=1, backend='loky', figsize=None, dpi=None, save=None, pca_kwargs=mappingproxy({'svd_solver': 'arpack'}), neighbors_kwargs=mappingproxy({'use_rep': 'X'}), clustering_kwargs=mappingproxy({}), return_models=False, **kwargs)[source]

Cluster gene expression trends within a lineage and plot the clusters.

This function is based on Palantir, see [Setty19]. It can be used to discover modules of genes that drive development along a given lineage. Consider running this function on a subset of genes which are potential lineage drivers, identified e.g. by running cellrank.tl.lineage_drivers().

Return type

Optional[Mapping[str, Mapping[str, BaseModel]]]


  • None – If return_models=False, just plots the figure and optionally saves it based on save.

Also updates adata.uns with the following:

  • key or lineage_{lineage}_trend - an anndata.AnnData object of shape (n_genes, n_points) containing the clustered genes.