scvelo.utils.get_transition_matrix
- scvelo.utils.get_transition_matrix(adata, vkey='velocity', basis=None, backward=False, self_transitions=True, scale=10, perc=None, threshold=None, use_negative_cosines=False, weight_diffusion=0, scale_diffusion=1, weight_indirect_neighbors=None, n_neighbors=None, vgraph=None, basis_constraint=None)
Computes cell-to-cell transition probabilities.
\[\tilde \pi_{ij} = \frac1{z_i} \exp( \pi_{ij} / \sigma),\]from the velocity graph \(\pi_{ij}\), with row-normalization \(z_i\) and kernel width \(\sigma\) (scale parameter \(\lambda = \sigma^{-1}\)).
Alternatively, use
cellrank.tl.transition_matrix()to account for uncertainty in the velocity estimates.- Parameters:
adata (
AnnData) – Annotated data matrix.vkey (str (default: ‘velocity’)) – Name of velocity estimates to be used.
basis (str or None (default: None)) – Restrict transition to embedding if specified
backward (bool (default: False)) – Whether to use the transition matrix to push forward (False) or to pull backward (True)
self_transitions (bool (default: True)) – Allow transitions from one node to itself.
scale (float (default: 10)) – Scale parameter of gaussian kernel.
perc (float between 0 and 100 or None (default: None)) – Determines threshold of transitions to include.
use_negative_cosines (bool (default: False)) – If True, negatively similar transitions are taken into account.
weight_diffusion (float (default: 0)) – Relative weight to be given to diffusion kernel (Brownian motion)
scale_diffusion (float (default: 1)) – Scale of diffusion kernel.
weight_indirect_neighbors (float between 0 and 1 or None (default: None)) – Weight to be assigned to indirect neighbors (i.e. neighbors of higher degrees).
n_neighbors (int (default: None)) – Number of nearest neighbors to consider around each cell.
vgraph (csr matrix or None (default: None)) – Velocity graph representation to use instead of adata.uns[f’{vkey}_graph’].
- Return type:
Returns sparse matrix with transition probabilities.