Randomly sample x cells from each sample in a SingleCellExperiment to return a subsampled SingleCellExperiment with all samples having maximum n cells. If n is higher than the number of cell in a sample, this sample will not be subsampled.

subsample_scExp(scExp, n_cells = 500)

Arguments

scExp

A SingleCellExperiment

n_cells

An integer number of cells to subsample for each sample (500)

Value

A subsampled SingleCellExperiment

Examples

#> ChromSCape::create_scExp - the matrix has 300 cells and 600 features.
scExp_sub = subsample_scExp(scExp,50)
#> ChromSCape::subsample_scExp - Subsampling each sample to 50
#> ChromSCape::create_scExp - the matrix has 200 cells and 600 features.
if (FALSE) num_cell_scExp(scExp_sub)