- dynamo.vf.divergence(adata, cell_idx=None, sampling=None, sample_ncells=1000, basis='pca', vector_field_class=None, method='analytical', store_in_adata=True, **kwargs)[source]
Calculate divergence for each cell with the reconstructed vector field function.
AnnData) – AnnData object that contains the reconstructed vector field function in the uns attribute.
basis (str or None (default: umap)) – The embedding data in which the vector field was reconstructed.
scVectorField.vectorfield) – If not None, the divergene will be computed using this class instead of the vector field stored in adata.
method (str (default: analytical)) – The method that will be used for calculating divergence, either analytical or numeric. analytical method will use the analytical form of the reconstructed vector field for calculating divergence while numeric method will use numdifftools for calculation. analytical method is much more efficient.
store_in_adata (bool (default: True)) – Whether to store the divergence result in adata.
kwargs – Any additional keys that will be passed to vector_field_class.compute_divergence function.
AnnData object that is updated with the ‘divergence’ key in the .obs.