cellrank.tl.kernels.ConnectivityKernel

class cellrank.tl.kernels.ConnectivityKernel(adata, backward=False, compute_cond_num=False, check_connectivity=False)[source]

Kernel which computes transition probabilities based on transcriptomic similarities.

As a measure for transcriptomic similarity, we use the weighted KNN graph computed using scanpy.pp.neighbors(), see [Wolf18]. By definition, the resulting transition matrix is symmetric and cannot be used to learn about the direction of the developmental process under consideration. However, the velocity-derived transition matrix from cellrank.tl.kernels.VelocityKernel can be combined with the similarity-based transition matrix as a means of regularization.

Optionally, we apply a density correction as described in [Coifman05], where we use the implementation of [Haghverdi16].

Parameters
  • adata (anndata.AnnData) – Annotated data object.

  • 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.

  • check_connectivity (bool) – Check whether the underlying KNN graph is connected.

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_transition_matrix([density_normalize])

Compute transition matrix based on transcriptomic similarity.

copy()

Return a copy of self.

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.