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 (
Optional
[ndarray
]) – The user supplied expression (embedding) data that will be used for graph hodege decomposition directly.layer (
Optional
[str
]) – Which layer of the data will be used for graph Hodge decomposition.basis (
str
) – Which basis of the data will be used for graph Hodge decomposition.n (
int
) – Number of nearest neighbors when the nearest neighbor graph is not included.VecFld (
Optional
[dict
]) – The reconstructed vector field function.adjmethod (
str
) – 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
) – 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
) – Whether to assign calculated potential, curl and divergence to cells not sampled based on values from their nearest sampled cells.sampling_method (
str
) – 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
) – 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
) – Whether to enforce the calculation of adjacency matrix for estimating potential, curl, divergence for each cell.cores (
int
) – 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