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.

  • Dict[str, Dict[str, cellrank.ul.models.BaseModel]] – Otherwise returns the fitted models as {'gene_1': {'lineage_1': <model_11>, ...}, ...}. Models which have failed will be instances of cellrank.ul.models.FailedModel.

    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.