MetaboanalystR - Joint Pathway Analysis Issues

I am following the PDF tutorial for Joint Pathway Analysis in MetaboanalystR in RStudio that is found on the Metaboanalyst website (https://www.metaboanalyst.ca/MetaboAnalyst/docs/RTutorial.xhtml#4.5%20Integrated%20Pathway%20Analysis).

And I am having issues running the package. I also believe the PDF may be a bit outdated as there was a dead link and some misnamed functions, but after fixing the link and the misnamed functions the code still seems to run into errors. I am wondering if there is an updated R tutorial for Joint/Integrated Pathway Analysis or if there is a solution to the errors I am running into?

Here is the code I am currently running, that has been directly pulled from the PDF tutorial (with a few changes as I named above, line 29, 50, and 60):

When I run line 50 I run into this error:
Screen Shot 2022-06-29 at 10.22.24 AM

And when I run line 60 I run into this error:

Again, the files are directly downloaded from the Metaboanalyst and when the two files are run in the web-based tool there is no issue. Thanks in advance!

Same problems encountered there.

1 Like

Hi Etsai21 and Fred-L,

Thanks for reporting. I have tried to run the command but cannot reproduce the issue. Here is my command lines:

setwd("/home/qiang/Downloads/debug_dir")

devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)

download.file("https://www.metaboanalyst.ca/MetaboAnalyst/resources/data/integ_genes_1.txt", 
              destfile = "integ_genes_1.txt", "curl")
download.file("https://www.metaboanalyst.ca/MetaboAnalyst/resources/data/integ_cmpds.txt", 
              destfile = "integ_cmpds.txt", "curl")

library(MetaboAnalystR)
mSet<-InitDataObjects("conc", "pathinteg", FALSE)
mSet<-SetOrganism(mSet, "hsa")
geneListFile<-"integ_genes_1.txt"
geneList<-readChar(geneListFile, file.info(geneListFile)$size)
mSet<-PerformGeneMapping(mSet, geneList, "hsa", "symbol");

cmpdListFile<-"integ_cmpds.txt"
cmpdList<-readChar(cmpdListFile, file.info(cmpdListFile)$size)

mSet<-PerformCmpdMapping(mSet, cmpdList, "hsa", "name");
mSet<-CreateMappingResultTable(mSet)
mSet<-PrepareIntegData(mSet);

mSet<-PerformIntegPathwayAnalysis(mSet, "dc", "hyper", "integ", "query");
mSet<-PlotPathSummary(mSet, F, "path_view_0_", "png", 72, width=NA, NA, NA );
CreateIntegMatchingTable <- MetaboAnalystR:::CreateIntegMatchingTable
mSet<-CreateIntegMatchingTable(mSet);

The results and outputs are shown as below:

The R version I am using is 4.1.2. Detailed session info are shown as below:

Please try to follow my command lines and see if there is the same issue. The tutorials are outdated and will be updated soon.

Bests,

Zhiqiang Pang

Thanks Qiang. I encountered the following error message when I run PerformGeneMapping() function:
mSet<-PerformGeneMapping(mSet, geneList, “hsa”, “symbol”);
Error: Could not connect to database:
unable to open database file
In addition: Warning message:
package ‘RSQLite’ was built under R version 4.1.3

I am using R version 4.1.1, do you think it’s the source of problem? In tutorial, it says R version 4.1 is compatible. But if not, I can update to 4.1.3 as shown in your sessionInfo() output. Thanks.

Hello Qiang, just upgrated to R 4.1.3, but still has the problem. (running a 64 bit R on Windows). It would great if you could help with this issue, thanks.

mSet<-PerformGeneMapping(mSet, geneList, “hsa”, “symbol”);
Error: Could not connect to database:
unable to open database file

Below is the sessionInfo of my R environment:

sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RSQLite_2.2.14 MetaboAnalystR_3.2.0
loaded via a namespace (and not attached):
[1] fgsea_1.20.0 colorspace_2.0-3 ellipsis_0.3.2
[4] class_7.3-20 siggenes_1.68.0 fs_1.5.2
[7] rstudioapi_0.13 listenv_0.8.0 remotes_2.4.2
[10] bit64_4.0.5 prodlim_2019.11.13 fansi_1.0.3
[13] lubridate_1.8.0 codetools_0.2-18 splines_4.1.3
[16] cachem_1.0.6 impute_1.68.0 scrime_1.3.5
[19] glasso_1.11 pkgload_1.3.0 jsonlite_1.8.0
[22] pROC_1.18.0 Cairo_1.5-15 caret_6.0-92
[25] compiler_4.1.3 httr_1.4.3 lazyeval_0.2.2
[28] Matrix_1.4-1 fastmap_1.1.0 limma_3.50.3
[31] cli_3.3.0 crmn_0.0.21 htmltools_0.5.2
[34] prettyunits_1.1.1 tools_4.1.3 igraph_1.3.2
[37] gtable_0.3.0 glue_1.6.2 reshape2_1.4.4
[40] dplyr_1.0.9 fastmatch_1.1-3 Rcpp_1.0.8.3
[43] Biobase_2.54.0 vctrs_0.4.1 multtest_2.50.0
[46] nlme_3.1-158 iterators_1.0.14 timeDate_3043.102
[49] gower_1.0.0 stringr_1.4.0 globals_0.15.1
[52] ps_1.7.1 lifecycle_1.0.1 gtools_3.9.2.2
[55] devtools_2.4.3 future_1.26.1 edgeR_3.36.0
[58] MASS_7.3-57 scales_1.2.0 ipred_0.9-13
[61] pcaMethods_1.86.0 parallel_4.1.3 RColorBrewer_1.1-3
[64] qs_0.25.3 curl_4.3.2 memoise_2.0.1
[67] gridExtra_2.3 ggplot2_3.3.6 rpart_4.1.16
[70] stringi_1.7.6 foreach_1.5.2 caTools_1.18.2
[73] BiocGenerics_0.40.0 hardhat_1.2.0 pkgbuild_1.3.1
[76] BiocParallel_1.28.3 lava_1.6.10 rlang_1.0.3
[79] pkgconfig_2.0.3 bitops_1.0-7 lattice_0.20-45
[82] purrr_0.3.4 recipes_1.0.0 htmlwidgets_1.5.4
[85] bit_4.0.4 processx_3.6.1 tidyselect_1.1.2
[88] parallelly_1.32.0 plyr_1.8.7 magrittr_2.0.3
[91] R6_2.5.1 gplots_3.1.3 generics_0.1.2
[94] DBI_1.1.3 pillar_1.7.0 withr_2.5.0
[97] survival_3.3-1 nnet_7.3-17 tibble_3.1.7
[100] future.apply_1.9.0 crayon_1.5.1 KernSmooth_2.23-20
[103] utf8_1.2.2 RApiSerialize_0.1.0 plotly_4.10.0
[106] usethis_2.1.6 locfit_1.5-9.5 grid_4.1.3
[109] data.table_1.14.2 blob_1.2.3 callr_3.7.0
[112] ModelMetrics_1.2.2.2 digest_0.6.29 tidyr_1.2.0
[115] RcppParallel_5.1.5 stats4_4.1.3 munsell_0.5.0
[118] stringfish_0.15.7 viridisLite_0.4.0 sessioninfo_1.2.2

Hi Fred-L,

Thanks for reporting this issue. I have fixed the database connection issue for MetaboAnalystR at Windows platform. Please update to the latest version and try again.

Bests,
Zhiqiang Pang

Hi Qiang,

So I have updated to the newest version as you’ve advised Fred and it seems like the PerformGeneMapping() function now works, but the PerformCmpdMapping() still does not. Here is the code I am running:

I am running all of this on R version 4.1.2 and pulling files directly from the Metaboanalyst website. Here is what my session info currently looks like:



Screen Shot 2022-07-14 at 1.59.16 PM

Thanks for your help!

Hi Qiang,

Wondering if there is any update to the issues I encountered most recently?

Thanks again for your help.

Hi Qiang,

I have recently tested this and it still seems like it is not working, even after updating to the latest version.
Again, PerformGeneMapping() seems to work, but PerformCmpdMapping() still does not work correctly as can be seen in my above post.

Wondering if you have any updates to this issue…
Thanks,
Erin

Hi Erin,

The issue is clear. For this command, you have to set the argument “idType” as “name” to run the whole srcipt, because the compound for the example data is compound name, rather than KEGG ID.

mSet<-PerformCmpdMapping(mSet, cmpdList, "hsa", "name");

Hope this helps!
Bests,
Zhiqiang