omicverse.pp.umap

Contents

omicverse.pp.umap#

omicverse.pp.umap(adata, *, min_dist=0.5, spread=1.0, n_components=2, maxiter=None, alpha=1.0, gamma=1.0, negative_sample_rate=5, init_pos=None, random_state=0, a=None, b=None, method=None, key_added=None, neighbors_key='neighbors', copy=False, **kwargs)[source]#

Compute UMAP embedding, dispatching to the best backend for ov.settings.mode.

Parameters:
  • adata – Annotated data matrix; neighbors must already be computed.

  • min_dist (float (default: 0.5)) – Minimum distance between embedded points. Default 0.5 matches scanpy; smaller gives more densely packed clusters.

  • spread (float (default: 1.0)) – Scale at which embedded points are spread out.

  • n_components (int (default: 2)) – Output dimensions (2 for typical visualisation).

  • maxiter (int | None (default: None)) – Number of edge-SGD passes. Defaults are backend-specific — scanpy uses 200 for N>10k, 500 otherwise.

  • alpha (float (default: 1.0)) – Initial learning rate of the edge-SGD optimiser. Only used by non-parametric backends.

  • gamma (float (default: 1.0)) – Weighting for negative samples. Default 1.0 matches scanpy.

  • negative_sample_rate (int (default: 5)) – Number of negative samples per positive edge. Default 5.

  • init_pos (default: None) – Embedding initialisation: 'paga', 'spectral', 'random', or an ndarray. None lets the backend pick.

  • random_state (default: 0) – Seed for reproducibility.

  • a (float | None (default: None)) – UMAP curve parameters. None derives them from spread + min_dist via umap.umap_.find_ab_params.

  • b (float | None (default: None)) – UMAP curve parameters. None derives them from spread + min_dist via umap.umap_.find_ab_params.

  • method (str | None (default: None)) – Explicit backend override, e.g. 'umap' (scanpy/umap-learn), 'pumap' (omicverse’s parametric GPU UMAP), 'torchdr', 'mde', 'rapids'. None picks the right default for the current ov.settings.mode.

  • key_added (str | None (default: None)) – Key under which to store results; default 'X_umap' / 'umap'.

  • neighbors_key (str (default: 'neighbors')) – .uns key holding the precomputed neighbor graph.

  • copy (bool (default: False)) – Return a new AnnData instead of modifying in place.

  • **kwargs – Forwarded to the underlying backend (_umap.umap, rapids_singlecell.tl.umap etc.).

Notes

Behaviour by ov.settings.mode:

  • 'cpu' — scanpy / umap-learn (CPU).

  • 'cpu-gpu-mixed' — parametric UMAP on GPU (pumap).

  • anything else ('gpu') — RAPIDS if available, falls back to

    pumap on import error.