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