scviva.tools.vision.apply_umap#

scviva.tools.vision.apply_umap(adata, obsm_key='X_pca', K=15)[source]#

UMAP 2D projection via scanpy.

Mirrors R VISION’s applyUMAP (which uses uwot::umap). Runs scanpy.pp.neighbors on the latent space stored in adata.obsm[obsm_key], then scanpy.tl.umap. Scanpy writes its neighbour graph into adata.obsp["connectivities"] / "distances", which is separate from VISION’s exponential-kernel weights stored in adata.obsp["weights"] — no conflict.

Parameters:
adata AnnData

Annotated data matrix with latent space in adata.obsm[obsm_key].

obsm_key str

Key in adata.obsm for the latent-space coordinates, by default "X_pca".

K int

Number of nearest neighbours for the UMAP graph, by default 15 (matches R’s default K = round(sqrt(ncol(expr))) context).

Return type:

ndarray

Returns:

ndarray of shape (n_cells, 2) 2D UMAP coordinates (copy of adata.obsm["X_umap"]).