librarySizeFactors {scater} | R Documentation |
Define per-cell size factors from the library sizes (i.e., total sum of counts per cell).
librarySizeFactors(x, ...) ## S4 method for signature 'ANY' librarySizeFactors(x, subset_row = NULL) ## S4 method for signature 'SummarizedExperiment' librarySizeFactors(x, exprs_values = "counts", ...) computeLibraryFactors(x, ..., altexp = NULL)
x |
For For |
... |
For the For |
subset_row |
A vector specifying whether the size factors should be computed from a subset of rows of |
exprs_values |
String or integer scalar indicating the assay of |
altexp |
String or integer scalar indicating which (if any) alternative experiment should be used to provide the counts to compute the size factors. |
Library sizes are converted into size factors by scaling them so that their mean across cells is unity. This ensures that the normalized values are still on the same scale as the raw counts.
Preserving the scale is useful for interpretation of operations on the normalized values,
e.g., the pseudo-count used in logNormCounts
can actually be considered an additional read/UMI.
This is important for ensuring that the effect of the pseudo-count decreases with increasing sequencing depth.
Setting altexp
is occasionally useful for computing size factors from spike-in transcripts
and using them on the count matrix for endogenous genes (stored in the main experiment).
For librarySizeFactors
, a numeric vector of size factors is returned for all methods.
For computeLibraryFactors
, a numeric vector is also returned for the ANY and SummarizedExperiment methods.
For the SingleCellExperiment method, x
is returned containing the size factors in sizeFactors(x)
.
Aaron Lun
logNormCounts
, where these size factors are used by default.
example_sce <- mockSCE() summary(librarySizeFactors(example_sce))