estimateSizeFactors: Estimate size factors

Description Usage Arguments Details Value Note See Also Examples

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
estimateSizeFactors(object, ...)

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

## S4 method for signature '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.

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<-().

Value

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

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 2020-07-24.

See Also

DESeq2:

scater:

monocle3:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(
    RangedSummarizedExperiment,
    SingleCellExperiment,
    package = "acidtest"
)

## SummarizedExperiment ====
object <- RangedSummarizedExperiment
object <- estimateSizeFactors(object)
sizeFactors(object)

## SingleCellExperiment ====
object <- SingleCellExperiment
object <- estimateSizeFactors(object)
head(sizeFactors(object))

acidgenomics/basejump documentation built on Aug. 15, 2020, 10:21 a.m.