Contents

Compiled date: 2024-04-30

Last edited: 2022-01-12

License: GPL-3

1 Installation

Run the following code to install the Bioconductor version of the package.

# install.packages("BiocManager")
BiocManager::install("fobitools")

2 Load fobitools

library(fobitools)

You can also load some additional packages that will be very useful in this vignette.

library(dplyr)
library(kableExtra)

3 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
almond (whole, raw) 7 5 0.0000001 0.0000152 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
soybean (whole) 23 7 0.0000002 0.0000152 FOBI:030692, FOBI:030705, FOBI:030320, FOBI:030699, FOBI:030703, FOBI:050030, FOBI:050034
black tea leaf (dry) 8 5 0.0000003 0.0000170 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
green tea leaf (dry) 9 5 0.0000008 0.0000170 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
kale leaf (raw) 9 5 0.0000008 0.0000170 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
red tea 9 5 0.0000008 0.0000170 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
red velvet 9 5 0.0000008 0.0000170 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
sweet potato vegetable food product 10 5 0.0000015 0.0000223 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
pea (whole) 5 4 0.0000019 0.0000223 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
white bread 5 4 0.0000019 0.0000223 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
White fish 5 4 0.0000019 0.0000223 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
white sugar 5 4 0.0000019 0.0000223 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
white wine 5 4 0.0000019 0.0000223 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
onion (whole, raw) 6 4 0.0000056 0.0000612 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
cherry (whole, raw) 14 5 0.0000116 0.0000985 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
Red meat 14 5 0.0000116 0.0000985 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
black pepper food product 7 4 0.0000128 0.0000985 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
broccoli floret (whole, raw) 7 4 0.0000128 0.0000985 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
celery stalk (raw) 7 4 0.0000128 0.0000985 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
lettuce vegetable food product 7 4 0.0000128 0.0000985 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
lemon (whole, raw) 15 5 0.0000172 0.0001263 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
chickpea (whole) 3 3 0.0000189 0.0001320 FOBI:030320, FOBI:050030, FOBI:050034
tomato (whole, raw) 17 5 0.0000347 0.0002321 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
black currant (whole, raw) 9 4 0.0000448 0.0002465 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
blackberry (whole, raw) 9 4 0.0000448 0.0002465 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
carrot root (whole, raw) 9 4 0.0000448 0.0002465 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
egg food product 9 4 0.0000448 0.0002465 FOBI:030692, FOBI:030705, FOBI:030699, FOBI:030703
tea food product 9 4 0.0000448 0.0002465 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
bean (whole) 10 4 0.0000737 0.0003364 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
pear (whole, raw) 10 4 0.0000737 0.0003364 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
strawberry (whole, raw) 10 4 0.0000737 0.0003364 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
avocado (whole, raw) 4 3 0.0000743 0.0003364 FOBI:030565, FOBI:050030, FOBI:050034
beetroot 4 3 0.0000743 0.0003364 FOBI:030565, FOBI:050030, FOBI:050034
fig (whole) 4 3 0.0000743 0.0003364 FOBI:030565, FOBI:050030, FOBI:050034
wine (food product) 21 5 0.0001088 0.0004786 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
cumin seed (whole, dried) 11 4 0.0001142 0.0004885 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
legume food product 114 9 0.0001349 0.0005120 FOBI:030692, FOBI:030705, FOBI:030565, FOBI:030320, FOBI:030562, FOBI:030699, FOBI:030703, FOBI:050030, FOBI:050034
dairy food product 12 4 0.0001690 0.0005120 FOBI:030692, FOBI:030705, FOBI:030699, FOBI:030703
oregano (ground) 12 4 0.0001690 0.0005120 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
cucumber (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
Dark yellow vegetables 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
eggplant (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030320, FOBI:050030, FOBI:050034
ginger root 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
hazelnut 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
kiwi 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
pineapple (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
prune food product 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
pumpkin (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
radish (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
raisin (whole) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
sauerkraut 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
soybean oil 5 3 0.0001829 0.0005120 FOBI:030320, FOBI:050030, FOBI:050034
spinach (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
turnip (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
watermelon (whole, raw) 5 3 0.0001829 0.0005120 FOBI:030565, FOBI:050030, FOBI:050034
coffee (liquid drink) 13 4 0.0002407 0.0006619 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
orange (whole, raw) 14 4 0.0003323 0.0008667 FOBI:030565, FOBI:030562, FOBI:050030, FOBI:050034
bell pepper 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
cabbage (whole, raw) 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
hot pepper vegetable food product 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
peanut (whole, raw) 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
pomegranate (whole, raw) 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
potato (whole, raw) 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
yellow bell pepper (whole, raw) 6 3 0.0003602 0.0008667 FOBI:030565, FOBI:050030, FOBI:050034
meat food product 15 4 0.0004469 0.0010588 FOBI:030692, FOBI:030705, FOBI:030699, FOBI:030703
Whole grain cereal products 132 9 0.0005280 0.0012320 FOBI:030692, FOBI:030705, FOBI:030565, FOBI:030320, FOBI:030562, FOBI:030699, FOBI:030703, FOBI:050030, FOBI:050034
grapefruit (whole, raw) 16 4 0.0005876 0.0013506 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
banana (whole, ripe) 7 3 0.0006207 0.0013854 FOBI:030565, FOBI:050030, FOBI:050034
cauliflower (whole, raw) 7 3 0.0006207 0.0013854 FOBI:030565, FOBI:050030, FOBI:050034
black coffee 2 2 0.0008027 0.0016054 FOBI:030565, FOBI:030320
black turtle bean (whole) 2 2 0.0008027 0.0016054 FOBI:030565, FOBI:030320
corn (vegetable) food product 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
fruit (dried) 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
mango (whole, raw) 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
papaya (whole, raw) 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
rhubarb stalk (whole, raw) 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
squash (whole, raw) 2 2 0.0008027 0.0016054 FOBI:050030, FOBI:050034
nut (whole or part) 140 9 0.0009113 0.0017719 FOBI:030692, FOBI:030705, FOBI:030565, FOBI:030320, FOBI:030562, FOBI:030699, FOBI:030703, FOBI:050030, FOBI:050034
cereal 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
cereal food product 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
milk product (fermented) 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
peach (whole, raw) 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
quinoa seed (dried) 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
sunflower seed oil 8 3 0.0009780 0.0017719 FOBI:030565, FOBI:050030, FOBI:050034
wheat 8 3 0.0009780 0.0017719 FOBI:030320, FOBI:050030, FOBI:050034
apricot (whole, raw) 9 3 0.0014446 0.0024997 FOBI:030565, FOBI:050030, FOBI:050034
bread food product 9 3 0.0014446 0.0024997 FOBI:030320, FOBI:050030, FOBI:050034
cocoa 9 3 0.0014446 0.0024997 FOBI:030320, FOBI:050030, FOBI:050034
whole bread 9 3 0.0014446 0.0024997 FOBI:030320, FOBI:050030, FOBI:050034
apple juice 10 3 0.0020322 0.0034016 FOBI:030565, FOBI:030320, FOBI:030562
orange juice 10 3 0.0020322 0.0034016 FOBI:030565, FOBI:030320, FOBI:030562
plum (whole, raw) 10 3 0.0020322 0.0034016 FOBI:030565, FOBI:050030, FOBI:050034
beer 22 4 0.0021707 0.0035945 FOBI:030565, FOBI:030320, FOBI:050030, FOBI:050034
asparagus (whole, raw) 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
butter 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
melon (raw) 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
nectarine (whole, raw) 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
peanut butter 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
stem or spear vegetable 3 2 0.0023703 0.0036503 FOBI:030565, FOBI:030320
zucchini plant 3 2 0.0023703 0.0036503 FOBI:050030, FOBI:050034
grain plant 11 3 0.0027514 0.0041137 FOBI:030320, FOBI:050030, FOBI:050034
grain product 11 3 0.0027514 0.0041137 FOBI:030320, FOBI:050030, FOBI:050034
rye food product 11 3 0.0027514 0.0041137 FOBI:030320, FOBI:050030, FOBI:050034
olive (whole, ripe) 12 3 0.0036122 0.0053488 FOBI:030320, FOBI:050030, FOBI:050034
apple (whole) 44 5 0.0043834 0.0064289 FOBI:030565, FOBI:030320, FOBI:030562, FOBI:050030, FOBI:050034
chicory (whole, raw) 4 2 0.0046664 0.0067794 FOBI:050030, FOBI:050034
flour 14 3 0.0057940 0.0083390 FOBI:030320, FOBI:050030, FOBI:050034
blueberry (whole, raw) 5 2 0.0076553 0.0108158 FOBI:030565, FOBI:030320
pasta 5 2 0.0076553 0.0108158 FOBI:050030, FOBI:050034

4 Network visualization of metaboliteList terms

Then, 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)

5 Session Information

sessionInfo()
#> R version 4.4.0 beta (2024-04-14 r86421)
#> Platform: x86_64-apple-darwin20
#> Running under: macOS Monterey 12.7.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: America/New_York
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] kableExtra_1.4.0 lubridate_1.9.3  forcats_1.0.0    stringr_1.5.1   
#>  [5] dplyr_1.1.4      purrr_1.0.2      readr_2.1.5      tidyr_1.3.1     
#>  [9] tibble_3.2.1     ggplot2_3.5.1    tidyverse_2.0.0  fobitools_1.12.0
#> [13] BiocStyle_2.32.0
#> 
#> loaded via a namespace (and not attached):
#>   [1] DBI_1.2.2              ada_2.0-5              qdapRegex_0.7.8       
#>   [4] gridExtra_2.3          rlang_1.1.3            magrittr_2.0.3        
#>   [7] e1071_1.7-14           compiler_4.4.0         RSQLite_2.3.6         
#>  [10] systemfonts_1.0.6      vctrs_0.6.5            pkgconfig_2.0.3       
#>  [13] crayon_1.5.2           fastmap_1.1.1          magick_2.8.3          
#>  [16] labeling_0.4.3         ggraph_2.2.1           utf8_1.2.4            
#>  [19] rmarkdown_2.26         prodlim_2023.08.28     tzdb_0.4.0            
#>  [22] tinytex_0.50           bit_4.0.5              xfun_0.43             
#>  [25] cachem_1.0.8           jsonlite_1.8.8         blob_1.2.4            
#>  [28] highr_0.10             tictoc_1.2.1           BiocParallel_1.38.0   
#>  [31] tweenr_2.0.3           syuzhet_1.0.7          parallel_4.4.0        
#>  [34] R6_2.5.1               bslib_0.7.0            stringi_1.8.3         
#>  [37] textclean_0.9.3        parallelly_1.37.1      rpart_4.1.23          
#>  [40] jquerylib_0.1.4        Rcpp_1.0.12            bookdown_0.39         
#>  [43] knitr_1.46             future.apply_1.11.2    clisymbols_1.2.0      
#>  [46] Matrix_1.7-0           splines_4.4.0          nnet_7.3-19           
#>  [49] igraph_2.0.3           timechange_0.3.0       tidyselect_1.2.1      
#>  [52] rstudioapi_0.16.0      yaml_2.3.8             viridis_0.6.5         
#>  [55] codetools_0.2-20       listenv_0.9.1          lattice_0.22-6        
#>  [58] withr_3.0.0            evaluate_0.23          ontologyIndex_2.12    
#>  [61] future_1.33.2          survival_3.6-4         proxy_0.4-27          
#>  [64] polyclip_1.10-6        xml2_1.3.6             pillar_1.9.0          
#>  [67] BiocManager_1.30.22    lexicon_1.2.1          generics_0.1.3        
#>  [70] vroom_1.6.5            hms_1.1.3              munsell_0.5.1         
#>  [73] scales_1.3.0           ff_4.0.12              globals_0.16.3        
#>  [76] xtable_1.8-4           class_7.3-22           glue_1.7.0            
#>  [79] RecordLinkage_0.4-12.4 tools_4.4.0            data.table_1.15.4     
#>  [82] fgsea_1.30.0           graphlayouts_1.1.1     fastmatch_1.1-4       
#>  [85] tidygraph_1.3.1        cowplot_1.1.3          grid_4.4.0            
#>  [88] ipred_0.9-14           colorspace_2.1-0       ggforce_0.4.2         
#>  [91] cli_3.6.2              evd_2.3-7              fansi_1.0.6           
#>  [94] viridisLite_0.4.2      svglite_2.1.3          lava_1.8.0            
#>  [97] gtable_0.3.5           sass_0.4.9             digest_0.6.35         
#> [100] ggrepel_0.9.5          farver_2.1.1           memoise_2.0.1         
#> [103] htmltools_0.5.8.1      lifecycle_1.0.4        bit64_4.0.5           
#> [106] MASS_7.3-60.2

References

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.