stlearn.em.run_diffmap

stlearn.em.run_diffmap(adata: AnnData, n_comps: int = 15, copy: bool = False)[source]

Diffusion Maps [Coifman05] [Haghverdi15] [Wolf18]. Diffusion maps [Coifman05] has been proposed for visualizing single-cell data by [Haghverdi15]. The tool uses the adapted Gaussian kernel suggested by [Haghverdi16] in the implementation of [Wolf18]. The width (“sigma”) of the connectivity kernel is implicitly determined by the number of neighbors used to compute the single-cell graph in neighbors(). To reproduce the original implementation using a Gaussian kernel, use method==’gauss’ in neighbors(). To use an exponential kernel, use the default method==’umap’. Differences between these options shouldn’t usually be dramatic. :param adata: Annotated data matrix. :param n_comps: The number of dimensions of the representation. :param copy: Return a copy instead of writing to adata.

Returns:

  • Depending on copy, returns or updates adata with the following fields.

  • `X_diffmap` (numpy.ndarray (adata.obsm)) – Diffusion map representation of data, which is the right eigen basis of the transition matrix with eigenvectors as columns.

  • `diffmap_evals` (numpy.ndarray (adata.uns)) – Array of size (number of eigen vectors). Eigenvalues of transition matrix.