Normalize gene expression data using TPM normalization followed
by log2(x+1) transformation.
Usage
normalize_expression(data, scale_factor = 1e+06, use_cpp = TRUE)
Arguments
- data
Gene expression matrix (genes x cells/spots). Can be a matrix,
data.frame, or sparse Matrix.
- scale_factor
Scaling factor for normalization. Default is 1e6 (TPM).
- use_cpp
Logical. If TRUE, use C++ implementation. Default is TRUE.
Value
Normalized matrix with the same dimensions as input.
Details
The normalization performs:
TPM normalization: \(x_{ij} = x_{ij} / \sum_i x_{ij} \times 10^6\)
Log transformation: \(x_{ij} = \log_2(x_{ij} + 1)\)
This is the standard normalization used in CytoSPACE for computing
cell-to-spot similarities.
Examples
if (FALSE) { # \dontrun{
normalized <- normalize_expression(counts_matrix)
} # }