scvelo.tl.velocity

scvelo.tl.velocity(data, vkey='velocity', mode=None, fit_offset=False, fit_offset2=False, filter_genes=False, groups=None, groupby=None, groups_for_fit=None, use_raw=False, perc=[5, 95], copy=False)

Estimates velocities in a gene-specific manner

Parameters:
data : AnnData

Annotated data matrix.

vkey : str (default: ‘velocity’)

Name under which to refer to the computed velocities for velocity_graph and velocity_embedding.

mode : ‘deterministic’, ‘stochastic’ or ‘bayes’ (default: ‘stochastic’)

Whether to run the estimation using the deterministic or stochastic model of transcriptional dynamics. ‘bayes’ solves the stochastic model and accounts for heteroscedasticity, but is slower than ‘stochastic’.

fit_offset : bool (default: False)

Whether to fit with offset for first order moment dynamics.

fit_offset2 : bool, (default: False)

Whether to fit with offset for second order moment dynamics.

filter_genes : bool (default: True)

Whether to remove genes that are not used for further velocity analysis.

groups : str, list (default: None)

Subset of groups, e.g. [‘g1’, ‘g2’, ‘g3’], to which velocity analysis shall be restricted.

groupby : str, list or np.ndarray (default: None)

Key of observations grouping to consider.

groups_for_fit : str, list or np.ndarray (default: None)

Subset of groups, e.g. [‘g1’, ‘g2’, ‘g3’], to which steady-state fitting shall be restricted.

use_raw : bool (default: False)

Whether to use raw data for estimation.

perc : float (default: None)

Percentile, e.g. 98, upon for extreme quantile fit (to better capture steady states for velocity estimation).

copy : bool (default: False)

Return a copy instead of writing to adata.

Returns:

  • Returns or updates adata with the attributes
  • velocity (.layers) – velocity vectors for each individual cell
  • variance_velocity (.layers) – velocity vectors for the cell variances
  • velocity_offset, velocity_beta, velocity_gamma, velocity_r2 (.var) – parameters