cellrank.tl.kernels.VelocityKernel

class cellrank.tl.kernels.VelocityKernel(adata, backward=False, vkey='velocity', xkey='Ms', gene_subset=None, compute_cond_num=False, check_connectivity=False)[source]

Kernel which computes a transition matrix based on velocity correlations.

This borrows ideas from both [Manno18] and [Bergen20]. In short, for each cell i, we compute transition probabilities \(p_{i, j}\) to each cell j in the neighborhood of i. The transition probabilities are computed as a multinomial logistic regression where the weights \(w_j\) (for all j) are given by the vector that connects cell i with cell j in gene expression space, and the features \(x_i\) are given by the velocity vector \(v_i\) of cell i.

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

  • backward (bool) – Direction of the process.

  • vkey (str) – Key in adata .uns where the velocities are stored.

  • xkey (str) – Key in adata .layers where expected gene expression counts are stored.

  • gene_subset (Optional[Iterable]) – List of genes to be used to compute transition probabilities. By default, genes from adata .var['velocity_genes'] are used.

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

pearson_correlations

The matrix containing Pearson correlations.

transition_matrix

Return row-normalized transition matrix.

Methods

compute_transition_matrix([mode, …])

Compute transition matrix based on velocity directions on the local manifold.

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.