View source: R/Object_Utilities.R
Random_Cells_Downsample | R Documentation |
Get a randomly downsampled set of cell barcodes with even numbers of cells for each identity class. Can return either as a list (1 entry per identity class) or vector of barcodes.
Random_Cells_Downsample(
seurat_object,
num_cells,
group.by = NULL,
return_list = FALSE,
allow_lower = FALSE,
seed = 123
)
seurat_object |
Seurat object |
num_cells |
number of cells per ident to use in down-sampling. This value must be less than or equal to the size of ident with fewest cells. Alternatively, can set to "min" which will use the maximum number of barcodes based on size of smallest group. |
group.by |
The ident to use to group cells. Default is NULL which use current active.ident. . |
return_list |
logical, whether or not to return the results as list instead of vector, default is FALSE. |
allow_lower |
logical, if number of cells in identity is lower than |
seed |
random seed to use for downsampling. Default is 123. |
either a vector or list of cell barcodes
library(Seurat)
# return vector of barcodes
random_cells <- Random_Cells_Downsample(seurat_object = pbmc_small, num_cells = 10)
head(random_cells)
# return list
random_cells_list <- Random_Cells_Downsample(seurat_object = pbmc_small, return_list = TRUE,
num_cells = 10)
head(random_cells_list)
# return max total number of cells (setting `num_cells = "min`)
random_cells_max <- Random_Cells_Downsample(seurat_object = pbmc_small, num_cells = "min")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.