Contents

Compiled date: 2021-10-26

Last edited: 2021-04-15

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(MSnbase)
library(ggplot2)
library(patchwork)

3 Load Data and Imputation

Let’s create a cleaned MSnSet object from example st000336 data to explore the normalization effects.

# load example data
data("st000336")

# imputation using the default method KNN
example_data <- st000336 %>% PomaImpute()
> method argument is empty! KNN will be used
example_data
> MSnSet (storageMode: lockedEnvironment)
> assayData: 30 features, 57 samples 
>   element names: exprs 
> protocolData: none
> phenoData
>   sampleNames: DMD004.1.U02 DMD005.1.U02 ... DMD173.1.U02 (57 total)
>   varLabels: group steroids
>   varMetadata: labelDescription
> featureData: none
> experimentData: use 'experimentData(object)'
> Annotation:  
> - - - Processing information - - -
> Imputed (knn): Tue Oct 26 18:19:51 2021 
>  MSnbase version: 2.20.0

4 Normalization

Here we will evaluate ALL normalization methods that POMA offers on the same MSnSet 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(MSnbase::exprs(none))
> [1] 30 57
dim(MSnbase::exprs(auto_scaling))
> [1] 30 57
dim(MSnbase::exprs(level_scaling))
> [1] 30 57
dim(MSnbase::exprs(log_scaling))
> [1] 30 57
dim(MSnbase::exprs(log_transformation))
> [1] 30 57
dim(MSnbase::exprs(vast_scaling))
> [1] 30 57
dim(MSnbase::exprs(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) +
  ggtitle("Not Normalized")

b <- PomaBoxplots(auto_scaling, group = "samples", jitter = FALSE) +
  ggtitle("Auto Scaling") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

c <- PomaBoxplots(level_scaling, group = "samples", jitter = FALSE) +
  ggtitle("Level Scaling") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

d <- PomaBoxplots(log_scaling, group = "samples", jitter = FALSE) +
  ggtitle("Log Scaling") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

e <- PomaBoxplots(log_transformation, group = "samples", jitter = FALSE) +
  ggtitle("Log Transformation") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

f <- PomaBoxplots(vast_scaling, group = "samples", jitter = FALSE) +
  ggtitle("Vast Scaling") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

g <- PomaBoxplots(log_pareto, group = "samples", jitter = FALSE) +
  ggtitle("Log Pareto") +
  theme(axis.text.x = element_blank(),
        legend.position = "none")

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") +
  ggtitle("Not Normalized")

i <- PomaDensity(auto_scaling, group = "features") +
  ggtitle("Auto Scaling") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

j <- PomaDensity(level_scaling, group = "features") +
  ggtitle("Level Scaling") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

k <- PomaDensity(log_scaling, group = "features") +
  ggtitle("Log Scaling") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

l <- PomaDensity(log_transformation, group = "features") +
  ggtitle("Log Transformation") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

m <- PomaDensity(vast_scaling, group = "features") +
  ggtitle("Vast Scaling") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

n <- PomaDensity(log_pareto, group = "features") +
  ggtitle("Log Pareto") +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())

h  

(i + j + k) / (l + m + n)

5 Session Information

sessionInfo()
> R version 4.1.1 (2021-08-10)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 20.04.3 LTS
> 
> Matrix products: default
> BLAS:   /home/biocbuild/bbs-3.14-bioc/R/lib/libRblas.so
> LAPACK: /home/biocbuild/bbs-3.14-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] MSnbase_2.20.0      ProtGenerics_1.26.0 S4Vectors_0.32.0   
>  [4] mzR_2.28.0          Rcpp_1.0.7          Biobase_2.54.0     
>  [7] BiocGenerics_0.40.0 tibble_3.1.5        dplyr_1.0.7        
> [10] knitr_1.36          patchwork_1.1.1     plotly_4.10.0      
> [13] ggraph_2.0.5        ggplot2_3.3.5       POMA_1.4.0         
> [16] BiocStyle_2.22.0   
> 
> loaded via a namespace (and not attached):
>   [1] backports_1.2.1       circlize_0.4.13       plyr_1.8.6           
>   [4] igraph_1.2.7          lazyeval_0.2.2        splines_4.1.1        
>   [7] gmp_0.6-2             BiocParallel_1.28.0   listenv_0.8.0        
>  [10] digest_0.6.28         foreach_1.5.1         htmltools_0.5.2      
>  [13] magick_2.7.3          viridis_0.6.2         fansi_0.5.0          
>  [16] magrittr_2.0.1        cluster_2.1.2         doParallel_1.0.16    
>  [19] limma_3.50.0          recipes_0.1.17        ComplexHeatmap_2.10.0
>  [22] globals_0.14.0        graphlayouts_0.7.1    gower_0.2.2          
>  [25] matrixStats_0.61.0    rARPACK_0.11-0        colorspace_2.0-2     
>  [28] ggrepel_0.9.1         xfun_0.27             crayon_1.4.1         
>  [31] jsonlite_1.7.2        impute_1.68.0         survival_3.2-13      
>  [34] iterators_1.0.13      glue_1.4.2            polyclip_1.10-0      
>  [37] gtable_0.3.0          ipred_0.9-12          zlibbioc_1.40.0      
>  [40] GetoptLong_1.0.5      RankProd_3.20.0       future.apply_1.8.1   
>  [43] shape_1.4.6           Rmpfr_0.8-6           scales_1.1.1         
>  [46] vsn_3.62.0            DBI_1.1.1             viridisLite_0.4.0    
>  [49] clue_0.3-60           proxy_0.4-26          preprocessCore_1.56.0
>  [52] clisymbols_1.2.0      MsCoreUtils_1.6.0     lava_1.6.10          
>  [55] prodlim_2019.11.13    glmnet_4.1-2          httr_1.4.2           
>  [58] htmlwidgets_1.5.4     RColorBrewer_1.1-2    ellipsis_0.3.2       
>  [61] pkgconfig_2.0.3       XML_3.99-0.8          farver_2.1.0         
>  [64] nnet_7.3-16           sass_0.4.0            utf8_1.2.2           
>  [67] caret_6.0-90          labeling_0.4.2        ggcorrplot_0.1.3     
>  [70] tidyselect_1.1.1      rlang_0.4.12          reshape2_1.4.4       
>  [73] munsell_0.5.0         tools_4.1.1           generics_0.1.1       
>  [76] broom_0.7.9           evaluate_0.14         stringr_1.4.0        
>  [79] fastmap_1.1.0         mzID_1.32.0           yaml_2.2.1           
>  [82] ModelMetrics_1.2.2.2  tidygraph_1.2.0       randomForest_4.6-14  
>  [85] purrr_0.3.4           ncdf4_1.17            glasso_1.11          
>  [88] future_1.22.1         nlme_3.1-153          compiler_4.1.1       
>  [91] png_0.1-7             e1071_1.7-9           affyio_1.64.0        
>  [94] tweenr_1.0.2          bslib_0.3.1           stringi_1.7.5        
>  [97] highr_0.9             RSpectra_0.16-0       lattice_0.20-45      
> [100] Matrix_1.3-4          permute_0.9-5         vegan_2.5-7          
> [103] vctrs_0.3.8           pillar_1.6.4          lifecycle_1.0.1      
> [106] BiocManager_1.30.16   jquerylib_0.1.4       MALDIquant_1.20      
> [109] GlobalOptions_0.1.2   corpcor_1.6.10        data.table_1.14.2    
> [112] R6_2.5.1              pcaMethods_1.86.0     affy_1.72.0          
> [115] bookdown_0.24         gridExtra_2.3         IRanges_2.28.0       
> [118] parallelly_1.28.1     codetools_0.2-18      MASS_7.3-54          
> [121] assertthat_0.2.1      rjson_0.2.20          withr_2.4.2          
> [124] mgcv_1.8-38           parallel_4.1.1        mixOmics_6.18.0      
> [127] grid_4.1.1            rpart_4.1-15          timeDate_3043.102    
> [130] tidyr_1.1.4           class_7.3-19          rmarkdown_2.11       
> [133] pROC_1.18.0           ggforce_0.3.3         lubridate_1.8.0      
> [136] ellipse_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.