Contents

Compiled date: 2023-04-25

Last edited: 2022-08-01

License: GPL-3

1 Installation

Run the following code to install the Bioconductor version of package.

# install.packages("BiocManager")
BiocManager::install("POMA")

2 Load Packages

library(POMA)
library(patchwork)

3 Load Data and Imputation

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

4 Normalization

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")

4.1 Normalization effect on data dimensions

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

4.2 Normalization effect on samples

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)

4.3 Normalization effect on features

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)

5 Session Information

sessionInfo()
> R version 4.3.0 RC (2023-04-13 r84269)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 22.04.2 LTS
> 
> Matrix products: default
> BLAS:   /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so 
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
> 
> 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       
> 
> time zone: America/New_York
> tzcode source: system (glibc)
> 
> attached base packages:
> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
> [8] base     
> 
> other attached packages:
>  [1] patchwork_1.1.2             SummarizedExperiment_1.30.0
>  [3] Biobase_2.60.0              GenomicRanges_1.52.0       
>  [5] GenomeInfoDb_1.36.0         IRanges_2.34.0             
>  [7] S4Vectors_0.38.0            BiocGenerics_0.46.0        
>  [9] MatrixGenerics_1.12.0       matrixStats_0.63.0         
> [11] plotly_4.10.1               ggraph_2.1.0               
> [13] ggplot2_3.4.2               POMA_1.10.0                
> [15] BiocStyle_2.28.0           
> 
> loaded via a namespace (and not attached):
>   [1] splines_4.3.0           bitops_1.0-7            tibble_3.2.1           
>   [4] polyclip_1.10-4         hardhat_1.3.0           pROC_1.18.0            
>   [7] rpart_4.1.19            lifecycle_1.0.3         doParallel_1.0.17      
>  [10] globals_0.16.2          lattice_0.21-8          MASS_7.3-59            
>  [13] backports_1.4.1         magrittr_2.0.3          limma_3.56.0           
>  [16] sass_0.4.5              rmarkdown_2.21          jquerylib_0.1.4        
>  [19] yaml_2.3.7              RColorBrewer_1.1-3      lubridate_1.9.2        
>  [22] zlibbioc_1.46.0         purrr_1.0.1             RCurl_1.98-1.12        
>  [25] nnet_7.3-18             tweenr_2.0.2            ipred_0.9-14           
>  [28] circlize_0.4.15         lava_1.7.2.1            GenomeInfoDbData_1.2.10
>  [31] ggrepel_0.9.3           listenv_0.9.0           ellipse_0.4.5          
>  [34] vegan_2.6-4             RSpectra_0.16-1         parallelly_1.35.0      
>  [37] permute_0.9-7           codetools_0.2-19        DelayedArray_0.26.0    
>  [40] ggforce_0.4.1           tidyselect_1.2.0        shape_1.4.6            
>  [43] farver_2.1.1            viridis_0.6.2           jsonlite_1.8.4         
>  [46] caret_6.0-94            GetoptLong_1.0.5        e1071_1.7-13           
>  [49] tidygraph_1.2.3         survival_3.5-5          iterators_1.0.14       
>  [52] foreach_1.5.2           dbscan_1.1-11           tools_4.3.0            
>  [55] Rcpp_1.0.10             glue_1.6.2              rARPACK_0.11-0         
>  [58] prodlim_2023.03.31      gridExtra_2.3           xfun_0.39              
>  [61] mixOmics_6.24.0         mgcv_1.8-42             dplyr_1.1.2            
>  [64] withr_2.5.0             BiocManager_1.30.20     fastmap_1.1.1          
>  [67] fansi_1.0.4             digest_0.6.31           timechange_0.2.0       
>  [70] R6_2.5.1                colorspace_2.1-0        Cairo_1.6-0            
>  [73] utf8_1.2.3              tidyr_1.3.0             generics_0.1.3         
>  [76] data.table_1.14.8       recipes_1.0.6           corpcor_1.6.10         
>  [79] FNN_1.1.3.2             class_7.3-21            graphlayouts_0.8.4     
>  [82] httr_1.4.5              htmlwidgets_1.6.2       uwot_0.1.14            
>  [85] ModelMetrics_1.2.2.2    pkgconfig_2.0.3         gtable_0.3.3           
>  [88] timeDate_4022.108       ComplexHeatmap_2.16.0   impute_1.74.0          
>  [91] XVector_0.40.0          htmltools_0.5.5         bookdown_0.33          
>  [94] clue_0.3-64             scales_1.2.1            png_0.1-8              
>  [97] gower_1.0.1             knitr_1.42              reshape2_1.4.4         
> [100] rjson_0.2.21            nlme_3.1-162            proxy_0.4-27           
> [103] cachem_1.0.7            GlobalOptions_0.1.2     stringr_1.5.0          
> [106] parallel_4.3.0          pillar_1.9.0            grid_4.3.0             
> [109] vctrs_0.6.2             randomForest_4.7-1.1    cluster_2.1.4          
> [112] evaluate_0.20           magick_2.7.4            cli_3.6.1              
> [115] compiler_4.3.0          rlang_1.1.0             crayon_1.5.2           
> [118] future.apply_1.10.0     labeling_0.4.2          plyr_1.8.8             
> [121] stringi_1.7.12          viridisLite_0.4.1       BiocParallel_1.34.0    
> [124] munsell_0.5.0           lazyeval_0.2.2          glmnet_4.1-7           
> [127] Matrix_1.5-4            glasso_1.11             future_1.32.0          
> [130] highr_0.10              igraph_1.4.2            broom_1.0.4            
> [133] bslib_0.4.2

References

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.