dynamo.ext.ddhodge

dynamo.ext.ddhodge(adata, X_data=None, layer=None, basis='pca', n=30, VecFld=None, adjmethod='graphize_vecfld', distance_free=False, n_downsamples=5000, up_sampling=True, sampling_method='velocity', seed=19491001, enforce=False, cores=1)[source]

Modeling Latent Flow Structure using Hodge Decomposition based on the creation of sparse diffusion graph from the reconstructed vector field function. This method is relevant to the curl-free/divergence-free vector field reconstruction.

Parameters
  • adata (AnnData) – an Annodata object.

  • X_data (np.ndarray (default: None)) – The user supplied expression (embedding) data that will be used for graph hodege decomposition directly.

  • layer (str or None (default: None)) – Which layer of the data will be used for graph Hodge decomposition.

  • basis (str (default: pca)) – Which basis of the data will be used for graph Hodge decomposition.

  • n (int (default: 10)) – Number of nearest neighbors when the nearest neighbor graph is not included.

  • VecFld (dictionary or None (default: None)) – The reconstructed vector field function.

  • adjmethod (str (default: graphize_vecfld)) – The method to build the ajacency matrix that will be used to create the sparse diffusion graph, can be either “naive” or “graphize_vecfld”. If “naive” used, the transition_matrix that created during vector field projection will be used; if “graphize_vecfld” used, a method that guarantees the preservance of divergence will be used.

  • n_downsamples (int (default: 5000)) – Number of cells to downsample to if the cell number is large than this value. Three downsampling methods are available, see sampling_method.

  • up_sampling (bool (default: True)) – Whether to assign calculated potential, curl and divergence to cells not sampled based on values from their nearest sampled cells.

  • sampling_method (str (default: random)) – Methods to downsample datasets to facilitate calculation. Can be one of {random, velocity, trn}, each corresponds to random sampling, velocity magnitude based and topology representing network based sampling.

  • seed (int or 1-d array_like, optional (default: 0)) – Seed for RandomState. Must be convertible to 32 bit unsigned integers. Used in sampling control points. Default is to be 0 for ensure consistency between different runs.

  • enforce (bool (default: False)) – Whether to enforce the calculation of adjacency matrix for estimating potential, curl, divergence for each cell.

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

Returns

adata

AnnData object that is updated with the ddhodge key in the obsp attribute which to adjacency matrix that

corresponds to the sparse diffusion graph. Two columns potential and divergence corresponds to the potential and divergence for each cell will also be added.

Return type

AnnData