cellrank.external.kernels.WOTKernel
- class cellrank.external.kernels.WOTKernel(adata, backward=False, time_key='exp_time', **kwargs)[source]
Waddington optimal transport kernel from [Schiebinger et al., 2019].
This class requires the wot package, which can be installed as pip install git+https://github.com/broadinstitute/wot.
- Parameters
adata (
anndata.AnnData
) – Annotated data object.backward (
bool
) – Direction of the process.time_key (
str
) – Key inanndata.AnnData.obs
where experimental time is stored. The experimental time can be of either of a numeric or an ordered categorical type.kwargs (
Any
) – Keyword arguments for the parent class.
Examples
Workflow:
# import packages, load data import scanpy as sc import cellrank as cr adata = cr.datasets.lung() # filter, normalize and annotate highly variable genes sc.pp.filter_genes(adata, min_cells=10) sc.pp.normalize_total(adata) sc.pp.log1p(adata) sc.pp.highly_variable_genes(adata) # estimate proliferation and apoptosis from gene sets (see. e.g. WOT tutorial for example lists) proliferation_genes = ... apoptosis_genes = ... sc.tl.score_genes(adata, gene_list=proliferation_genes, score_name='proliferation') sc.tl.score_genes(adata, gene_list=apoptosis_genes, score_name='apoptosis') # initialize kernel, estimate initial growth rate based on scores from above from cellrank.external.kernels import WOTKernel ot = WOTKernel(adata, time_key='day') ot.compute_initial_growth_rates(proliferation_key='proliferation', apoptosis_key='apoptosis', key_added='initial_growth_rates') # compute transport maps, aggregate into one single transition matrix ot.compute_transition_matrix(growth_rate_key='initial_growth_rates', growth_iters=3)
Attributes
Annotated data object.
None.
Estimated cell growth rates for each growth rate iteration.
Underlying base kernels.
Parameters which are used to compute the transition matrix.
(n_cells, n_cells)
.Row-normalized transition matrix.
Methods
compute_initial_growth_rates
([...])Estimate initial growth rates using a birth-death process as described in [Schiebinger et al., 2019].
compute_transition_matrix
([cost_matrices, ...])Compute transition matrix using Waddington OT [Schiebinger et al., 2019].
copy
([deep])Not implemented.
plot_projection
([basis, key_added, ...])Plot
transition_matrix
as a stream or a grid plot.plot_random_walks
([n_sims, max_iter, seed, ...])Plot random walks in an embedding.
plot_single_flow
(cluster, cluster_key, time_key)Visualize outgoing flow from a cluster of cells [Mittnenzweig et al., 2021].
read
(fname[, adata, copy])Deserialize self from a file.
write
(fname[, write_adata, ext])Serialize self to a file.
write_to_adata
([key, copy])Write the transition matrix and parameters used for computation to the underlying
adata
object.