Define size factors from the library sizes, and then apply centering at unity. This ensures that the library size adjustment yields values comparable to those generated after normalization with other sets of size factors.

estimateSizeFactors(object, ...)

# S4 method for SummarizedExperiment
estimateSizeFactors(object,
  type = c("mean-ratio", "geometric-mean-ratio",
  "log-geometric-mean-ratio"), center = 1L)

# S4 method for SingleCellExperiment
estimateSizeFactors(object,
  type = c("mean-ratio", "geometric-mean-ratio",
  "log-geometric-mean-ratio"), center = 1L)

Arguments

object

Object.

type

character(1). Method for estimation:

libSize <- colSums(counts(object))
  • mean-ratio:

    libSize / mean(libSize)
    
  • geometric-mean-ratio:

    libSize / geometricMean(libSize)
    
  • mean-geometric-mean-log-total:

    log(libSize) / geometricMean(log(libSize))
    
center

numeric(1). If non-zero, scales all size factors so that the average size factor across cells is equal to the value defined. Set to 0 to disable centering.

...

Additional arguments.

Value

Modified object. Use `sizeFactors() to access the computed size factor numeric.

Details

Centering of size factors at unity ensures that division by size factors yields values on the same scale as the raw counts. This is important for the interpretation of the normalized values, as well as comaprisons between features normalized with different size factors (e.g., spike-ins).

The estimated size factors computed by this function can be accessed using the accessor function sizeFactors(). Alternative library size estimators can also be supplied using the assignment function sizeFactors<-().

Note

We're computing internally on the count matrix as a DelayedArray, so we can handle millions of cells without the calculations blowing up in memory.

Updated 2019-10-09.

See also

DESeq2:

scater:

monocle3:

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) ## SummarizedExperiment ==== object <- RangedSummarizedExperiment object <- estimateSizeFactors(object)
#> Calculating library size factors using 'mean-ratio' method.
#> Centering size factors at 1.
sizeFactors(object)
#> sample01 sample02 sample03 sample04 sample05 sample06 sample07 sample08 #> 0.8937279 0.8624615 0.8613519 0.8979285 0.8959867 0.8479577 1.1537661 1.1251944 #> sample09 sample10 sample11 sample12 #> 1.0686454 1.1293950 1.1334370 1.1301479
## SingleCellExperiment ==== object <- SingleCellExperiment object <- estimateSizeFactors(object)
#> Calculating library size factors using 'mean-ratio' method.
#> Centering size factors at 1.
head(sizeFactors(object))
#> cell001 cell002 cell003 cell004 cell005 cell006 #> 1.0892537 0.9441530 0.6772733 1.0512044 1.6634694 1.0191282