cellrank.tl.kernels.PrecomputedKernel

class cellrank.tl.kernels.PrecomputedKernel(transition_matrix=None, adata=None, backward=False, compute_cond_num=False, **kwargs)[source]

Kernel which contains a precomputed transition matrix.

Parameters
  • transition_matrix (Union[ndarray, spmatrix, KernelExpression, str, None]) – Row-normalized transition matrix or a key in adata .obsp or a cellrank.tl.kernels.KernelExpression with a precomputed transition matrix. If None, try to determine the key based on backward.

  • adata (anndata.AnnData) – Annotated data object. If None, a temporary placeholder object is created.

  • backward (bool) – Direction of the process.

  • compute_cond_num (bool) – Whether to compute condition number of the transition matrix. Note that this might be costly, since it does not use sparse implementation.

  • kwargs (Any) – Keyword arguments for cellrank.tl.kernels.Kernel.

Attributes

adata

Annotated data object.

backward

Direction of the process.

condition_number

Condition number of the transition matrix.

kernels

Get the kernels of the kernel expression, except for constants.

params

Parameters which are used to compute the transition matrix.

transition_matrix

Return row-normalized transition matrix.

Methods

compute_projection([basis, key_added, copy])

Compute a projection of the transition matrix in the embedding.

compute_transition_matrix(*args, **kwargs)

Return self.

copy()

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)

Deserialize self from a file.

write(fname[, ext])

Serialize self to a file.

write_to_adata([key])

Write the transition matrix and parameters used for computation to the underlying adata object.