cellrank.tl.kernels.ConnectivityKernel
- class cellrank.tl.kernels.ConnectivityKernel(adata, backward=False, conn_key='connectivities', compute_cond_num=False, check_connectivity=False)[source]
Kernel which computes transition probabilities based on similarities among cells.
As a measure of similarity, we currently support:
transcriptomic similarities, computed using e.g.
scanpy.pp.neighbors()
, see [Wolf et al., 2018].spatial similarities, computed using e.g.
squidpy.gr.spatial_neighbors()
, see [Palla et al., 2021].
The resulting transition matrix is symmetric and thus cannot be used to learn about the direction of the biological process. To include this direction, consider combining with a velocity-derived transition matrix via
cellrank.tl.kernels.VelocityKernel
.Optionally, we apply a density correction as described in [Coifman et al., 2005], where we use the implementation of [Haghverdi et al., 2016].
- Parameters
adata (
anndata.AnnData
) – Annotated data object.backward (
bool
) – Direction of the process.conn_key (
str
) – Key inanndata.AnnData.obsp
to obtain the connectivity matrix describing cell-cell similarity.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
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.
(n_cells, n_cells).
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
([density_normalize])Compute transition matrix based on transcriptomic similarity.
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[, adata, copy])Deserialize self from a file.
write
(fname[, write_adata, ext])Serialize self to a file.
write_to_adata
([key])Write the transition matrix and parameters used for computation to the underlying
adata
object.