Normalize count data per cell and transform to log scale

LogNormalize(data, scale.factor = 10000, verbose = TRUE)

Arguments

data

Matrix with the raw count data

scale.factor

Scale the data. Default is 1e4

verbose

Print progress

Value

Returns a matrix with the normalize and log transformed data

Examples

mat <- matrix(data = rbinom(n = 25, size = 5, prob = 0.2), nrow = 5) mat
#> [,1] [,2] [,3] [,4] [,5] #> [1,] 1 1 2 0 0 #> [2,] 2 0 0 1 2 #> [3,] 2 1 2 0 1 #> [4,] 3 0 1 1 2 #> [5,] 2 0 3 0 1
mat_norm <- LogNormalize(data = mat) mat_norm
#> 5 x 5 sparse Matrix of class "dgCMatrix" #> #> [1,] 6.908755 8.517393 7.824446 . . #> [2,] 7.601402 . . 8.517393 8.112028 #> [3,] 7.601402 8.517393 7.824446 . 7.419181 #> [4,] 8.006701 . 7.131699 8.517393 8.112028 #> [5,] 7.601402 . 8.229778 . 7.419181