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