centreSizeFactors {scater} | R Documentation

## Centre size factors at unity

### Description

Scales all size factors so that the average size factor across cells is equal to 1.

### Usage

    centreSizeFactors(object, centre = 1, grouping = NULL)

### Arguments

`object` | A SingleCellExperiment object containing any number (or zero) sets of size factors.
`centre` | A numeric scalar, the value around which all sets of size factors should be centred.
`grouping` | A factor specifying the grouping of cells, where size factors are centred to unity within each group.

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

Specification of `grouping` centres the size factors within each level of the provided factor. This is useful if different batches are sequenced at different depth, by preserving the scale of counts within each batch.

### Value

A SingleCellExperiment with modified size factors that are centred at unity.

### Author(s)

Aaron Lun

### See Also

`areSizeFactorsCentred`

### Examples

    data("sc_example_counts")
    data("sc_example_cell_info")
    example_sce <- SingleCellExperiment(
        assays = list(counts = sc_example_counts),
        colData = sc_example_cell_info
    )

    sizeFactors(example_sce) <- runif(ncol(example_sce))
    sizeFactors(example_sce, "ERCC") <- runif(ncol(example_sce))
    example_sce <- centreSizeFactors(example_sce)

    mean(sizeFactors(example_sce))
    mean(sizeFactors(example_sce, "ERCC"))

[Package scater version 1.8.4 Index]