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.

Note

High-level API is deprecated and will be removed in version 2.0. Please use cellrank.kernels and cellrank.estimators instead.

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

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

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

Find initial states of a dynamic process of single cells based on RNA velocity [La Manno et al., 2018].

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

Find terminal states of a dynamic process of single cells based on RNA velocity [La Manno et al., 2018].

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.

Note

cellrank.tl.kernels will be renamed to cellrank.kernels in version 2.0.

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

Kernel which computes a transition matrix based on RNA velocity.

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

Kernel which computes transition probabilities based on similarities among cells.

tl.kernels.PseudotimeKernel(adata[, ...])

Kernel which computes directed transition probabilities based on a KNN graph and pseudotime.

tl.kernels.CytoTRACEKernel(adata[, ...])

Kernel which computes directed transition probabilities based on a KNN graph and the CytoTRACE score [Gulati et al., 2020].

tl.kernels.PrecomputedKernel([...])

Kernel which contains a precomputed transition matrix.

Estimators

Estimators predict cell fates using the transitions derived from Kernels.

Note

cellrank.tl.estimators will be renamed to cellrank.estimators in version 2.0.

tl.estimators.GPCCA(obj[, obsp_key])

Generalized Perron Cluster Cluster Analysis [Reuter et al., 2018] as implemented in pyGPCCA.

tl.estimators.CFLARE(obj[, obsp_key])

Compute the initial/terminal states of a Markov chain via spectral heuristics.

Plotting

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

Plot initial states uncovered by cellrank.tl.initial.

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

Plot terminal states uncovered by cellrank.tl.terminal.

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.circular_projection(adata, keys[, ...])

Plot absorption probabilities on a circular embedding as in [Velten et al., 2017].

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

Plot gene expression trends along lineages.

pl.log_odds(adata, lineage_1[, lineage_2, ...])

Plot log-odds ratio between 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

Note

cellrank.ul.models will be renamed to cellrank.models in version 2.0.

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[, read_callback])

Read file and return anndata.AnnData object.

Datasets

datasets.pancreas([path])

Development of the murine pancreas at E15.5 from [Bastidas-Ponce et al., 2019].

datasets.lung([path])

Regeneration of murine lung epithelial cells at 13 time points from [Strunz et al., 2020].

datasets.reprogramming_morris([subset, path])

Reprogramming of mouse embryonic fibroblasts to induced endoderm progenitors at 8 time points from [Biddy et al., 2018].

datasets.reprogramming_schiebinger([path])

Reprogramming of mouse embryonic fibroblasts to induced pluripotent stem cells at 39 time points from [Schiebinger et al., 2019].

datasets.zebrafish([path])

Zebrafish embryogenesis assayed using drop-seq, restricted to the axial mesoderm lineage from [Farrell et al., 2018].

datasets.pancreas_preprocessed([path])

Development of the murine pancreas at E15.5 from [Bastidas-Ponce et al., 2019], preprocessed according to the basic tutorial.