
Count Matrix Processing for GiottoDB Objects
Source:R/processData_libraryNorm.R
processData-dbMatrix-methods.RdprocessData contains methods for GiottoDB objects that provide various normalization and scaling operations on count matrices as implemented in Giotto.
Working methods delegate to existing implementations in Giotto:
Library normalization (
libraryNormParam)Log normalization (
logNormParam)osmFISH normalization (
osmFISHNormParam)Arcsinh transformation (
arcsinhNormParam)L2 normalization (
l2NormParam)Z-score scaling (
zscoreScaleParam)Default normalization (
defaultNormParam) - combines library + logList processing - enables composable operations
Unsupported methods:
TF-IDF normalization (
tfidfNormParam)Quantile normalization (
quantileNormParam)Pearson residuals normalization (
pearsonResidNormParam) - requires dense intermediate matrices incompatible with the sparse backend
Additionally, calculateHVF(expression_values = "scaled") and
normalizeGiotto(scale_feats = TRUE) are not supported for
GiottoDB objects. Feature centering is handled implicitly during
PCA via db_svd.
Usage
processData(x, param, ...)Arguments
- x
dbMatrix object
- param
S4 parameter class defining the transform operation. Can be:
libraryNormParam- library size normalizationlogNormParam- log transformationosmFISHNormParam- osmFISH normalizationarcsinhNormParam- arcsinh transformationl2NormParam- L2/Euclidean normalizationzscoreScaleParam- z-score scalingdefaultNormParam- default normalization (library + log)list- for chained operationstfidfNormParam- not supportedquantileNormParam- not supportedpearsonResidNormParam- not supported
- ...
additional params to pass to the underlying methods
Details
All results are lazily evaluated. Please read dbplyr::collapse.tbl_sql to compute/save results to the db.
See also
processData for the generic and other methods
processExpression for use with giotto objects
normParam, scaleParam for parameter creation
Examples
if (FALSE) { # \dontrun{
# Create a dbMatrix object
library(dbMatrix)
con <- DBI::dbConnect(duckdb::duckdb(), ":memory:")
mat <- matrix(rpois(100, 5), nrow = 10)
dbmat <- dbMatrix(mat, con = con, name = "test")
# Library normalization
lib_norm <- processData(dbmat, normParam("library"))
# Log normalization
log_norm <- processData(dbmat, normParam("log"))
# Chained operations
scaled <- processData(dbmat, list(
normParam("library"),
normParam("log"),
scaleParam("zscore")
))
} # }