Skip to contents

Create a downsampled copy of a ScPhyloExpressionSet object with fewer cells per identity.

Usage

downsample(phyex_set, downsample = 10)

Arguments

phyex_set

A ScPhyloExpressionSet object

downsample

Integer, number of cells to keep per identity (default: 10)

Value

A new ScPhyloExpressionSet object with downsampled cells

Details

This function creates a new ScPhyloExpressionSet with a subset of cells, maintaining the same proportional representation across identities. The sampling is stratified by the current selected_idents grouping. All metadata and reductions are filtered to match the selected cells.

Examples

if (FALSE) { # \dontrun{
# Downsample to 20 cells per identity
small_set <- downsample(sc_phyex_set, downsample = 20)

# Change grouping and downsample
sc_phyex_set@selected_idents <- "treatment"
treatment_set <- downsample(sc_phyex_set, downsample = 15)
} # }