Starting from a list of Kandinsky neighbourhoods, this function will select a random subset of cells/spots within each neighbourhood given a maximum expected neighbourhood size specified by the user
nb_downsize(seurat = NULL, exp_links = 6, seed = 347548, keep_symmetric = NULL)a Seurat object containing Kandinsky data slot
numeric, maximum number of expected cells/spots within each neighbourhood after the downsizing
numeric, random seed for reproducibility
boolean, whether to force adjacency matrix symmetry after subsampling. If NULL, it will be set to TRUE for proximity-based neighbour methods (Q/C/M), and FALSE for remaining methods (K/D)
seurat object with updated neighbourhoods
Neighbourhoods will be used in the form of an adjacency matrix. If neighbourhood relationships are symmetric (as for neighbourhoods created with Queen contiguity and Centroid/Membrane distance methods), the resulting neighbourhood matrix must be symmetric even after the downsizing. Therefore, an additional step to ensure matrix symmetry is applied after the downsizing, and for this reason some neighbourhoods might still include a number of cells/spots higher than the user-provided threshold.