SC2Spa.tl.NRD_CT
- SC2Spa.tl.NRD_CT(neighbors, dis, adata_ref, adata_query, ct_name='simp_name', weight_constant=1, exclude_CTs=['nan'])
Normalized Reciprocal Distance
Calculate the proportion of cell types for ST beads based on the NRD_weight output Predicted cell type proportion will be saved in adata_ref.obs.
Parameters
- neighbors
Matrix of single cell neighbors of ST beads with the shape of (n_beads, n_neighbors)
- dis
corresponding distance matrix of the neighbor matrix
- adata_ref
Reference anndata object. Gene expression matrix should be the shape of (cell, gene). Spatial information should be stored in adata_ref.obs[[x_name, y_name]]
- adata_query
Query anndata object. Gene expression matrix should be the shape of (cell, gene). Cell type annotation should be stored in adata_query.obs[ct_name] Predicted locations should be stored in adata_query.obs[[‘x_transfer’, ‘y_transfer’]]
- dis_min
Distance cutoff that determines if a ST bead and a single cell is paired
- exclude_CTs
A list that contains cell types to be excluded
- weight_constant
A constant added up to the distance between a cell and a ST voxel when calculating the weight of the cell to the ST voxel.
Returns
None