scHopfield.tools.load_embedding

scHopfield.tools.load_embedding(adata: AnnData, filename: str, basis: str = 'umap', copy: bool = False) AnnData | None[source]

Load UMAP embedding and energy grid data from file.

Loads the UMAP model and grid data from a pickle file saved with save_embedding(). Also transforms the current expression data using the loaded UMAP model to get 2D coordinates.

Parameters:
  • adata (AnnData) – Annotated data object to load embedding into

  • filename (str) – Path to the saved embedding pickle file

  • 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]