SC2Spa.tl.Reconstruct_scST

SC2Spa.tl.Reconstruct_scST(adata_ref, adata_query, n_neighbors=1000, dis_cutoff=15, n_layer_cell=[1, 4], cell_radius=5, seed=2023)

Reconstruct ST data at single cell resolution

1 Finely map single cells to spatial locations. A model will be trained and saved to root+name+’.h5’ if model_path is None and save is True. The predicted coordinates of single cells will be saved in adata_query.obsm[‘spatial_mapping’] The predicted coordinates of beads will be saved in adata_ref.obsm[‘spatial_mapping’] Fine mapping information will be saved in adata_ref.obs[‘FM’] and adata_query.obs[‘FM’]. True if a cell/bead was mapped, otherwise False.

2 Reconstruct ST data at single cell resolution adata_query.obs[‘Dis2CloestBead’] stores the distance between a cell and the ST bead closest to it

Parameters

adata_ref

Reference anndata object. Gene expression matrix should be the shape of (cell, gene). Spatial information should be stored in adata_ref.obsm[‘spatial’] in np.array format

adata_query

Query anndata object. Gene expression matrix should be the shape of (cell, gene).

n_neighbors

Number of the nearest neighbors of a bead or cell. This parameter is for the KNN algorithm

dis_cutoff
Limit for the distance between a single cell and a ST bead. In the process

of fine mapping. Only the cells within the cutoff will be retained.

n_layer_cell

Number of cells in layers for sampling single cells for a ST bead.

cell_radius
Radius of a cell. For example, n_layer_cell=[1, 4] and cell_radius=5 means sampling 1 cell

from cells within 5 to a bead and at most 4 cells from cells between 5 and 15 to the bead. It is at most 4 cells because a cell can be sampled more than once to deal with the case that a bead has fewer cells than the user specified.

seed

seed for reconstructing the single-cell ST data