spcoral.analysis.mapping_slides#
- spcoral.analysis.mapping_slides(adata_slide1, adata_slide2, n_merge=5, use_obsm='spatial')#
Map expression profiles from one spatial slide onto the geometry of another slide via nearest-neighbor averaging.
- Parameters:
adata_slide1 (anndata.AnnData) – Target slide whose spatial coordinates will be used for the output. Spots in this object define the new grid positions.
adata_slide2 (anndata.AnnData) – Source slide containing the expression/features to be transferred. Must have compatible spatial coordinates in
obsm[use_obsm].n_merge (int, optional (default: 5)) – Number of nearest neighbors in
adata_slide2to average for each spot inadata_slide1.use_obsm (str, optional (default: 'spatial')) – Key in
.obsmcontaining spatial coordinates (n_obs × 2 array).
- Returns:
New AnnData object with: -
.X: averaged expression matrix of shape (n_spots_slide1 × n_genes_slide2) -.obs: observation names fromadata_slide1-.var: variable (gene/feature) names fromadata_slide2-.obsm[use_obsm]: spatial coordinates copied fromadata_slide1Spots with no valid neighbors (extremely rare) are filtered out.- Return type: