scHopfield.tools.compute_umap

scHopfield.tools.compute_umap(adata: AnnData, spliced_key: str = 'Ms', n_neighbors: int = 30, min_dist: float = 0.1, basis: str = 'umap', copy: bool = False) AnnData | None[source]

Compute UMAP embedding from gene expression data.

Performs dimensionality reduction using UMAP on the selected gene expression layer. The UMAP model is stored in adata.uns[‘scHopfield’][‘embedding’] and the 2D coordinates are stored in adata.obsm[f’X_{basis}’].

Parameters:
  • adata (AnnData) – Annotated data object

  • spliced_key (str, optional (default: 'Ms')) – Key in adata.layers for expression data to use

  • n_neighbors (int, optional (default: 30)) – Number of neighbors for UMAP

  • min_dist (float, optional (default: 0.1)) – Minimum distance parameter for UMAP

  • basis (str, optional (default: 'umap')) – Name for the embedding basis (stored as ‘X_{basis}’ in obsm)

  • copy (bool, optional (default: False)) – Whether to return a copy or modify in place

Returns:

Returns AnnData if copy=True, otherwise modifies in place and returns None

Return type:

Optional[AnnData]