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 1 1 0 #> [2,] 0 0 2 0 1 #> [3,] 2 2 1 0 0 #> [4,] 2 0 2 3 0 #> [5,] 0 1 1 1 0
mat_norm <- LogNormalize(data = mat) mat_norm
#> 5 x 5 sparse Matrix of class "dgCMatrix" #> #> [1,] 7.601402 7.824446 7.265130 7.601402 . #> [2,] . . 7.957927 . 9.21044 #> [3,] 8.294300 8.517393 7.265130 . . #> [4,] 8.294300 . 7.957927 8.699681 . #> [5,] . 7.824446 7.265130 7.601402 .