Compiled date: 2021-05-19

Last edited: 2021-10-05

License: GPL-3

1 Installation

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

# install.packages("BiocManager")

2 Load fobitools


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


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) %>%

# 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::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 %>%
fobitools::ora(metaboliteList = metaboliteList, 
               metaboliteUniverse = metaboliteUniverse, 
               subOntology = "food", 
               pvalCutoff = 0.01)
className classSize overlap pval padj overlapMetabolites
dairy food product 9 6 0.0000000 0.0000002 FOBI:08823 , FOBI:030701, FOBI:030696, FOBI:030705, FOBI:030699, FOBI:030703
egg food product 7 5 0.0000001 0.0000020 FOBI:030701, FOBI:030696, FOBI:030705, FOBI:030699, FOBI:030703
meat food product 10 5 0.0000015 0.0000158 FOBI:030701, FOBI:030696, FOBI:030705, FOBI:030699, FOBI:030703
Red meat 4 3 0.0000743 0.0005199 FOBI:030706, FOBI:08823 , FOBI:030707
soybean (whole) 20 5 0.0000839 0.0005199 FOBI:030701, FOBI:030696, FOBI:030705, FOBI:030699, FOBI:030703
Lean meat 3 2 0.0023703 0.0122466 FOBI:030706, FOBI:030707

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 %>%

# create the associated graph
fobitools::fobi_graph(terms = terms, 
                      get = "anc",
                      labels = TRUE,
                      legend = TRUE)