, vkey='velocity', xkey='Ms', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None, random_neighbors_at_max=None, sqrt_transform=None, variance_stabilization=None, gene_subset=None, approx=None, copy=False)

Computes velocity graph based on cosine similarities.

The cosine similarities are computed between velocities and potential cell state transitions.

data : AnnData

Annotated data matrix.

vkey : str (default: ‘velocity’)

Name of velocity estimates to be used.

xkey : str (default: ‘Ms’)

Layer key to extract count data from.

tkey : str (default: None)

Observation key to extract time data from.

basis : str (default: None)

Basis / Embedding to use.

n_neighbors : int or None (default: None)

Use fixed number of neighbors or do recursive neighbor search (if None).

n_recurse_neighbors : int (default: 2)

Number of recursions to be done for neighbors search.

random_neighbors_at_max : int or None (default: None)

If number of iterative neighbors for an individual cell is higher than this threshold, a random selection of such are chosen as reference neighbors.

sqrt_transform : bool (default: False)

Whether to variance-transform the cell states changes and velocities before computing cosine similarities.

gene_subset : list of str, subset of adata.var_names or None`(default: `None)

Subset of genes to compute velocity graph on exclusively.

approx : bool or None (default: None)

If True, first 30 pc’s are used instead of the full count matrix

copy : bool (default: False)

Return a copy instead of writing to adata.


  • Returns or updates adata with the attributes
  • velocity_graph (.uns) – sparse matrix with transition probabilities