scvelo.tl.recover_dynamics

scvelo.tl.recover_dynamics(data, var_names='velocity_genes', n_top_genes=None, max_iter=10, assignment_mode='projection', t_max=None, fit_time=True, fit_scaling=True, fit_steady_states=True, fit_connected_states=None, fit_basal_transcription=None, use_raw=False, load_pars=None, return_model=None, plot_results=False, steady_state_prior=None, add_key='fit', copy=False, n_jobs=None, backend='loky', show_progress_bar=True, **kwargs)

Recovers the full splicing kinetics of specified genes.

The model infers transcription rates, splicing rates, degradation rates, as well as cell-specific latent time and transcriptional states, estimated iteratively by expectation-maximization.

https://user-images.githubusercontent.com/31883718/69636459-ef862800-1056-11ea-8803-0a787ede5ce9.png
Parameters:
  • data (AnnData) – Annotated data matrix.

  • var_names (str, list of str (default: ‘velocity_genes’)) – Names of variables/genes to use for the fitting. If var_names=’velocity_genes’ but there is no column ‘velocity_genes’ in adata.var, velocity genes are estimated using the steady state model.

  • n_top_genes (int or None (default: None)) – Number of top velocity genes to use for the dynamical model.

  • max_iter (int (default: 10)) – Maximal iterations in the EM-Algorithm.

  • assignment_mode (str (default: projection)) – Determined how times are assigned to observations. If projection, observations are projected onto the model trajectory. Else uses an inverse approximating formula.

  • t_max (float, False or None (default: None)) – Total range for time assignments.

  • fit_scaling (bool or float or None (default: True)) – Whether to fit scaling between unspliced and spliced.

  • fit_time (bool or float or None (default: True)) – Whether to fit time or keep initially given time fixed.

  • fit_steady_states (bool or None (default: True)) – Whether to explicitly model and fit steady states (next to induction/repression)

  • fit_connected_states (bool or None (default: None)) – Restricts fitting to neighbors given by connectivities.

  • fit_basal_transcription (bool or None (default: None)) – Enables model to incorporate basal transcriptions.

  • use_raw (bool or None (default: None)) – if True, use .layers[‘sliced’], else use moments from .layers[‘Ms’]

  • load_pars (bool or None (default: None)) – Load parameters from past fits.

  • return_model (bool or None (default: True)) – Whether to return the model as :DynamicsRecovery: object.

  • plot_results (bool or None (default: False)) – Plot results after parameter inference.

  • steady_state_prior (list of bool or None (default: None)) – Mask for indices used for steady state regression.

  • add_key (str (default: ‘fit’)) – Key to add to parameter names, e.g. ‘fit_t’ for fitted time.

  • copy (bool (default: False)) – Return a copy instead of writing to adata.

  • n_jobs (int or None (default: None)) – Number of parallel jobs.

  • backend (str (default: “loky”)) – Backend used for multiprocessing. See joblib.Parallel for valid options.

  • show_progress_bar (bool) – Whether to show a progress bar.

Returns:

adata – Updated AnnData with inferred parameters added to .var if copy=True. The inferred parameters are the transcription rates fit_alpha, splicing rates fit_beta, degradation rates fit_gamma, switching times fit_t_, variance scaling factor for unspliced and spliced counts, model likelihoods fit_likelihood, and the scaling factor to align gene-wise latent times to a universal latent time fit_alignment_scaling.

Return type:

AnnData