# Error in ROC Curve Analysis

Hello! I am having four errors in ROC Curve Analysis in MetaboAnalyst R 4.0 when using the example data. Three of them were reported as could not find the function. Each error was labeled in bold and italic.

# Part 1. Classical ROC Curve Analysis

mSet<-SetAnalysisMode(mSet, “univ”)
mSet<-PrepareROCData(mSet)

### OPTION 1 Perform univariate ROC curve analysis

mSet<-Perform.UnivROC(mSet, feat.nm = “Isoleucine”, version = “Isoleucine”, “png”, dpi=300, isAUC=F, isOpt=T, optMethod=“closest.topleft”, isPartial=F, measure=“sp”, cutoff=0.2)

mSet<-PlotRocUnivBoxPlot(mSet, “Isoleucine”, “Isoleucineboxplot_0_”, “png”, 72, T, FALSE)
#Error 1 >could not find function “PlotBoxPlot”
#Note: For this error, I change the function to PlotRocUnivBoxPlot(), then it seems to work but I am not sure if it’s right to do so.

mSet<-CalculateFeatureRanking(mSet)

### OPTION 2 Perform univariate ROC curve analysis, resulting in a partial AUC with a 95% CI band

#This line runs well with no error
mSet<-Perform.UnivROC(mSet, feat.nm = “Valine”, version = “Valine”, “png”, dpi=300,
isAUC=T, isOpt=T, optMethod=“closest.topleft”, isPartial=T, measure=“se”, cutoff=0.2)

### OPTION 3 Perform univariate ROC curve analysis on a metabolite ratio pair

mSet<-Perform.UnivROC(mSet, feat.nm = “Isoleucine/Valine”, version = “IsoleucineValine”,
“png”, dpi=300, isAUC=T, isOpt=T, optMethod=“closest.topleft”,
isPartial=T, measure=“se”, cutoff=0.2)
#Error 2 >Error in `[.data.frame`(data_ori_norm, , feat.nm) : Undefined columns are selected

# Part 2. Multivariate ROC Curve Explorer

mSet<-SetAnalysisMode(mSet, “explore”)
mSet<-PrepareROCData(mSet)
mSet<-PerformCV.explore(mSet, cls.method = “svm”, rank.method = “svm”, lvNum = 2)
#>Warning messages:
1: In svm.default(x.in, y.in, type = “C”, kernel = “linear”) :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
2: In svm.default(x.train, y.train, type = “C”, kernel = “linear”, :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
3: In svm.default(x.in, y.in, type = “C”, kernel = “linear”) :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
4: In svm.default(x.train, y.train, type = “C”, kernel = “linear”, :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
5: In svm.default(x.in, y.in, type = “C”, kernel = “linear”) :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
6: In svm.default(x.train, y.train, type = “C”, kernel = “linear”, :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
7: In svm.default(x.in, y.in, type = “C”, kernel = “linear”) :
Variable(s) ‘Creatinine’ constant. Cannot scale data.
8: In svm.default(x.train, y.train, type = “C”, kernel = “linear”, :
Variable(s) ‘Creatinine’ constant. Cannot scale data.

### OPTION 1 Comparison plot of ROC curves of all models

mSet<-PlotROC(mSet, imgName = “ROC_all_models”, format = “png”, dpi = 300, mdl.inx= 0, avg.method = “threshold”, show.conf = 0, show.holdout = 0, focus=“fpr”, cutoff=0.5)

mSet<-PlotProbView(mSet, imgName = “multi_roc_prob”, format = “png”, dpi = 300,
mdl.inx = -1, show = 0, showPred = 0)

mSet<-PlotAccuracy(mSet, imgName = “multi_roc_accuracy”, format = “png”, dpi = 300)

mSet<-PlotImpVars(mSet, imgName = “multi_roc_impvar”, format=“png”, dpi=300,
mdl.inx = -1, measure=“freq”, feat.num=15)
#Error 3 >Error in PlotImpVars(mSet, imgName = “multi_roc_impvar”, format = “png”, : could not find function “PlotImpVars”

### OPTION 2 Plot the ROC curve of a single selected model, in this case model 1 and display the confidence interval

mSet<-PlotROC(mSet, imgName = “ROC_model1”, format = “png”, dpi = 300,
mdl.inx = 1, avg.method = “threshold”, show.conf = 1, 0, “fpr”, 0.2)

imp.feats<-GetImpFeatureMat(mSet, mSet\$analSet\$multiROC\$imp.cv, 10)
#Error 4 >Error in GetImpFeatureMat(mSet, mSet\$analSet\$multiROC\$imp.cv, 10) :
could not find function “GetImpFeatureMat”

My session information:

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.utf8

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

other attached packages:
[1] Rserve_1.8-13 MetaboAnalystR_4.0.0

loaded via a namespace (and not attached):
[1] fgsea_1.22.0 colorspace_2.1-0 class_7.3-22 siggenes_1.70.0
[5] proxy_0.4-27 rstudioapi_0.16.0 listenv_0.9.1 farver_2.1.2
[9] bit64_4.0.5 prodlim_2024.06.25 fansi_1.0.6 lubridate_1.9.3
[13] codetools_0.2-20 splines_4.2.0 cachem_1.1.0 impute_1.70.0
[17] scrime_1.3.5 glasso_1.11 jsonlite_1.8.8 pROC_1.18.5
[21] Cairo_1.6-2 caret_6.0-94 pheatmap_1.0.12 compiler_4.2.0
[25] httr_1.4.7 Matrix_1.5-3 fastmap_1.2.0 lazyeval_0.2.2
[29] limma_3.52.4 cli_3.6.3 crmn_0.0.21 htmltools_0.5.8.1
[33] tools_4.2.0 igraph_2.0.3 gtable_0.3.5 glue_1.7.0
[37] reshape2_1.4.4 dplyr_1.1.4 fastmatch_1.1-4 Rcpp_1.0.12
[41] Biobase_2.56.0 vctrs_0.6.5 multtest_2.52.0 preprocessCore_1.58.0
[45] nlme_3.1-165 iterators_1.0.14 timeDate_4032.109 gower_1.0.1
[49] stringr_1.5.1 globals_0.16.3 timechange_0.3.0 lifecycle_1.0.4
[53] gtools_3.9.5 future_1.33.2 edgeR_3.38.4 MASS_7.3-56
[57] scales_1.3.0 ipred_0.9-14 pcaMethods_1.88.0 parallel_4.2.0
[61] RColorBrewer_1.1-3 qs_0.26.3 memoise_2.0.1 gridExtra_2.3
[65] ggplot2_3.5.1 rpart_4.1.23 stringi_1.8.4 RSQLite_2.3.7
[69] foreach_1.5.2 e1071_1.7-14 caTools_1.18.2 BiocGenerics_0.42.0
[73] hardhat_1.4.0 BiocParallel_1.30.4 lava_1.8.0 rlang_1.1.4
[77] pkgconfig_2.0.3 bitops_1.0-7 lattice_0.22-6 ROCR_1.0-11
[81] purrr_1.0.2 recipes_1.1.0 htmlwidgets_1.6.4 labeling_0.4.3
[85] cowplot_1.1.3 bit_4.0.5 tidyselect_1.2.1 parallelly_1.37.1
[89] plyr_1.8.9 magrittr_2.0.3 R6_2.5.1 gplots_3.1.3.1
[93] generics_0.1.3 DBI_1.2.3 pillar_1.9.0 withr_3.0.0
[97] survival_3.7-0 nnet_7.3-19 tibble_3.2.1 future.apply_1.11.2
[101] KernSmooth_2.23-24 utf8_1.2.4 RApiSerialize_0.1.3 plotly_4.10.4
[105] locfit_1.5-9.10 grid_4.2.0 data.table_1.15.4 blob_1.2.4
[109] ModelMetrics_1.2.2.2 digest_0.6.36 xtable_1.8-4 tidyr_1.3.1
[113] RcppParallel_5.1.8 stats4_4.2.0 munsell_0.5.1 stringfish_0.16.0
[117] viridisLite_0.4.2 sessioninfo_1.2.2