downsampleCounts {scater} | R Documentation |
Downsample a count matrix to a desired proportion.
downsampleCounts(x, prop)
x |
matrix of counts |
prop |
numeric scalar or vector of length |
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.
an integer matrix of downsampled counts
sce10x <- read10xResults(system.file("extdata", package="scater")) downsampled <- downsampleCounts(counts(sce10x), prop = 0.5)