Compiled date: 2022-11-01
Last edited: 2022-08-01
License: GPL-3
Run the following code to install the Bioconductor version of package.
# install.packages("BiocManager")
BiocManager::install("POMA")
library(POMA)
library(patchwork)
Let’s create a cleaned SummarizedExperiment
object from the sample st000336
data to explore the normalization effects.
# imputation using the default method KNN
example_data <- st000336 %>%
PomaImpute()
method argument is empty! KNN will be used
example_data
class: SummarizedExperiment
dim: 30 57
metadata(0):
assays(1): ''
rownames(30): x1_methylhistidine x3_methylhistidine ... pyruvate
succinate
rowData names(0):
colnames(57): DMD004.1.U02 DMD005.1.U02 ... DMD167.5.U02 DMD173.1.U02
colData names(2): group steroids
Here we will evaluate ALL normalization methods that POMA offers on the same SummarizedExperiment
object to compare them (Berg et al. 2006).
none <- PomaNorm(example_data, method = "none")
auto_scaling <- PomaNorm(example_data, method = "auto_scaling")
level_scaling <- PomaNorm(example_data, method = "level_scaling")
log_scaling <- PomaNorm(example_data, method = "log_scaling")
log_transformation <- PomaNorm(example_data, method = "log_transformation")
vast_scaling <- PomaNorm(example_data, method = "vast_scaling")
log_pareto <- PomaNorm(example_data, method = "log_pareto")
When we check for the dimension of the data after normalization we can see that ALL methods have the same effect on data dimension. PomaNorm
only change the data dimension when the data have features that only have zeros and when the data have features with 0 variance. Only in these two cases PomaNorm
will remove features of the data, changing the data dimensions.
dim(SummarizedExperiment::assay(none))
> [1] 30 57
dim(SummarizedExperiment::assay(auto_scaling))
> [1] 30 57
dim(SummarizedExperiment::assay(level_scaling))
> [1] 30 57
dim(SummarizedExperiment::assay(log_scaling))
> [1] 30 57
dim(SummarizedExperiment::assay(log_transformation))
> [1] 30 57
dim(SummarizedExperiment::assay(vast_scaling))
> [1] 30 57
dim(SummarizedExperiment::assay(log_pareto))
> [1] 30 57
Here we can evaluate the different normalization effects on samples (Berg et al. 2006).
a <- PomaBoxplots(none,
group = "samples",
jitter = FALSE) +
ggplot2::ggtitle("Not Normalized")
b <- PomaBoxplots(auto_scaling,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Auto Scaling") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
c <- PomaBoxplots(level_scaling,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Level Scaling") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
d <- PomaBoxplots(log_scaling,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Log Scaling") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
e <- PomaBoxplots(log_transformation,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Log Transformation") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
f <- PomaBoxplots(vast_scaling,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Vast Scaling") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
g <- PomaBoxplots(log_pareto,
group = "samples",
jitter = FALSE,
legend_position = "none") +
ggplot2::ggtitle("Log Pareto") +
ggplot2::theme(axis.text.x = ggplot2::element_blank())
a
(b + c + d) / (e + f + g)
Here we can evaluate the different normalization effects on features.
h <- PomaDensity(none,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Not Normalized")
i <- PomaDensity(auto_scaling,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Auto Scaling") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
j <- PomaDensity(level_scaling,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Level Scaling") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
k <- PomaDensity(log_scaling,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Log Scaling") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
l <- PomaDensity(log_transformation,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Log Transformation") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
m <- PomaDensity(vast_scaling,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Vast Scaling") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
n <- PomaDensity(log_pareto,
group = "features",
legend_position = "none") +
ggplot2::ggtitle("Log Pareto") +
ggplot2::theme(axis.title.x = ggplot2::element_blank(),
axis.title.y = ggplot2::element_blank())
h
(i + j + k) / (l + m + n)
sessionInfo()
> R version 4.2.1 (2022-06-23)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 20.04.5 LTS
>
> Matrix products: default
> BLAS: /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
> LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_GB LC_COLLATE=C
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats4 stats graphics grDevices utils datasets methods
> [8] base
>
> other attached packages:
> [1] patchwork_1.1.2 SummarizedExperiment_1.28.0
> [3] Biobase_2.58.0 GenomicRanges_1.50.0
> [5] GenomeInfoDb_1.34.0 IRanges_2.32.0
> [7] S4Vectors_0.36.0 BiocGenerics_0.44.0
> [9] MatrixGenerics_1.10.0 matrixStats_0.62.0
> [11] plotly_4.10.0 ggraph_2.1.0
> [13] ggplot2_3.3.6 POMA_1.8.0
> [15] BiocStyle_2.26.0
>
> loaded via a namespace (and not attached):
> [1] circlize_0.4.15 backports_1.4.1 plyr_1.8.7
> [4] igraph_1.3.5 lazyeval_0.2.2 splines_4.2.1
> [7] BiocParallel_1.32.0 listenv_0.8.0 digest_0.6.30
> [10] foreach_1.5.2 htmltools_0.5.3 viridis_0.6.2
> [13] magick_2.7.3 fansi_1.0.3 magrittr_2.0.3
> [16] doParallel_1.0.17 cluster_2.1.4 limma_3.54.0
> [19] ComplexHeatmap_2.14.0 recipes_1.0.2 globals_0.16.1
> [22] graphlayouts_0.8.3 gower_1.0.0 rARPACK_0.11-0
> [25] hardhat_1.2.0 colorspace_2.0-3 ggrepel_0.9.1
> [28] xfun_0.34 dplyr_1.0.10 crayon_1.5.2
> [31] RCurl_1.98-1.9 jsonlite_1.8.3 impute_1.72.0
> [34] survival_3.4-0 iterators_1.0.14 glue_1.6.2
> [37] polyclip_1.10-4 gtable_0.3.1 ipred_0.9-13
> [40] zlibbioc_1.44.0 XVector_0.38.0 GetoptLong_1.0.5
> [43] DelayedArray_0.24.0 future.apply_1.9.1 shape_1.4.6
> [46] scales_1.2.1 DBI_1.1.3 Rcpp_1.0.9
> [49] viridisLite_0.4.1 clue_0.3-62 proxy_0.4-27
> [52] lava_1.7.0 prodlim_2019.11.13 glmnet_4.1-4
> [55] htmlwidgets_1.5.4 httr_1.4.4 FNN_1.1.3.1
> [58] RColorBrewer_1.1-3 ellipsis_0.3.2 pkgconfig_2.0.3
> [61] farver_2.1.1 uwot_0.1.14 nnet_7.3-18
> [64] sass_0.4.2 utf8_1.2.2 caret_6.0-93
> [67] tidyselect_1.2.0 labeling_0.4.2 rlang_1.0.6
> [70] reshape2_1.4.4 munsell_0.5.0 tools_4.2.1
> [73] cachem_1.0.6 cli_3.4.1 dbscan_1.1-11
> [76] generics_0.1.3 broom_1.0.1 evaluate_0.17
> [79] stringr_1.4.1 fastmap_1.1.0 yaml_2.3.6
> [82] ModelMetrics_1.2.2.2 knitr_1.40 tidygraph_1.2.2
> [85] purrr_0.3.5 randomForest_4.7-1.1 glasso_1.11
> [88] future_1.28.0 nlme_3.1-160 compiler_4.2.1
> [91] png_0.1-7 e1071_1.7-12 tibble_3.1.8
> [94] tweenr_2.0.2 bslib_0.4.0 stringi_1.7.8
> [97] highr_0.9 RSpectra_0.16-1 lattice_0.20-45
> [100] Matrix_1.5-1 vegan_2.6-4 permute_0.9-7
> [103] vctrs_0.5.0 pillar_1.8.1 lifecycle_1.0.3
> [106] BiocManager_1.30.19 GlobalOptions_0.1.2 jquerylib_0.1.4
> [109] data.table_1.14.4 bitops_1.0-7 corpcor_1.6.10
> [112] R6_2.5.1 bookdown_0.29 gridExtra_2.3
> [115] parallelly_1.32.1 codetools_0.2-18 MASS_7.3-58.1
> [118] assertthat_0.2.1 rjson_0.2.21 withr_2.5.0
> [121] GenomeInfoDbData_1.2.9 mgcv_1.8-41 parallel_4.2.1
> [124] mixOmics_6.22.0 grid_4.2.1 rpart_4.1.19
> [127] timeDate_4021.106 tidyr_1.2.1 class_7.3-20
> [130] rmarkdown_2.17 Cairo_1.6-0 pROC_1.18.0
> [133] ggforce_0.4.1 lubridate_1.8.0 ellipse_0.4.3
Berg, Robert A van den, Huub CJ Hoefsloot, Johan A Westerhuis, Age K Smilde, and Mariët J van der Werf. 2006. “Centering, Scaling, and Transformations: Improving the Biological Information Content of Metabolomics Data.” BMC Genomics 7 (1): 142.