dynamo.vf.torsion(adata, basis='umap', vector_field_class=None, **kwargs)[source]

Calculate torsion for each cell with the reconstructed vector field function. AnnData object that is updated with the torsion key in the .obs.

  • adata (AnnData) – AnnData AnnData object that contains the reconstructed vector field function in the uns attribute.

  • basis (str) – str or None (default: umap) The embedding data in which the vector field was reconstructed.

  • vector_field_class (Optional[BaseVectorField]) – dict The true ODE function, useful when the data is generated through simulation.

  • kwargs – Any additional keys that will be passed to vector_field_class.compute_torsion function.


>>> adata = dyn.sample_data.hematopoiesis()
>>> dyn.tl.reduceDimension(adata, n_components=3, enforce=True, embedding_key='X_umap_3d')
>>> adata
>>> dyn.tl.cell_velocities(adata,
>>>                        X=adata.layers["M_t"],
>>>                        V=adata.layers["velocity_alpha_minus_gamma_s"],
>>>                        basis='umap_3d',
>>>                        )
>>> dyn.vf.VectorField(adata, basis='umap_3d')
>>> dyn.vf.torsion(adata, basis='umap_3d')
>>> dyn.pl.streamline_plot(adata, color='torsion_umap_3d', basis='umap_3d')
>>> dyn.pl.streamline_plot(adata, color='torsion_umap_3d')