normalizeCounts {scater}R Documentation

Divide columns of a count matrix by the size factors

Description

Compute (log-)normalized expression values by dividing counts for each cell by the corresponding size factor.

Usage

normalizeCounts(x, size_factors, return_log = TRUE,
  log_exprs_offset = 1, centre_size_factors = FALSE,
  subset_row = NULL)

Arguments

x

A count matrix, with cells in the columns and genes in the rows.

size_factors

A numeric vector of size factors for all cells.

return_log

Logical scalar, should normalized values be returned on the log2 scale?

log_exprs_offset

Numeric scalar specifying the offset to add when log-transforming expression values.

centre_size_factors

Logical scalar indicating whether size fators should be centred.

subset_row

A vector specifying the subset of rows of x for which to return a result.

Details

This function is more memory-efficient than t(t(x)/size_factors), and more generally applicable to different matrix classes than sweep(x, 2, size_factors, "*").

Note that the default centre_size_factors differs from that in normalizeSCE. Users of this function are assumed to know what they're doing with respect to normalization.

Value

A matrix of (log-)normalized expression values.

Author(s)

Aaron Lun

Examples

data("sc_example_counts")
normed <- normalizeCounts(sc_example_counts, 
    librarySizeFactors(sc_example_counts))

[Package scater version 1.10.1 Index]