downsampleCounts {scater}R Documentation

Downsample a count matrix

Description

Downsample a count matrix to a desired proportion.

Usage

downsampleCounts(x, prop)

Arguments

x

matrix of counts

prop

numeric scalar or vector of length ncol(x) in [0, 1] indicating the downsampling proportion

Details

Given multiple 10X batches of very different sequencing depths, it can be beneficial to downsample the deepest batches to match the coverage of the shallowest batches. This avoids differences in technical noise that can drive clustering by batch.

Downsampling without replacement is performed on the counts in each cell to generate the output matrix. Each count in the returned matrix is guaranteed to be smaller than the original value in x. This provides an alternative to downsampling in the CellRanger aggr function.

Value

an integer matrix of downsampled counts

Examples

sce10x <- read10xResults(system.file("extdata", package="scater"))
downsampled <- downsampleCounts(counts(sce10x), prop = 0.5)


[Package scater version 1.6.3 Index]