API

Import CellRank as:

import cellrank as cr

Once velocities and the velocity graph have been computed using either scvelo or velocyto, CellRank offers two modes to interact with its core functionality:

Additionally, there is a set of plotting functions which can be used downstream of either analysis mode.

The utilities are mainly for fitting continuous models to gene expression data and are utilized in some of the plotting functions, like cellrank.pl.gene_trends().

Tools

This module offers a high-level API to compute cell fates and driver genes.

tl.transition_matrix(adata[, backward, …])

Compute a transition matrix based on a combination of RNA Velocity and transcriptomic similarity.

tl.initial_states(adata[, estimator, mode, …])

Find initial states of a dynamic process of single cells based on RNA velocity [Manno18].

tl.terminal_states(adata[, estimator, mode, …])

Find terminal states of a dynamic process of single cells based on RNA velocity [Manno18].

tl.lineages(adata[, backward, copy, …])

Compute probabilistic lineage assignment using RNA velocity.

tl.lineage_drivers(adata[, backward, …])

Compute driver genes per lineage.

Kernels

Kernels are part of the low-level API and are used to estimate cell-to-cell transitions.

tl.kernels.VelocityKernel(adata[, backward, …])

Kernel which computes a transition matrix based on velocity correlations.

tl.kernels.ConnectivityKernel(adata[, …])

Kernel which computes transition probabilities based on transcriptomic similarities.

tl.kernels.PalantirKernel(adata[, backward, …])

Kernel which computes transition probabilities in a similar way to Palantir, see [Setty19].

tl.kernels.PrecomputedKernel([…])

Kernel which contains a precomputed transition matrix.

Estimators

Estimators predict cell fates using the transitions derived from Kernels.

tl.estimators.GPCCA(obj[, inplace, …])

Generalized Perron Cluster Cluster Analysis [GPCCA18].

tl.estimators.CFLARE(obj[, inplace, …])

Clustering and Filtering of Left and Right Eigenvectors based on Markov chains.

Plotting

pl.initial_states(adata[, discrete, states, …])

Plot initial states uncovered by cellrank.tl.initial_states.

pl.terminal_states(adata[, discrete, …])

Plot terminal states uncovered by cellrank.tl.terminal_states.

pl.lineages(adata[, lineages, backward, …])

Plot lineages that were uncovered using cellrank.tl.lineages().

pl.lineage_drivers(adata, lineage[, …])

Plot lineage drivers that were uncovered using cellrank.tl.lineage_drivers().

pl.gene_trends(adata, model, genes[, …])

Plot gene expression trends along lineages.

pl.heatmap(adata, model, genes[, lineages, …])

Plot a heatmap of smoothed gene expression along specified lineages.

pl.cluster_lineage(adata, model, genes, lineage)

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

pl.cluster_fates(adata[, mode, backward, …])

Plot aggregate lineage probabilities at a cluster level.

pl.graph(data[, graph_key, ixs, layout, …])

Plot a graph, visualizing incoming and outgoing edges or self-transitions.

Utilities

ul.models.GAM(adata[, n_knots, …])

Fit Generalized Additive Models (GAMs) using pygam.

ul.models.GAMR(adata[, n_knots, …])

Wrapper around R’s mgcv package for fitting Generalized Additive Models (GAMs).

ul.models.SKLearnModel(adata, model[, …])

Wrapper around sklearn.base.BaseEstimator.

ul.models.FittedModel(x_test, y_test[, …])

Class representing an already fitted model.

ul.models.FailedModel(model[, exc])

Model representing a failure of the original model.

Reading

read(path[, key, read_callback])

Read file and return anndata.AnnData object.

Datasets

datasets.pancreas([path])

Development of the murine pancreas at E15.5 from [Panc19].

datasets.lung([path])

Regeneration of murine lung epithelial cells at 13 time points from [Lung20].

datasets.pancreas_preprocessed([path])

Development of the murine pancreas at E15.5 from [Panc19], preprocessed according to the basic tutorial.