Skip to contents

This function is used to normalize and log-transform the sparse eset object. The default method is "log21p".

Usage

normalizeSparseEset(
  input_eset,
  scale_factor = 1e+06,
  do.logTransform = TRUE,
  log_base = 2,
  log_pseudoCount = 1
)

Arguments

input_eset

The sparse eset object for normalization

scale_factor

Numeric, the library size to normalize to. Default: 1000000.

do.logTransform

Logical, whether to do log-transformation. Default: TRUE.

log_base

Numeric, the base of log-transformation. Usually 2, exp(1) or 10. Default: 2.

log_pseudoCount

Numeric, the pseudo count to add to avoid "-Inf" in log-transformation. Default: 1.

Value

A sparse eset object that has been normalized and log-transformed

Examples

data("pbmc14k_rawCount")
pbmc14k_raw.eset <- createSparseEset(input_matrix = pbmc14k_rawCount, projectID = "PBMC14k", addMetaData = TRUE)
#> Creating sparse eset from the input_matrix ...
#> 	Adding meta data based on input_matrix ...
#> Done! The sparse eset has been generated: 17986 genes, 14000 cells.
pbmc14k_filtered.eset <- filterSparseEset(pbmc14k_raw.eset, filter_mode = "auto", filter_type = "both")
#> Checking the availability of the 5 metrics ('nCell', 'nUMI', 'nFeature', 'pctMito', 'pctSpikeIn') used for filtration ...
#> Checking passed! All 5 metrics are available.
#> Filtration is done!
#> Filtration Summary:
#> 	8846/17986 genes passed!
#> 	13605/14000 cells passed!
#> 
#> For more details:
#> 	Gene filtration statistics:
#> 		Metrics		nCell
#> 		Cutoff_Low	70
#> 		Cutoff_High	Inf
#> 		Gene_total	17986
#> 		Gene_passed	8846(49.18%)
#> 		Gene_failed	9140(50.82%)
#> 
#> 	Cell filtration statistics:
#> 		Metrics		nUMI		nFeature	pctMito		pctSpikeIn	Combined
#> 		Cutoff_Low	458		221		0		0		NA
#> 		Cutoff_High	3694		Inf		0.0408		0.0000		NA
#> 		Cell_total	14000		14000		14000		14000		14000
#> 		Cell_passed	13826(98.76%)	14000(100.00%)	13778(98.41%)	14000(100.00%)	13605(97.18%)
#> 		Cell_failed	174(1.24%)	0(0.00%)	222(1.59%)	0(0.00%)	395(2.82%)

pbmc14k_log2cpm.eset <- normalizeSparseEset(pbmc14k_filtered.eset,
                                            scale_factor = 1000000,
                                            log_base = 2,
                                            log_pseudoCount = 1)
#> Done! The data matrix of eset has been normalized and log-transformed!
#> The returned eset contains: 8846 genes, 13605 cells.