subset_cells_by_group {celaref} | R Documentation

## subset_cells_by_group

### Description

Utility function to randomly subset very large datasets (that use too much memory). Specify a maximum number of cells to keep per group and use the subsetted version to analysis.

### Usage

    subset_cells_by_group(dataset_se, n.group = 1000)

### Arguments

`dataset_se` | Summarised experiment object containing count data. Also requires 'ID' and 'group' to be set within the cell information.
`n.group` | How many cells to keep for each group. Default = 1000

### Details

The resulting differential expression table de_table will have reduced statistical power. But as long as enough cells are left to reasonably accurately calculate differnetial expression between groups this should be enough for celaref to work with.

Also, this function will lose proportionality of groups (there'll be n.groups or less of each). Consider using the n.group/n.other parameters in contrast_each_group_to_the_rest or contrast_the_group_to_the_rest - which subsets non-group cells independantly for each group. That may be more approriate for tissue type samples which would have similar compositions of cells.

So this function is intended for use when either; the proportionality isn't relevant (e.g. FACs purified cell populations), or, the data is just too big to work with otherwise.

Cells are randomly sampled, so set the random seed (with set.seed()) for consistant results across runs.

### Value

dataset_se A hopefully more managably subsetted version of the inputted dataset_se.

### See Also

`contrast_each_group_to_the_rest` For alternative method of subsetting cells proportionally.

### Examples

    dataset_se.30pergroup <- subset_cells_by_group(demo_query_se, n.group=30)

[Package celaref version 1.10.0 Index]