Normalize expression using pre-computed size factors
Source:R/AllGenerics.R
, R/normalize-methods.R
normalize.Rd
This function calculates log-normalized size-factor-adjusted counts that
are defined in logcounts()
from the raw, non-normalized count matrix
defined in counts()
.
Details
If no library size factors are defined in sizeFactors()
, these values will
be computed internally automatically using
scuttle::computeLibraryFactors()
.
Examples
data(SingleCellExperiment_splatter, package = "AcidTest")
## SingleCellExperiment ====
object <- SingleCellExperiment_splatter
object <- normalize(object)
#> → Generating "sizeFactors" using scuttle::`computeLibraryFactors()`.
#> → Generating "logcounts" assay using scuttle::`logNormCounts()`.
head(BiocGenerics::sizeFactors(object))
#> cell001 cell002 cell003 cell004 cell005 cell006
#> 1.1197719 1.3368575 1.3180723 0.9077306 0.6311123 1.5813429
SingleCellExperiment::logcounts(object)[seq_len(2L), seq_len(2L)]
#> 2 x 2 sparse Matrix of class "dgCMatrix"
#> cell001 cell002
#> gene001 7.272422 7.168646
#> gene002 10.265281 10.230713