rapids_singlecell.tl.diffmap#

rapids_singlecell.tl.diffmap(adata, n_comps=15, *, sort='decrease', density_normalize=True, rng=None, use=None, out=False, neighbors_key=None, key_added=None)[source]#

Diffusion Maps [CLL+05, HBT15].

Diffusion maps has been proposed for visualizing single-cell data. This is a reimplementation of scanpys function.

The width (“sigma”) of the connectivity kernel is implicitly determined by the number of neighbors used to compute the single-cell graph in scanpy.pp.neighbors() or neighbors().

Parameters:
adata AnnData

Annotated data matrix.

n_comps int (default: 15)

The number of dimensions of the representation.

sort Literal['decrease', 'increase'] (default: 'decrease')

Leave as is for the same behavior as scanpy.tl.diffmap().

density_normalize bool (default: True)

Leave as is for the same behavior as scanpy.tl.diffmap().

rng int | integer | Sequence[int] | SeedSequence | Generator | BitGenerator | None (default: None)

Random seed or Generator for reproducibility. The superseded random_state argument is still accepted.

use GraphAcc | str | None (default: None)

The neighborhood graph (connectivities) to use, e.g. A.obsp['k']. Strings are resolved by anndata.acc.AdAcc.resolve(), e.g. 'obsp.k'. If None, the one neighbors() wrote by default.

out MultiAcc | str | bool (default: False)

Where to write the embedding, e.g. A.obsm['dm']; the eigenvalues go to .uns['dm']['evals']. If True, the embedding is returned instead. If False, it is written to the default places below.

Return type:

ndarray | None

Returns:

The embedding if out=True, else None. By default sets (see out for other keys):

adata.obsm['X_diffmap']numpy.ndarray

Diffusion map representation of data, which is the right eigen basis of the transition matrix with eigenvectors as columns.

adata.uns['diffmap_evals']numpy.ndarray

Array of size (number of eigen vectors). Eigenvalues of transition matrix.