step.models.knn_map

Overview

Function

knn_random_coords(adata, Y_spatial, k, use_rep, library_id)

Assigns random coordinates to the nearest neighbors from scRNA-seq data for spatial data.

Functions

knn_random_coords(adata: anndata.AnnData, Y_spatial: numpy.ndarray, k: int = 6, use_rep: str = 'X_rep', library_id: str | None = None)

Assigns random coordinates to the nearest neighbors from scRNA-seq data for spatial data.

Parameters:
  • adata (AnnData) – Annotated data object.

  • Y_spatial (np.ndarray) – Spatial coordinates.

  • k (int, optional) – Number of nearest neighbors. Defaults to 6.

  • use_rep (str, optional) – Representation to use. Defaults to ‘X_rep’.

  • library_id (str, optional) – Library ID. Defaults to None.

Returns:

AnnData object of spatial data with scRNA-seq data mapped.

Return type:

AnnData