- class cellrank.tl.kernels.CytoTRACEKernel(adata, backward=False, layer='Ms', aggregation=CytoTRACEAggregation.MEAN, use_raw=False, compute_cond_num=False, check_connectivity=False, **kwargs)¶
Kernel which computes directed transition probabilities based on a KNN graph and the CytoTRACE score [Gulati et al., 2020].
The KNN graph contains information about the (undirected) connectivities among cells, reflecting their similarity. CytoTRACE can be used to estimate cellular plasticity and in turn, a pseudotemporal ordering of cells from more plastic to less plastic states. This kernel internally uses the
cellrank.tl.kernels.PseudotimeKernelto direct the KNN graph on the basis of the CytoTRACE-derived pseudotime.
anndata.AnnData) – Annotated data object.
bool) – Direction of the process.
Literal[‘mean’, ‘median’, ‘hmean’, ‘gmean’]) –
How to aggregate expression of the top-correlating genes. Valid options are:
’mean’ - arithmetic mean.
’median’ - median.
’hmean’ - harmonic mean.
’gmean’ - geometric mean.
bool) – Whether to compute condition number of the transition matrix. Note that this might be costly, since it does not use sparse implementation.
bool) – Check whether the underlying KNN graph is connected.
# import packages and load data import scvelo as scv import cellrank as cr adata = cr.datasets.pancreas() # standard pre-processing sc.pp.filter_genes(adata, min_cells=10) sc.pp.normalize_total(adata) sc.pp.log1p(adata) sc.pp.highly_variable_genes(adata) # CytoTRACE by default uses imputed data - a simple way to compute KNN-imputed data is to use scVelo's moments # function. However, note that this function expects `spliced` counts because it's designed for RNA velocity, # so we're using a simple hack here: if 'spliced' not in adata.layers or 'unspliced' not in adata.layers: adata.layers['spliced'] = adata.X adata.layers['unspliced'] = adata.X # compute KNN-imputation using scVelo's moments function scv.pp.moments(adata) # import and initialize the CytoTRACE kernel, compute transition matrix - done! from cellrank.tl.kernels import CytoTRACEKernel ctk = CytoTRACEKernel(adata).compute_transition_matrix()
Annotated data object.
Direction of the process.
Condition number of the transition matrix.
Get the kernels of the kernel expression, except for constants.
Parameters which are used to compute the transition matrix.
Pseudotemporal ordering of cells.
Return row-normalized transition matrix.
compute_cytotrace([layer, aggregation, use_raw])
Re-implementation of the CytoTRACE algorithm [Gulati et al., 2020] to estimate cellular plasticity.
compute_projection([basis, key_added, copy])
Compute a projection of the transition matrix in the embedding.
Compute transition matrix based on KNN graph and pseudotemporal ordering.
Return a copy of self.
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 the transition matrix and parameters used for computation to the underlying