Compiled date: 2021-10-26
Last edited: 2021-20-07
License: GPL-3
Run the following code to install the Bioconductor version of the package.
# install.packages("BiocManager")
BiocManager::install("fobitools")
fobitools
library(fobitools)
You can also load some additional packages that will be very useful in this vignette.
library(dplyr)
library(kableExtra)
metaboliteUniverse
and metaboliteList
In microarrays, for example, we can study almost all the genes of an organism in our sample, so it makes sense to perform an over representation analysis (ORA) considering all the genes present in Gene Ontology (GO). Since most of the GO pathways would be represented by some gene in the microarray.
This is different in nutrimetabolomics. Targeted nutrimetabolomics studies sets of about 200-500 diet-related metabolites, so it would not make sense to use all known metabolites (for example in HMDB or CHEBI) in an ORA, as most of them would not have been quantified in the study.
In nutrimetabolomic studies it may be interesting to study enriched or over represented foods/food groups by the metabolites resulting from the study statistical analysis, rather than the enriched metabolic pathways, as would make more sense in genomics or other metabolomics studies.
The Food-Biomarker Ontology (FOBI) provides a biological knowledge for conducting these enrichment analyses in nutrimetabolomic studies, as FOBI provides the relationships between several foods and their associated dietary metabolites (Castellano-Escuder et al. 2020).
Accordingly, to perform an ORA with the fobitools
package, it is necessary to provide a metabolite universe (all metabolites included in the statistical analysis) and a list of selected metabolites (selected metabolites according to a statistical criterion).
Here is an example:
# select 300 random metabolites from FOBI
idx_universe <- sample(nrow(fobitools::idmap), 300, replace = FALSE)
metaboliteUniverse <- fobitools::idmap %>%
dplyr::slice(idx_universe) %>%
pull(FOBI)
# select 10 random metabolites from metaboliteUniverse that are associated with 'Red meat' (FOBI:0193),
# 'Lean meat' (FOBI:0185) , 'egg food product' (FOODON:00001274),
# or 'grape (whole, raw)' (FOODON:03301702)
fobi_subset <- fobitools::fobi %>% # equivalent to `parse_fobi()`
filter(FOBI %in% metaboliteUniverse) %>%
filter(id_BiomarkerOf %in% c("FOBI:0193", "FOBI:0185", "FOODON:00001274", "FOODON:03301702")) %>%
dplyr::slice(sample(nrow(.), 10, replace = FALSE))
metaboliteList <- fobi_subset %>%
pull(FOBI)
fobitools::ora(metaboliteList = metaboliteList,
metaboliteUniverse = metaboliteUniverse,
subOntology = "food",
pvalCutoff = 0.01)
className | classSize | overlap | pval | padj | overlapMetabolites |
---|---|---|---|---|---|
Red meat | 20 | 7 | 0.0000000 | 0.0000022 | FOBI:030709, FOBI:030406, FOBI:030707, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
green tea leaf (dry) | 15 | 5 | 0.0000079 | 0.0002935 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
red tea | 15 | 5 | 0.0000079 | 0.0002935 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
red velvet | 15 | 5 | 0.0000079 | 0.0002935 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
bean (whole) | 17 | 5 | 0.0000160 | 0.0003962 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
strawberry (whole, raw) | 17 | 5 | 0.0000160 | 0.0003962 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
apricot (whole, raw) | 11 | 4 | 0.0000647 | 0.0012047 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
lettuce vegetable food product | 11 | 4 | 0.0000647 | 0.0012047 | FOBI:030566, FOBI:030461, FOBI:030518, FOBI:050034 |
black pepper food product | 12 | 4 | 0.0000960 | 0.0014297 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
raspberry (whole, raw) | 12 | 4 | 0.0000960 | 0.0014297 | FOBI:030406, FOBI:030566, FOBI:030461, FOBI:030518 |
orange (whole, raw) | 13 | 4 | 0.0001371 | 0.0017020 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
plum (whole, raw) | 13 | 4 | 0.0001371 | 0.0017020 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
black currant (whole, raw) | 14 | 4 | 0.0001898 | 0.0021752 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
prune food product | 6 | 3 | 0.0002420 | 0.0025753 | FOBI:030406, FOBI:030461, FOBI:050034 |
chickpea (whole) | 7 | 3 | 0.0004181 | 0.0036644 | FOBI:030406, FOBI:030461, FOBI:050034 |
eggplant (whole, raw) | 7 | 3 | 0.0004181 | 0.0036644 | FOBI:030406, FOBI:030461, FOBI:050034 |
pomegranate (whole, raw) | 7 | 3 | 0.0004181 | 0.0036644 | FOBI:030406, FOBI:030461, FOBI:050034 |
cherry (whole, raw) | 18 | 4 | 0.0005548 | 0.0043508 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
tomato (whole, raw) | 18 | 4 | 0.0005548 | 0.0043508 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
cocoa | 8 | 3 | 0.0006604 | 0.0049202 | FOBI:030406, FOBI:030461, FOBI:050034 |
grape (whole, raw) | 20 | 4 | 0.0008589 | 0.0050250 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
sweet potato vegetable food product | 20 | 4 | 0.0008589 | 0.0050250 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
bell pepper | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030461, FOBI:030518, FOBI:050034 |
cabbage (whole, raw) | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030461, FOBI:030518, FOBI:050034 |
cauliflower (whole, raw) | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030406, FOBI:030461, FOBI:050034 |
hot pepper vegetable food product | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030461, FOBI:030518, FOBI:050034 |
pea (whole) | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030406, FOBI:030461, FOBI:050034 |
peach (whole, raw) | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030406, FOBI:030461, FOBI:050034 |
yellow bell pepper (whole, raw) | 9 | 3 | 0.0009780 | 0.0050250 | FOBI:030461, FOBI:030518, FOBI:050034 |
beer | 22 | 4 | 0.0012678 | 0.0060447 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
blackberry (whole, raw) | 10 | 3 | 0.0013793 | 0.0060447 | FOBI:030406, FOBI:030461, FOBI:050034 |
bread food product | 10 | 3 | 0.0013793 | 0.0060447 | FOBI:030406, FOBI:030461, FOBI:050034 |
white sugar | 10 | 3 | 0.0013793 | 0.0060447 | FOBI:030406, FOBI:030461, FOBI:050034 |
whole bread | 10 | 3 | 0.0013793 | 0.0060447 | FOBI:030406, FOBI:030461, FOBI:050034 |
Lean meat | 3 | 2 | 0.0018478 | 0.0069744 | FOBI:030709, FOBI:030707 |
black tea leaf (dry) | 11 | 3 | 0.0018723 | 0.0069744 | FOBI:030406, FOBI:030518, FOBI:050034 |
broccoli floret (whole, raw) | 11 | 3 | 0.0018723 | 0.0069744 | FOBI:030461, FOBI:030518, FOBI:050034 |
grain plant | 11 | 3 | 0.0018723 | 0.0069744 | FOBI:030406, FOBI:030461, FOBI:050034 |
grain product | 11 | 3 | 0.0018723 | 0.0069744 | FOBI:030406, FOBI:030461, FOBI:050034 |
wheat | 11 | 3 | 0.0018723 | 0.0069744 | FOBI:030406, FOBI:030461, FOBI:050034 |
wine (food product) | 25 | 4 | 0.0021188 | 0.0077001 | FOBI:030406, FOBI:030461, FOBI:030518, FOBI:050034 |
kale leaf (raw) | 12 | 3 | 0.0024644 | 0.0085396 | FOBI:030406, FOBI:030518, FOBI:050034 |
tea food product | 12 | 3 | 0.0024644 | 0.0085396 | FOBI:030461, FOBI:030518, FOBI:050034 |
grapefruit (whole, raw) | 13 | 3 | 0.0031627 | 0.0104719 | FOBI:030406, FOBI:030518, FOBI:050034 |
pear (whole, raw) | 13 | 3 | 0.0031627 | 0.0104719 | FOBI:030406, FOBI:030461, FOBI:050034 |
mango (whole, raw) | 4 | 2 | 0.0036459 | 0.0115583 | FOBI:030461, FOBI:050034 |
rhubarb stalk (whole, raw) | 4 | 2 | 0.0036459 | 0.0115583 | FOBI:030461, FOBI:050034 |
olive (whole, ripe) | 14 | 3 | 0.0039734 | 0.0120825 | FOBI:030406, FOBI:030461, FOBI:050034 |
oregano (ground) | 14 | 3 | 0.0039734 | 0.0120825 | FOBI:030406, FOBI:030518, FOBI:050034 |
coffee (liquid drink) | 15 | 3 | 0.0049028 | 0.0143239 | FOBI:030406, FOBI:030461, FOBI:050034 |
lemon (whole, raw) | 15 | 3 | 0.0049028 | 0.0143239 | FOBI:030406, FOBI:030518, FOBI:050034 |
barley grain (whole, raw) | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030461, FOBI:050034 |
lentil (whole) | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030406, FOBI:030461 |
melon (raw) | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030461, FOBI:050034 |
nectarine (whole, raw) | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030461, FOBI:050034 |
turnip (whole, raw) | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030406, FOBI:050034 |
zucchini plant | 5 | 2 | 0.0059948 | 0.0156706 | FOBI:030461, FOBI:050034 |
flour | 17 | 3 | 0.0071392 | 0.0183404 | FOBI:030406, FOBI:030461, FOBI:050034 |
Dark yellow vegetables | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030518, FOBI:050034 |
avocado (whole, raw) | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030461, FOBI:050034 |
beetroot | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030461, FOBI:050034 |
chocolate | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030406, FOBI:030461 |
fig (whole) | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030461, FOBI:050034 |
soybean oil | 6 | 2 | 0.0088712 | 0.0206533 | FOBI:030406, FOBI:050034 |
metaboliteList
termsThen, with the fobi_graph
function we can visualize the metaboliteList
terms with their corresponding FOBI relationships.
terms <- fobi_subset %>%
pull(id_code)
# create the associated graph
fobitools::fobi_graph(terms = terms,
get = "anc",
labels = TRUE,
legend = TRUE)
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] SummarizedExperiment_1.24.0 Biobase_2.54.0
#> [3] GenomicRanges_1.46.0 GenomeInfoDb_1.30.0
#> [5] IRanges_2.28.0 S4Vectors_0.32.0
#> [7] BiocGenerics_0.40.0 MatrixGenerics_1.6.0
#> [9] matrixStats_0.61.0 metabolomicsWorkbenchR_1.4.0
#> [11] POMA_1.4.0 ggrepel_0.9.1
#> [13] rvest_1.0.2 kableExtra_1.3.4
#> [15] forcats_0.5.1 stringr_1.4.0
#> [17] dplyr_1.0.7 purrr_0.3.4
#> [19] readr_2.0.2 tidyr_1.1.4
#> [21] tibble_3.1.5 ggplot2_3.3.5
#> [23] tidyverse_1.3.1 fobitools_1.2.0
#> [25] BiocStyle_2.22.0
#>
#> loaded via a namespace (and not attached):
#> [1] ModelMetrics_1.2.2.2 bit64_4.0.5
#> [3] knitr_1.36 DelayedArray_0.20.0
#> [5] data.table_1.14.2 rpart_4.1-15
#> [7] RCurl_1.98-1.5 doParallel_1.0.16
#> [9] generics_0.1.1 preprocessCore_1.56.0
#> [11] qdapRegex_0.7.2 RSQLite_2.2.8
#> [13] mixOmics_6.18.0 proxy_0.4-26
#> [15] future_1.22.1 bit_4.0.4
#> [17] tzdb_0.1.2 webshot_0.5.2
#> [19] xml2_1.3.2 lubridate_1.8.0
#> [21] assertthat_0.2.1 viridis_0.6.2
#> [23] gower_0.2.2 xfun_0.27
#> [25] hms_1.1.1 jquerylib_0.1.4
#> [27] evaluate_0.14 fansi_0.5.0
#> [29] dbplyr_2.1.1 readxl_1.3.1
#> [31] igraph_1.2.7 DBI_1.1.1
#> [33] rARPACK_0.11-0 Rmpfr_0.8-6
#> [35] ellipsis_0.3.2 selectr_0.4-2
#> [37] RSpectra_0.16-0 backports_1.2.1
#> [39] bookdown_0.24 permute_0.9-5
#> [41] ggcorrplot_0.1.3 vctrs_0.3.8
#> [43] RankProd_3.20.0 caret_6.0-90
#> [45] cachem_1.0.6 withr_2.4.2
#> [47] ggforce_0.3.3 vroom_1.5.5
#> [49] vegan_2.5-7 MultiAssayExperiment_1.20.0
#> [51] svglite_2.0.0 cluster_2.1.2
#> [53] ontologyIndex_2.7 crayon_1.4.1
#> [55] ada_2.0-5 ellipse_0.4.2
#> [57] glmnet_4.1-2 recipes_0.1.17
#> [59] pkgconfig_2.0.3 labeling_0.4.2
#> [61] tweenr_1.0.2 nlme_3.1-153
#> [63] ProtGenerics_1.26.0 nnet_7.3-16
#> [65] rlang_0.4.12 globals_0.14.0
#> [67] lifecycle_1.0.1 lexicon_1.2.1
#> [69] affyio_1.64.0 modelr_0.1.8
#> [71] cellranger_1.1.0 randomForest_4.6-14
#> [73] polyclip_1.10-0 struct_1.6.0
#> [75] Matrix_1.3-4 reprex_2.0.1
#> [77] GlobalOptions_0.1.2 png_0.1-7
#> [79] viridisLite_0.4.0 rjson_0.2.20
#> [81] mzR_2.28.0 clisymbols_1.2.0
#> [83] bitops_1.0-7 pROC_1.18.0
#> [85] blob_1.2.2 shape_1.4.6
#> [87] parallelly_1.28.1 scales_1.1.1
#> [89] memoise_2.0.0 magrittr_2.0.1
#> [91] plyr_1.8.6 zlibbioc_1.40.0
#> [93] compiler_4.1.1 RColorBrewer_1.1-2
#> [95] pcaMethods_1.86.0 clue_0.3-60
#> [97] cli_3.0.1 affy_1.72.0
#> [99] XVector_0.34.0 listenv_0.8.0
#> [101] patchwork_1.1.1 MASS_7.3-54
#> [103] mgcv_1.8-38 tidyselect_1.1.1
#> [105] vsn_3.62.0 stringi_1.7.5
#> [107] highr_0.9 yaml_2.2.1
#> [109] MALDIquant_1.20 grid_4.1.1
#> [111] sass_0.4.0 fastmatch_1.1-3
#> [113] tools_4.1.1 future.apply_1.8.1
#> [115] parallel_4.1.1 circlize_0.4.13
#> [117] rstudioapi_0.13 MsCoreUtils_1.6.0
#> [119] foreach_1.5.1 gridExtra_2.3
#> [121] prodlim_2019.11.13 farver_2.1.0
#> [123] mzID_1.32.0 ggraph_2.0.5
#> [125] digest_0.6.28 BiocManager_1.30.16
#> [127] ff_4.0.4 lava_1.6.10
#> [129] Rcpp_1.0.7 broom_0.7.9
#> [131] ncdf4_1.17 httr_1.4.2
#> [133] MSnbase_2.20.0 ComplexHeatmap_2.10.0
#> [135] colorspace_2.0-2 XML_3.99-0.8
#> [137] fs_1.5.0 splines_4.1.1
#> [139] graphlayouts_0.7.1 systemfonts_1.0.3
#> [141] xtable_1.8-4 gmp_0.6-2
#> [143] jsonlite_1.7.2 tidygraph_1.2.0
#> [145] corpcor_1.6.10 timeDate_3043.102
#> [147] glasso_1.11 RecordLinkage_0.4-12.1
#> [149] ipred_0.9-12 R6_2.5.1
#> [151] pillar_1.6.4 htmltools_0.5.2
#> [153] tictoc_1.0.1 glue_1.4.2
#> [155] fastmap_1.1.0 BiocParallel_1.28.0
#> [157] class_7.3-19 codetools_0.2-18
#> [159] fgsea_1.20.0 utf8_1.2.2
#> [161] lattice_0.20-45 bslib_0.3.1
#> [163] evd_2.3-3 curl_4.3.2
#> [165] magick_2.7.3 survival_3.2-13
#> [167] limma_3.50.0 textclean_0.9.3
#> [169] rmarkdown_2.11 syuzhet_1.0.6
#> [171] munsell_0.5.0 e1071_1.7-9
#> [173] GetoptLong_1.0.5 GenomeInfoDbData_1.2.7
#> [175] iterators_1.0.13 impute_1.68.0
#> [177] haven_2.4.3 reshape2_1.4.4
#> [179] gtable_0.3.0
Castellano-Escuder, Pol, Raúl González-Domı́nguez, David S Wishart, Cristina Andrés-Lacueva, and Alex Sánchez-Pla. 2020. “FOBI: An Ontology to Represent Food Intake Data and Associate It with Metabolomic Data.” Database 2020.