Divides the counts of each cell by its size factor and takes \(\log_2(x + 1)\). By default the size factors are the library sizes, centred to mean 1. This gives the same values as the defaults of scuttle::logNormCounts(), which Bioconductor 3.24 deprecates.

logNormTransf(
  sce,
  assayName = "counts",
  targetAssay = "logcounts",
  sizeFactors = NULL
)

Arguments

sce

A SingleCellExperiment or SummarizedExperiment object.

assayName

Name of the count assay.

targetAssay

Name of the new assay.

sizeFactors

Optional positive size factors, one per cell. The default NULL uses the library sizes (column sums of the counts).

Value

sce with the log-normalised assay targetAssay and the size factors, centred to mean 1, in colData(sce)$sizeFactor. A sparse or DelayedArray count matrix gives a dgCMatrix, a dense one a dense matrix.

See also

scranTransf() for pooled size factors, logTransf() for log1p() of counts or relative counts.

Examples

sce <- scuttle::mockSCE(ncells = 20, ngenes = 10)
sce <- logNormTransf(sce)
assay(sce, "logcounts")[1:3, 1:3]