dynamo.vf.VectorField

dynamo.vf.VectorField(adata, basis=None, layer='X', dims=None, genes=None, normalize=False, grid_velocity=False, grid_num=50, velocity_key='velocity_S', method='SparseVFC', return_vf_object=False, map_topography=True, pot_curl_div=False, cores=1, **kwargs)[source]

Learn a function of high dimensional vector field from sparse single cell samples in the entire space robustly.

Parameters
  • adata (AnnData) – AnnData object that contains embedding and velocity data

  • basis (str or None (default: None)) – The embedding data to use. The vector field function will be learned on the low dimensional embedding and can be then projected back to the high dimensional space.

  • layer (str or None (default: X)) – Which layer of the data will be used for vector field function reconstruction. The layer once provided, will override the basis argument and then learn the vector field function in high dimensional space.

  • dims (int, list or None (default: None)) – The dimensions that will be used for reconstructing vector field functions. If it is an int all dimension from the first dimension to dims will be used; if it is a list, the dimensions in the list will be used.

  • genes (list or None (default: None)) – The gene names whose gene expression will be used for vector field reconstruction. By default (when genes is set to None), the genes used for velocity embedding (var.use_for_velocity) will be used for vector field reconstruction. Note that the genes to be used need to have velocity calculated.

  • normalize ('bool' (default: False)) – Logic flag to determine whether to normalize the data to have zero means and unit covariance. This is often required for raw dataset (for example, raw UMI counts and RNA velocity values in high dimension). But it is normally not required for low dimensional embeddings by PCA or other non-linear dimension reduction methods.

  • grid_velocity (bool (default: False)) – Whether to generate grid velocity. Note that by default it is set to be False, but for datasets with embedding dimension less than 4, the grid velocity will still be generated. Please note that number of total grids in the space increases exponentially as the number of dimensions increases. So it may quickly lead to lack of memory, for example, it cannot allocate the array with grid_num set to be 50 and dimension is 6 (50^6 total grids) on 32 G memory computer. Although grid velocity may not be generated, the vector field function can still be learned for thousands of dimensions and we can still predict the transcriptomic cell states over long time period.

  • grid_num (int (default: 50)) – The number of grids in each dimension for generating the grid velocity.

  • velocity_key (str (default: velocity_S)) – The key from the adata layer that corresponds to the velocity matrix.

  • method (str (default: sparseVFC)) – Method that is used to reconstruct the vector field functionally. Currently only SparseVFC supported but other improved approaches are under development.

  • return_vf_object (bool (default: False)) – Whether or not to include an instance of a vectorfield class in the the VecFld dictionary in the uns attribute.

  • map_topography (bool (default: True)) – Whether to quantify the topography of the 2D vector field.

  • pot_curl_div (bool (default: False)) – Whether to calculate potential, curl or divergence for each cell. Potential can be calculated for any basis while curl and divergence is by default only applied to 2D basis. However, divergence is applicable for any dimension while curl is generally only defined for 2/3 D systems.

  • cores (int (default: 1):) – Number of cores to run the ddhodge function. If cores is set to be > 1, multiprocessing will be used to parallel the ddhodge calculation.

  • kwargs – Other additional parameters passed to the vectorfield class.

Returns

adataAnnData object that is updated with the VecFld dictionary in the uns attribute.

Return type

AnnData