Simple food over representation analysis (ORA)

Compiled date: 2026-04-29

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
grapefruit (whole, raw) 14 8 0.0000000 0.0000000 FOBI:030523, FOBI:030406, FOBI:030412, FOBI:030525, FOBI:050285, FOBI:050288, FOBI:050030, FOBI:050034
soybean oil 4 4 0.0000002 0.0000162 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
cauliflower (whole, raw) 7 4 0.0000072 0.0002742 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
rye food product 7 4 0.0000072 0.0002742 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
peach (whole, raw) 8 4 0.0000142 0.0003616 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
wheat 8 4 0.0000142 0.0003616 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
apricot (whole, raw) 9 4 0.0000252 0.0003863 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
cocoa 9 4 0.0000252 0.0003863 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
grain plant 9 4 0.0000252 0.0003863 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
grain product 9 4 0.0000252 0.0003863 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
bean (whole) 10 4 0.0000416 0.0004468 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
pear (whole, raw) 10 4 0.0000416 0.0004468 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
plum (whole, raw) 10 4 0.0000416 0.0004468 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
chickpea (whole) 4 3 0.0000496 0.0004468 FOBI:030406, FOBI:050030, FOBI:050034
white bread 4 3 0.0000496 0.0004468 FOBI:030406, FOBI:050030, FOBI:050034
White fish 4 3 0.0000496 0.0004468 FOBI:030406, FOBI:050030, FOBI:050034
white wine 4 3 0.0000496 0.0004468 FOBI:030406, FOBI:050030, FOBI:050034
olive (whole, ripe) 11 4 0.0000647 0.0005498 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
eggplant (whole, raw) 5 3 0.0001225 0.0008928 FOBI:030406, FOBI:050030, FOBI:050034
turnip (whole, raw) 5 3 0.0001225 0.0008928 FOBI:030406, FOBI:050030, FOBI:050034
white sugar 5 3 0.0001225 0.0008928 FOBI:030406, FOBI:050030, FOBI:050034
flour 13 4 0.0001371 0.0009533 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
cherry (whole, raw) 14 4 0.0001898 0.0012099 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
coffee (liquid drink) 14 4 0.0001898 0.0012099 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
bread food product 6 3 0.0002420 0.0013712 FOBI:030406, FOBI:050030, FOBI:050034
pea (whole) 6 3 0.0002420 0.0013712 FOBI:030406, FOBI:050030, FOBI:050034
whole bread 6 3 0.0002420 0.0013712 FOBI:030406, FOBI:050030, FOBI:050034
oil 16 4 0.0003375 0.0017804 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
orange (whole, raw) 16 4 0.0003375 0.0017804 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
black pepper food product 7 3 0.0004181 0.0019384 FOBI:030406, FOBI:050030, FOBI:050034
black tea leaf (dry) 7 3 0.0004181 0.0019384 FOBI:030406, FOBI:050030, FOBI:050034
kale leaf (raw) 7 3 0.0004181 0.0019384 FOBI:030406, FOBI:050030, FOBI:050034
prune food product 7 3 0.0004181 0.0019384 FOBI:030406, FOBI:050030, FOBI:050034
wine (food product) 17 4 0.0004364 0.0019637 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
butter 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
chicory (whole, raw) 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
corn (vegetable) food product 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
fruit (dried) 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
papaya (whole, raw) 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
peanut butter 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
squash (whole, raw) 2 2 0.0006243 0.0021966 FOBI:050030, FOBI:050034
blackberry (whole, raw) 8 3 0.0006604 0.0021966 FOBI:030406, FOBI:050030, FOBI:050034
green tea leaf (dry) 8 3 0.0006604 0.0021966 FOBI:030406, FOBI:050030, FOBI:050034
pomegranate (whole, raw) 8 3 0.0006604 0.0021966 FOBI:030406, FOBI:050030, FOBI:050034
red tea 8 3 0.0006604 0.0021966 FOBI:030406, FOBI:050030, FOBI:050034
red velvet 8 3 0.0006604 0.0021966 FOBI:030406, FOBI:050030, FOBI:050034
beer 19 4 0.0006949 0.0022621 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
soybean (whole) 20 4 0.0008589 0.0027377 FOBI:030406, FOBI:030412, FOBI:050030, FOBI:050034
celery stalk (raw) 9 3 0.0009780 0.0029340 FOBI:050288, FOBI:050030, FOBI:050034
quinoa seed (dried) 9 3 0.0009780 0.0029340 FOBI:030406, FOBI:050030, FOBI:050034
sunflower seed oil 9 3 0.0009780 0.0029340 FOBI:030406, FOBI:050030, FOBI:050034
black currant (whole, raw) 10 3 0.0013793 0.0040584 FOBI:030406, FOBI:050030, FOBI:050034
mango (whole, raw) 3 2 0.0018478 0.0048553 FOBI:050030, FOBI:050034
melon (raw) 3 2 0.0018478 0.0048553 FOBI:050030, FOBI:050034
nectarine (whole, raw) 3 2 0.0018478 0.0048553 FOBI:050030, FOBI:050034
rhubarb stalk (whole, raw) 3 2 0.0018478 0.0048553 FOBI:050030, FOBI:050034
zucchini plant 3 2 0.0018478 0.0048553 FOBI:050030, FOBI:050034
strawberry (whole, raw) 11 3 0.0018723 0.0048553 FOBI:030406, FOBI:050030, FOBI:050034
sweet potato vegetable food product 11 3 0.0018723 0.0048553 FOBI:030406, FOBI:050030, FOBI:050034
oregano (ground) 12 3 0.0024644 0.0061813 FOBI:030406, FOBI:050030, FOBI:050034
Red meat 12 3 0.0024644 0.0061813 FOBI:030406, FOBI:050030, FOBI:050034
cumin seed (whole, dried) 13 3 0.0031627 0.0078046 FOBI:030406, FOBI:050030, FOBI:050034
asparagus (whole, raw) 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
pasta 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
pumpkin (whole, raw) 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
rice grain food product 4 2 0.0036459 0.0080844 FOBI:030406, FOBI:030412
sauerkraut 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
spinach (whole, raw) 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
watermelon (whole, raw) 4 2 0.0036459 0.0080844 FOBI:050030, FOBI:050034
grape (whole, raw) 14 3 0.0039734 0.0086848 FOBI:030406, FOBI:050030, FOBI:050034
ale 5 2 0.0059948 0.0110507 FOBI:030406, FOBI:030412
avocado (whole, raw) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
bacon food product 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
beetroot 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
Dark yellow vegetables 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
fig (whole) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
hazelnut 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
peanut (whole, raw) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
radish (whole, raw) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
raisin (whole) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
sauce 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
yogurt (plain) 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
yogurt food product 5 2 0.0059948 0.0110507 FOBI:050030, FOBI:050034
tomato (whole, raw) 17 3 0.0071392 0.0130036 FOBI:030406, FOBI:050030, FOBI:050034
lemon (whole, raw) 18 3 0.0084561 0.0137100 FOBI:030406, FOBI:050030, FOBI:050034
almond (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
barley grain (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
bell pepper 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
cabbage (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
carrot root (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
cereal 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
cereal food product 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
cucumber (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
garlic (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
ginger root 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
hot pepper vegetable food product 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
kiwi 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
pineapple (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034
yellow bell pepper (whole, raw) 6 2 0.0088712 0.0137100 FOBI:050030, FOBI:050034

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.0 (2026-04-24)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.4 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.26.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.20.0
#> [13] BiocStyle_2.40.0
#> 
#> loaded via a namespace (and not attached):
#>   [1] DBI_1.3.0              qdapRegex_0.7.10       gridExtra_2.3         
#>   [4] rlang_1.2.0            magrittr_2.0.5         e1071_1.7-17          
#>   [7] compiler_4.6.0         RSQLite_2.4.6          systemfonts_1.3.2     
#>  [10] vctrs_0.7.3            pkgconfig_2.0.3        crayon_1.5.3          
#>  [13] fastmap_1.2.0          labeling_0.4.3         ggraph_2.2.2          
#>  [16] rmarkdown_2.31         prodlim_2026.03.11     tzdb_0.5.0            
#>  [19] bit_4.6.0              xfun_0.57              cachem_1.1.0          
#>  [22] jsonlite_2.0.0         blob_1.3.0             tictoc_1.2.1          
#>  [25] BiocParallel_1.46.0    tweenr_2.0.3           syuzhet_1.0.7         
#>  [28] parallel_4.6.0         R6_2.6.1               bslib_0.10.0          
#>  [31] stringi_1.8.7          RColorBrewer_1.1-3     textclean_0.9.7       
#>  [34] parallelly_1.47.0      rpart_4.1.27           jquerylib_0.1.4       
#>  [37] Rcpp_1.1.1-1.1         knitr_1.51             future.apply_1.20.2   
#>  [40] clisymbols_1.2.0       timechange_0.4.0       Matrix_1.7-5          
#>  [43] splines_4.6.0          nnet_7.3-20            igraph_2.3.0          
#>  [46] tidyselect_1.2.1       rstudioapi_0.18.0      yaml_2.3.12           
#>  [49] viridis_0.6.5          codetools_0.2-20       listenv_0.10.1        
#>  [52] lattice_0.22-9         withr_3.0.2            S7_0.2.2              
#>  [55] evaluate_1.0.5         ontologyIndex_2.12     future_1.70.0         
#>  [58] survival_3.8-6         proxy_0.4-29           polyclip_1.10-7       
#>  [61] xml2_1.5.2             pillar_1.11.1          BiocManager_1.30.27   
#>  [64] lexicon_1.2.1          generics_0.1.4         vroom_1.7.1           
#>  [67] hms_1.1.4              scales_1.4.0           ff_4.5.2              
#>  [70] globals_0.19.1         xtable_1.8-8           class_7.3-23          
#>  [73] glue_1.8.1             RecordLinkage_0.4-12.6 maketools_1.3.2       
#>  [76] tools_4.6.0            sys_3.4.3              data.table_1.18.2.1   
#>  [79] fgsea_1.38.0           buildtools_1.0.0       graphlayouts_1.2.3    
#>  [82] fastmatch_1.1-8        tidygraph_1.3.1        cowplot_1.2.0         
#>  [85] grid_4.6.0             ipred_0.9-15           ggforce_0.5.0         
#>  [88] cli_3.6.6              evd_2.3-7.1            textshaping_1.0.5     
#>  [91] viridisLite_0.4.3      svglite_2.2.2          lava_1.9.0            
#>  [94] gtable_0.3.6           sass_0.4.10            digest_0.6.39         
#>  [97] ggrepel_0.9.8          farver_2.1.2           memoise_2.0.1         
#> [100] htmltools_0.5.9        lifecycle_1.0.5        bit64_4.8.0           
#> [103] 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.