SC2Spa.tl.NRD_CT_preprocess
- SC2Spa.tl.NRD_CT_preprocess(adata_ref, adata_query, n_neighbors=1000, dis_cutoff=15)
Apply KNN algorithm to obtain the single cell neighbors of ST beads
Parameters
- adata_ref
Reference anndata object. Gene expression matrix should be the shape of (cell, gene). The predicted coordinates of beads should be stored in adata_ref.obsm[‘spatial_mapping’]
- adata_query
Query anndata object. Gene expression matrix should be the shape of (cell, gene). The predicted coordinates of single cells should be stored in adata_query.obsm[‘spatial_mapping’].
- n_neighbors
Number of the nearest neighbors of a bead or cell. This parameter is for the KNN algorithm
- dis_cutoff
- Maximum distance between a single cell and a ST bead. Only the cells within the cutoff
will be retained for further analysis.
Returns
- neighbors_st
A matrix of single cell neighbors of ST beads with the shape of (n_beads, n_neighbors)
- dis_st
The distance matrix of the neighbor matrix