scvelo.pp.moments(data, n_neighbors=30, n_pcs=None, mode='connectivities', method='umap', use_rep=None, copy=False)

Computes moments for velocity estimation.

data : AnnData

Annotated data matrix.

n_neighbors : int (default: 30)

Number of neighbors to use.

n_pcs : int (default: None)

Number of principal components to use. If not specified, the full space is used of a pre-computed PCA, or 30 components are used when PCA is computed internally.

mode : ‘connectivities’ or ‘distances’ (default: ‘connectivities’)

Distance metric to use for moment computation.

method : {{‘umap’, ‘gauss’, ‘hnsw’, ‘sklearn’, None}} (default: ‘umap’)

Use ‘umap’ [McInnes18] or ‘gauss’ (Gauss kernel following [Coifman05] with adaptive width [Haghverdi16]) for computing connectivities.

use_rep : None, ‘X’ or any key for .obsm (default: None)

Use the indicated representation. If None, the representation is chosen automatically: for .n_vars < 50, .X is used, otherwise ‘X_pca’ is used.

copy : bool (default: False)

Return a copy instead of writing to adata.


  • Returns or updates adata with the attributes
  • Ms (.layers) – dense matrix with first order moments of spliced counts.
  • Mu (.layers) – dense matrix with first order moments of unspliced counts.