dynamo.tl.pseudotime_velocity¶
- dynamo.tl.pseudotime_velocity(adata, pseudotime='pseudotime', basis='umap', adj_key='distances', ekey='M_s', vkey='velocity_S', add_tkey='pseudotime_transition_matrix', add_ukey='M_u_pseudo', method='hodge', dynamics_info=False, unspliced_RNA=False)[source]¶
Embrace RNA velocity and velocity vector field analysis for pseudotime.
The AnnData object will be updated, inplace, with low-dimensional velocity, pseudotime based transition matrix as well as the pseudotime based RNA velocity.
When you don’t have unspliced/spliced RNA but still want to utilize the velocity/vector field and downstream differential geometry analysis, we can use pseudotime_velocity to convert pseudotime to RNA velocity. Essentially this function computes the gradient of pseudotime and use that to calculate a transition graph (a directed weighted graph) between each cell and use that to learn either the velocity on low dimensional embedding as well as the gene-wise RNA velocity.
- Parameters:
adata (
AnnData) – An AnnData object.pseudotime (
str(default:'pseudotime')) – The key in the adata.obs that corresponds to the pseudotime values. Defaults to “pseudotime”.basis (
str(default:'umap')) – The dictionary key that corresponds to the reduced dimension in .obsm attribute. Can be X_spliced_umap or X_total_umap, etc. Defaults to “umap”.adj_key (
str(default:'distances')) – The dictionary key that corresponds to the adjacency matrix in .obsp attribute. If method is gradient, the weight will be ignored; while it is exponent the weight will be used. Defaults to “distances”.ekey (
str(default:'M_s')) – The dictionary key that corresponds to the gene expression in the layer attribute. This will be used to calculate RNA velocity. Defaults to “M_s”.vkey (
str(default:'velocity_S')) – The dictionary key that will be used to save the estimated velocity values in the layers attribute. Defaults to “velocity_S”.add_tkey (
str(default:'pseudotime_transition_matrix')) – The dictionary key that will be used to keep the pseudotime-based transition matrix. Defaults to “pseudotime_transition_matrix”.add_ukey (
str(default:'M_u_pseudo')) – The dictionary key that will be used to save the estimated “unspliced mRNA”. Since we assume gamma is 0, we thus have M_u_pseudo essentially the estimated high dimensional velocity vector. Defaults to “M_u_pseudo”.method (
Literal['hodge','naive','gradient'] (default:'hodge')) – Which pseudotime to vector field method to be used. There are three different methods, hodge, naive, gradient. By default, the hodge method will be used. Defaults to “hodge”.dynamics_info (
bool(default:False)) – Whether to add dynamics info (a dictionary (with dynamics key to the .uns) to your adata object which is required for downstream velocity and vector field analysis. Defaults to False.unspliced_RNA (
bool(default:False)) – Whether to add an unspliced layer to your adata object which is required for downstream velocity and vector field analysis. Defaults to False.
- Raises:
Exception – method is invalid.
- Return type: