Apply a random resample of cell identifier in Seurat object. Original cell type proportion in Seurat dataset will be preserved when non-spatial sampling strategy is applied. With spatial resampling, rare/sparse cell types will be less penalised from resampling compared to more abundant and spatially dense cell type, with a sampling proportion that tends to be inversely correlated with the initial cell type relative abundance
resample_cells(
seurat = NULL,
label = "cell_types",
spatial = T,
maxcells = 10000,
seed = 347548,
return.seurat = T,
update.kandinsky = T
)
Seurat object
character string indicating meta data variable containing cell type annotation
boolean, whether or not applying a spatially-informed resampling
numeric, ideal number of cells to resample. When `spatial` is true, an optimal number of cells as close as possible to `maxcells` argument will be sampled by testing multiple resampling resolution parameters
numeric, random seed for reproducibility
boolean, whether returning resampled IDs (FALSE) or the whole seurat object already filtered with resampled IDs (TRUE)
boolean, whether or not update Kandinsky data after resampling. Default is TRUE. Only applied when `return.seurat` is TRUE
vector of resampled cell IDs or Seurat object with resampled cell subset