Simple food over representation analysis (ORA)

Compiled date: 2026-07-04

Last edited: 2022-01-12

License: GPL-3

Installation

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

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

Load 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
green tea leaf (dry) 9 6 0.0000000 0.0000009 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:030566, FOBI:050243, FOBI:050262
red tea 9 6 0.0000000 0.0000009 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:030566, FOBI:050243, FOBI:050262
red velvet 9 6 0.0000000 0.0000009 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:030566, FOBI:050243, FOBI:050262
grapefruit (whole, raw) 10 6 0.0000000 0.0000016 FOBI:030406, FOBI:030565, FOBI:050242, FOBI:050243, FOBI:050262, FOBI:050288
kale leaf (raw) 6 5 0.0000001 0.0000022 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
lettuce vegetable food product 7 5 0.0000003 0.0000064 FOBI:030565, FOBI:030562, FOBI:030566, FOBI:050243, FOBI:050262
Red meat 13 6 0.0000003 0.0000072 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:030566, FOBI:050243, FOBI:050262
orange (whole, raw) 14 6 0.0000006 0.0000109 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242, FOBI:050243, FOBI:050262
apple juice 10 5 0.0000030 0.0000351 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242, FOBI:050243
lemon (whole, raw) 10 5 0.0000030 0.0000351 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242, FOBI:050243
orange juice 10 5 0.0000030 0.0000351 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242, FOBI:050243
black tea leaf (dry) 5 4 0.0000031 0.0000351 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050243
celery stalk (raw) 5 4 0.0000031 0.0000351 FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050288
wine (food product) 20 6 0.0000072 0.0000746 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242, FOBI:050243, FOBI:050262
cauliflower (whole, raw) 6 4 0.0000092 0.0000841 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
bean (whole) 12 5 0.0000092 0.0000841 FOBI:030406, FOBI:030565, FOBI:030566, FOBI:050243, FOBI:050262
strawberry (whole, raw) 13 5 0.0000148 0.0001268 FOBI:030406, FOBI:030565, FOBI:030566, FOBI:050243, FOBI:050262
almond (whole, raw) 7 4 0.0000212 0.0001457 FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
black pepper food product 7 4 0.0000212 0.0001457 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
sweet potato vegetable food product 14 5 0.0000226 0.0001457 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
tomato (whole, raw) 14 5 0.0000226 0.0001457 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
pumpkin (whole, raw) 3 3 0.0000269 0.0001457 FOBI:030565, FOBI:050243, FOBI:050262
radish (whole, raw) 3 3 0.0000269 0.0001457 FOBI:030565, FOBI:050243, FOBI:050262
sauerkraut 3 3 0.0000269 0.0001457 FOBI:030565, FOBI:050243, FOBI:050262
spinach (whole, raw) 3 3 0.0000269 0.0001457 FOBI:030565, FOBI:050243, FOBI:050262
turnip (whole, raw) 3 3 0.0000269 0.0001457 FOBI:030406, FOBI:030565, FOBI:050243
watermelon (whole, raw) 3 3 0.0000269 0.0001457 FOBI:030565, FOBI:050243, FOBI:050262
apricot (whole, raw) 8 4 0.0000416 0.0002025 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
broccoli floret (whole, raw) 8 4 0.0000416 0.0002025 FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
peach (whole, raw) 8 4 0.0000416 0.0002025 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
blackberry (whole, raw) 9 4 0.0000737 0.0003362 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
raspberry (whole, raw) 9 4 0.0000737 0.0003362 FOBI:030406, FOBI:030565, FOBI:030566, FOBI:050243
black coffee 4 3 0.0001058 0.0004176 FOBI:030406, FOBI:030565, FOBI:050243
black turtle bean (whole) 4 3 0.0001058 0.0004176 FOBI:030406, FOBI:030565, FOBI:050243
stem or spear vegetable 4 3 0.0001058 0.0004176 FOBI:030406, FOBI:030565, FOBI:050243
white bread 4 3 0.0001058 0.0004176 FOBI:030406, FOBI:030565, FOBI:050243
White fish 4 3 0.0001058 0.0004176 FOBI:030406, FOBI:030565, FOBI:050243
black currant (whole, raw) 10 4 0.0001208 0.0004302 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
pear (whole, raw) 10 4 0.0001208 0.0004302 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
plum (whole, raw) 10 4 0.0001208 0.0004302 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
tea food product 10 4 0.0001208 0.0004302 FOBI:030565, FOBI:030562, FOBI:050243, FOBI:050262
cherry (whole, raw) 11 4 0.0001867 0.0006339 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050243
oregano (ground) 11 4 0.0001867 0.0006339 FOBI:030406, FOBI:030565, FOBI:030562, FOBI:050242
bell pepper 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
cabbage (whole, raw) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
cucumber (whole, raw) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
hazelnut 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
hot pepper vegetable food product 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
kiwi 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
onion (whole, raw) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:030562, FOBI:050243
pineapple (whole, raw) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
raisin (whole) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
white wine 5 3 0.0002599 0.0007027 FOBI:030406, FOBI:030565, FOBI:050243
yellow bell pepper (whole, raw) 5 3 0.0002599 0.0007027 FOBI:030565, FOBI:050243, FOBI:050262
cereal 6 3 0.0005106 0.0012221 FOBI:030565, FOBI:050243, FOBI:050262
cereal food product 6 3 0.0005106 0.0012221 FOBI:030565, FOBI:050243, FOBI:050262
chocolate 6 3 0.0005106 0.0012221 FOBI:030406, FOBI:030565, FOBI:050243
pea (whole) 6 3 0.0005106 0.0012221 FOBI:030406, FOBI:030565, FOBI:050243
pomegranate (whole, raw) 6 3 0.0005106 0.0012221 FOBI:030406, FOBI:030565, FOBI:050243
prune food product 6 3 0.0005106 0.0012221 FOBI:030406, FOBI:030565, FOBI:050243
white sugar 6 3 0.0005106 0.0012221 FOBI:030406, FOBI:030565, FOBI:050243
coffee (liquid drink) 15 4 0.0007225 0.0017014 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
banana (whole, ripe) 7 3 0.0008777 0.0020022 FOBI:030565, FOBI:050243, FOBI:050262
potato (whole, raw) 7 3 0.0008777 0.0020022 FOBI:030565, FOBI:050243, FOBI:050262
grape (whole, raw) 16 4 0.0009474 0.0021280 FOBI:030406, FOBI:030565, FOBI:050243, FOBI:050262
Dark yellow vegetables 2 2 0.0010033 0.0021864 FOBI:030565, FOBI:050243
museli 2 2 0.0010033 0.0021864 FOBI:030565, FOBI:050243
blueberry (whole, raw) 8 3 0.0013793 0.0028364 FOBI:030406, FOBI:030565, FOBI:050243
peanut (whole, raw) 8 3 0.0013793 0.0028364 FOBI:030565, FOBI:050243, FOBI:050262
quinoa seed (dried) 8 3 0.0013793 0.0028364 FOBI:030406, FOBI:030565, FOBI:050262
sunflower seed oil 8 3 0.0013793 0.0028364 FOBI:030406, FOBI:030565, FOBI:050262
carrot root (whole, raw) 9 3 0.0020322 0.0040643 FOBI:030565, FOBI:050243, FOBI:050262
milk product (fermented) 9 3 0.0020322 0.0040643 FOBI:030565, FOBI:050243, FOBI:050262
soybean oil 3 2 0.0029562 0.0058324 FOBI:030406, FOBI:050262
beer 24 4 0.0048318 0.0094059 FOBI:030406, FOBI:030565, FOBI:050242, FOBI:050243
avocado (whole, raw) 4 2 0.0058065 0.0108686 FOBI:030565, FOBI:050243
beetroot 4 2 0.0058065 0.0108686 FOBI:030565, FOBI:050243
fig (whole) 4 2 0.0058065 0.0108686 FOBI:030565, FOBI:050243
egg food product 5 2 0.0095042 0.0173452 FOBI:030694, FOBI:030744
eggplant (whole, raw) 5 2 0.0095042 0.0173452 FOBI:030406, FOBI:050262

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)

Session Information

sessionInfo()
#> R version 4.6.1 (2026-06-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [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       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] kableExtra_1.4.0 lubridate_1.9.5  forcats_1.0.1    stringr_1.6.0   
#>  [5] dplyr_1.2.1      purrr_1.2.2      readr_2.2.0      tidyr_1.3.2     
#>  [9] tibble_3.3.1     ggplot2_4.0.3    tidyverse_2.0.0  fobitools_1.21.0
#> [13] BiocStyle_2.41.0
#> 
#> loaded via a namespace (and not attached):
#>   [1] DBI_1.3.0              qdapRegex_0.7.10       gridExtra_2.3.1       
#>   [4] rlang_1.2.0            magrittr_2.0.5         otel_0.2.0            
#>   [7] e1071_1.7-17           compiler_4.6.1         RSQLite_3.53.3        
#>  [10] systemfonts_1.3.2      vctrs_0.7.3            pkgconfig_2.0.3       
#>  [13] crayon_1.5.3           fastmap_1.2.0          labeling_0.4.3        
#>  [16] ggraph_2.2.2           rmarkdown_2.31         prodlim_2026.03.11    
#>  [19] tzdb_0.5.0             bit_4.6.0              xfun_0.59             
#>  [22] cachem_1.1.0           jsonlite_2.0.0         blob_1.3.0            
#>  [25] tictoc_1.2.1           BiocParallel_1.47.0    tweenr_2.0.3          
#>  [28] syuzhet_1.0.7          parallel_4.6.1         R6_2.6.1              
#>  [31] bslib_0.11.0           stringi_1.8.7          RColorBrewer_1.1-3    
#>  [34] textclean_0.9.7        parallelly_1.48.0      rpart_4.1.27          
#>  [37] jquerylib_0.1.4        Rcpp_1.1.1-1.1         knitr_1.51            
#>  [40] future.apply_1.20.2    clisymbols_1.2.0       timechange_0.4.0      
#>  [43] Matrix_1.7-5           splines_4.6.1          nnet_7.3-20           
#>  [46] igraph_2.3.3           tidyselect_1.2.1       rstudioapi_0.19.0     
#>  [49] yaml_2.3.12            viridis_0.6.5          codetools_0.2-20      
#>  [52] listenv_1.0.0          lattice_0.22-9         withr_3.0.3           
#>  [55] S7_0.2.2               evaluate_1.0.5         ontologyIndex_2.12    
#>  [58] future_1.70.0          survival_3.8-6         proxy_0.4-29          
#>  [61] polyclip_1.10-7        xml2_1.6.0             pillar_1.11.1         
#>  [64] BiocManager_1.30.27    lexicon_1.2.1          generics_0.1.4        
#>  [67] vroom_1.7.1            hms_1.1.4              scales_1.4.0          
#>  [70] ff_4.5.2               globals_0.19.1         xtable_1.8-8          
#>  [73] class_7.3-23           glue_1.8.1             RecordLinkage_0.4-12.6
#>  [76] maketools_1.3.2        tools_4.6.1            sys_3.4.3             
#>  [79] data.table_1.18.4      fgsea_1.39.2           buildtools_1.0.0      
#>  [82] graphlayouts_1.2.4     fastmatch_1.1-8        tidygraph_1.3.1       
#>  [85] cowplot_1.2.0          grid_4.6.1             ipred_0.9-15          
#>  [88] ggforce_0.5.0          cli_3.6.6              evd_2.3-7.1           
#>  [91] textshaping_1.0.5      viridisLite_0.4.3      svglite_2.2.2         
#>  [94] lava_1.9.2             gtable_0.3.6           sass_0.4.10           
#>  [97] digest_0.6.39          ggrepel_0.9.8          farver_2.1.2          
#> [100] memoise_2.0.1          htmltools_0.5.9        lifecycle_1.0.5       
#> [103] bit64_4.8.2            MASS_7.3-65

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.