dynamo.vf.diffusionMatrix¶
- dynamo.vf.diffusionMatrix(adata, X_data=None, V_data=None, genes=None, layer=None, basis='umap', dims=None, n=30, VecFld=None, residual='vector_field')[source]¶
“Calculate the diffusion matrix from the estimated velocity vector and the reconstructed vector field.
- Parameters
adata (
AnnData
) – an Annodata object.X_data (np.ndarray (default: None)) – The user supplied expression (embedding) data that will be used for calculating diffusion matrix directly.
V_data (np.ndarray (default: None)) – The user supplied velocity data that will be used for calculating diffusion matrix directly.
genes (list or None (default: None)) – The list of genes that will be used to subset the data. If None, all genes will be used.
layer (str or None (default: None)) – Which layer of the data will be used for diffusion matrix calculation.
basis (str (default: umap)) – Which basis of the data will be used for diffusion matrix calculation.
dims (list or None (default: None)) – The list of dimensions that will be selected for diffusion matrix calculation. If None, all dimensions will be used.
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.
residual (str or None (default: vector_field)) – Method to calculate residual velocity vectors for diffusion matrix calculation. If average, all velocity of the nearest neighbor cells will be minused by its average velocity; if vector_field, all velocity will be minused by the predicted velocity from the reconstructed deterministic velocity vector field.
- Returns
adata – AnnData object that is updated with the diffusion_matrix key in the uns attribute which is a list of the diffusion matrix for each cell. A column diffusion corresponds to the square root of the sum of all elements for each cell’s diffusion matrix will also be added.
- Return type