Error with PCA in MetaboAnalystR

Hello,

I tried to perform PCA using R, but I couldn’t proceed due to an error.

Previously, the issue only occurred when I attempted to create a 3D plot(same with github link).

However, thinking it might have been fixed, I uninstalled and reinstalled MetaboAnalystR(1/16/2025).

Now, none of the PCA plots can be generated at all.

My code:

mSet<-PCA.Anal(mSet)
mSet<-PlotPCAPairSummary(mSet, "pca_pair_0_", format = "pdf", dpi = 72, width=NA, 5)

Console:
Error in mSetObj$analSet : $ operator is invalid for atomic vectors

And when I checked mSet,

> mSet
[1] 809

After performing PCA.Anal(mSet), the information stored in mSet changes.

Here is my session Information:

R version 4.4.1 (2024-06-14)
Platform: x86_64-conda-linux-gnu
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /<local path>/anaconda3/envs/metaboanalyst/lib/libopenblasp-r0.3.28.so;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=ko_KR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=ko_KR.UTF-8        LC_COLLATE=ko_KR.UTF-8    
 [5] LC_MONETARY=ko_KR.UTF-8    LC_MESSAGES=ko_KR.UTF-8   
 [7] LC_PAPER=ko_KR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=ko_KR.UTF-8 LC_IDENTIFICATION=C       

tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] memoise_2.0.1        ggplot2_3.5.1        scales_1.3.0        
[4] Rserve_1.8-15        MetaboAnalystR_4.0.0

loaded via a namespace (and not attached):
  [1] DBI_1.2.3            bitops_1.0-9         pROC_1.18.5         
  [4] rlang_1.1.4          magrittr_2.0.3       scrime_1.3.5        
  [7] compiler_4.4.1       RSQLite_2.3.9        vctrs_0.6.5         
 [10] reshape2_1.4.4       stringr_1.5.1        pkgconfig_2.0.3     
 [13] fastmap_1.2.0        labeling_0.4.3       caTools_1.18.3      
 [16] prodlim_2024.06.25   purrr_1.0.2          bit_4.5.0.1         
 [19] cachem_1.1.0         jsonlite_1.8.9       recipes_1.1.0       
 [22] blob_1.2.4           BiocParallel_1.40.0  parallel_4.4.1      
 [25] R6_2.5.1             stringi_1.8.4        RColorBrewer_1.1-3  
 [28] qs_0.27.2            limma_3.62.1         parallelly_1.41.0   
 [31] rpart_4.1.24         lubridate_1.9.4      Rcpp_1.0.14         
 [34] iterators_1.0.14     future.apply_1.11.3  Matrix_1.6-5        
 [37] splines_4.4.1        nnet_7.3-20          igraph_2.1.3        
 [40] timechange_0.3.0     tidyselect_1.2.1     stringfish_0.16.0   
 [43] siggenes_1.80.0      timeDate_4041.110    gplots_3.2.0        
 [46] codetools_0.2-20     listenv_0.9.1        lattice_0.22-6      
 [49] tibble_3.2.1         plyr_1.8.9           Biobase_2.66.0      
 [52] withr_3.0.2          future_1.34.0        survival_3.8-3      
 [55] RcppParallel_5.1.9   pillar_1.10.1        KernSmooth_2.23-26  
 [58] foreach_1.5.2        stats4_4.4.1         plotly_4.10.4       
 [61] generics_0.1.3       munsell_0.5.1        RApiSerialize_0.1.4 
 [64] gtools_3.9.5         globals_0.16.3       class_7.3-23        
 [67] glue_1.8.0           lazyeval_0.2.2       tools_4.4.1         
 [70] data.table_1.16.4    ModelMetrics_1.2.2.2 fgsea_1.32.0        
 [73] gower_1.0.2          locfit_1.5-9.10      fastmatch_1.1-4     
 [76] cowplot_1.1.3        grid_4.4.1           Cairo_1.6-2         
 [79] impute_1.80.0        tidyr_1.3.1          ipred_0.9-15        
 [82] edgeR_4.4.1          colorspace_2.1-1     nlme_3.1-165        
 [85] crmn_0.0.21          cli_3.6.3            viridisLite_0.4.2   
 [88] lava_1.8.1           dplyr_1.1.4          glasso_1.11         
 [91] pcaMethods_1.98.0    gtable_0.3.6         digest_0.6.37       
 [94] BiocGenerics_0.52.0  caret_7.0-1          ggrepel_0.9.6       
 [97] farver_2.1.2         htmlwidgets_1.6.4    htmltools_0.5.8.1   
[100] multtest_2.62.0      lifecycle_1.0.4      httr_1.4.7          
[103] hardhat_1.4.0        statmod_1.5.0        bit64_4.5.2         
[106] MASS_7.3-64

Thank you.

I also experienced this problem with the PCA.Anal() function. It appears that something changed in the code in the last month. I don’t fully know what I am doing, but was able to get the function by reverting the change. I edited the function first, then replaced lines 17 & 18 with the old code. My process was:

  1. Ran:
    trace(PCA.Anal, edit = T)

  2. Removed:
    .set.mSet(mSetObj)
    return(length(pca[[“center”]]));

  3. Added in their place:
    return(length(pca[[“center”]]));