Contents

Compiled date: 2022-11-01

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
Red meat 20 7 0.0000000 0.0000022 FOBI:030….
chickpea (whole) 6 4 0.0000031 0.0001536 FOBI:030….
green tea leaf (dry) 14 5 0.0000053 0.0001536 FOBI:030….
red tea 14 5 0.0000053 0.0001536 FOBI:030….
red velvet 14 5 0.0000053 0.0001536 FOBI:030….
cocoa 7 4 0.0000072 0.0001536 FOBI:030….
vinegar 7 4 0.0000072 0.0001536 FOBI:030….
pea (whole) 8 4 0.0000142 0.0002367 FOBI:030….
cherry (whole, raw) 17 5 0.0000160 0.0002367 FOBI:030….
sweet potato vegetable food product 17 5 0.0000160 0.0002367 FOBI:030….
tomato (whole, raw) 18 5 0.0000219 0.0002367 FOBI:030….
ale 9 4 0.0000252 0.0002367 FOBI:030….
bread food product 9 4 0.0000252 0.0002367 FOBI:030….
wheat 9 4 0.0000252 0.0002367 FOBI:030….
white sugar 9 4 0.0000252 0.0002367 FOBI:030….
whole bread 9 4 0.0000252 0.0002367 FOBI:030….
apple juice 10 4 0.0000416 0.0002973 FOBI:030….
black tea leaf (dry) 10 4 0.0000416 0.0002973 FOBI:030….
grain plant 10 4 0.0000416 0.0002973 FOBI:030….
grain product 10 4 0.0000416 0.0002973 FOBI:030….
orange juice 10 4 0.0000416 0.0002973 FOBI:030….
kale leaf (raw) 11 4 0.0000647 0.0004060 FOBI:030….
pear (whole, raw) 11 4 0.0000647 0.0004060 FOBI:030….
wine (food product) 22 5 0.0000650 0.0004060 FOBI:030….
raspberry (whole, raw) 12 4 0.0000960 0.0005757 FOBI:030….
lentil (whole) 5 3 0.0001225 0.0006808 FOBI:030….
rice grain food product 5 3 0.0001225 0.0006808 FOBI:030….
olive (whole, ripe) 13 4 0.0001371 0.0007343 FOBI:030….
coffee (liquid drink) 14 4 0.0001898 0.0009816 FOBI:030….
eggplant (whole, raw) 6 3 0.0002420 0.0011343 FOBI:030….
herb 6 3 0.0002420 0.0011343 FOBI:030….
stem or spear vegetable 6 3 0.0002420 0.0011343 FOBI:030….
bean (whole) 16 4 0.0003375 0.0014462 FOBI:030….
flour 16 4 0.0003375 0.0014462 FOBI:030….
strawberry (whole, raw) 16 4 0.0003375 0.0014462 FOBI:030….
White fish 7 3 0.0004181 0.0016503 FOBI:030….
rye food product 7 3 0.0004181 0.0016503 FOBI:030….
white bread 7 3 0.0004181 0.0016503 FOBI:030….
lemon (whole, raw) 18 4 0.0005548 0.0021339 FOBI:030….
blueberry (whole, raw) 8 3 0.0006604 0.0023587 FOBI:030….
cauliflower (whole, raw) 8 3 0.0006604 0.0023587 FOBI:030….
white wine 8 3 0.0006604 0.0023587 FOBI:030….
beer 20 4 0.0008589 0.0029961 FOBI:030….
blackberry (whole, raw) 9 3 0.0009780 0.0033341 FOBI:030….
almond (whole, raw) 10 3 0.0013793 0.0045978 FOBI:030….
Lean meat 3 2 0.0018478 0.0058510 FOBI:030….
black pepper food product 11 3 0.0018723 0.0058510 FOBI:030….
carrot root (whole, raw) 11 3 0.0018723 0.0058510 FOBI:030….
black currant (whole, raw) 13 3 0.0031627 0.0094880 FOBI:030….
oregano (ground) 13 3 0.0031627 0.0094880 FOBI:030….
grapefruit (whole, raw) 14 3 0.0039734 0.0116866 FOBI:030….
oil 15 3 0.0049028 0.0138759 FOBI:030….
orange (whole, raw) 15 3 0.0049028 0.0138759 FOBI:030….
cumin seed (whole, dried) 16 3 0.0059564 0.0155038 FOBI:030….
black coffee 5 2 0.0059948 0.0155038 FOBI:030….
black turtle bean (whole) 5 2 0.0059948 0.0155038 FOBI:030….
prune food product 5 2 0.0059948 0.0155038 FOBI:030….
soybean oil 5 2 0.0059948 0.0155038 FOBI:030….
apple (whole) 57 5 0.0074426 0.0189219 FOBI:030….
chocolate 6 2 0.0088712 0.0218144 FOBI:030….
pomegranate (whole, raw) 6 2 0.0088712 0.0218144 FOBI:030….

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.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.16-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.28.0  Biobase_2.58.0              
#>  [3] GenomicRanges_1.50.0         GenomeInfoDb_1.34.0         
#>  [5] IRanges_2.32.0               S4Vectors_0.36.0            
#>  [7] BiocGenerics_0.44.0          MatrixGenerics_1.10.0       
#>  [9] matrixStats_0.62.0           metabolomicsWorkbenchR_1.8.0
#> [11] POMA_1.8.0                   ggrepel_0.9.1               
#> [13] rvest_1.0.3                  kableExtra_1.3.4            
#> [15] forcats_0.5.2                stringr_1.4.1               
#> [17] dplyr_1.0.10                 purrr_0.3.5                 
#> [19] readr_2.1.3                  tidyr_1.2.1                 
#> [21] tibble_3.1.8                 ggplot2_3.3.6               
#> [23] tidyverse_1.3.2              fobitools_1.6.0             
#> [25] BiocStyle_2.26.0            
#> 
#> loaded via a namespace (and not attached):
#>   [1] readxl_1.4.1                backports_1.4.1            
#>   [3] fastmatch_1.1-3             systemfonts_1.0.4          
#>   [5] selectr_0.4-2               igraph_1.3.5               
#>   [7] RecordLinkage_0.4-12.3      splines_4.2.1              
#>   [9] BiocParallel_1.32.0         listenv_0.8.0              
#>  [11] digest_0.6.30               htmltools_0.5.3            
#>  [13] viridis_0.6.2               magick_2.7.3               
#>  [15] fansi_1.0.3                 magrittr_2.0.3             
#>  [17] memoise_2.0.1               cluster_2.1.4              
#>  [19] googlesheets4_1.0.1         limma_3.54.0               
#>  [21] tzdb_0.3.0                  globals_0.16.1             
#>  [23] graphlayouts_0.8.3          modelr_0.1.9               
#>  [25] vroom_1.6.0                 svglite_2.1.0              
#>  [27] colorspace_2.0-3            blob_1.2.3                 
#>  [29] haven_2.5.1                 xfun_0.34                  
#>  [31] RCurl_1.98-1.9              crayon_1.5.2               
#>  [33] jsonlite_1.8.3              impute_1.72.0              
#>  [35] survival_3.4-0              glue_1.6.2                 
#>  [37] polyclip_1.10-4             gtable_0.3.1               
#>  [39] gargle_1.2.1                zlibbioc_1.44.0            
#>  [41] XVector_0.38.0              ipred_0.9-13               
#>  [43] webshot_0.5.4               DelayedArray_0.24.0        
#>  [45] evd_2.3-6.1                 future.apply_1.9.1         
#>  [47] scales_1.2.1                DBI_1.1.3                  
#>  [49] qdapRegex_0.7.5             Rcpp_1.0.9                 
#>  [51] viridisLite_0.4.1           xtable_1.8-4               
#>  [53] bit_4.0.4                   proxy_0.4-27               
#>  [55] clisymbols_1.2.0            textclean_0.9.3            
#>  [57] lava_1.7.0                  prodlim_2019.11.13         
#>  [59] httr_1.4.4                  ontologyIndex_2.10         
#>  [61] fgsea_1.24.0                ellipsis_0.3.2             
#>  [63] ff_4.0.7                    pkgconfig_2.0.3            
#>  [65] farver_2.1.1                nnet_7.3-18                
#>  [67] sass_0.4.2                  dbplyr_2.2.1               
#>  [69] utf8_1.2.2                  tidyselect_1.2.0           
#>  [71] labeling_0.4.2              rlang_1.0.6                
#>  [73] munsell_0.5.0               cellranger_1.1.0           
#>  [75] tools_4.2.1                 cachem_1.0.6               
#>  [77] cli_3.4.1                   generics_0.1.3             
#>  [79] RSQLite_2.2.18              broom_1.0.1                
#>  [81] evaluate_0.17               fastmap_1.1.0              
#>  [83] yaml_2.3.6                  knitr_1.40                 
#>  [85] bit64_4.0.5                 fs_1.5.2                   
#>  [87] tidygraph_1.2.2             ggraph_2.1.0               
#>  [89] nlme_3.1-160                future_1.28.0              
#>  [91] tictoc_1.1                  xml2_1.3.3                 
#>  [93] compiler_4.2.1              rstudioapi_0.14            
#>  [95] curl_4.3.3                  e1071_1.7-12               
#>  [97] reprex_2.0.2                syuzhet_1.0.6              
#>  [99] tweenr_2.0.2                bslib_0.4.0                
#> [101] stringi_1.7.8               highr_0.9                  
#> [103] lattice_0.20-45             Matrix_1.5-1               
#> [105] permute_0.9-7               vegan_2.6-4                
#> [107] vctrs_0.5.0                 pillar_1.8.1               
#> [109] lifecycle_1.0.3             BiocManager_1.30.19        
#> [111] jquerylib_0.1.4             bitops_1.0-7               
#> [113] data.table_1.14.4           cowplot_1.1.1              
#> [115] R6_2.5.1                    bookdown_0.29              
#> [117] struct_1.10.0               gridExtra_2.3              
#> [119] parallelly_1.32.1           lexicon_1.2.1              
#> [121] ada_2.0-5                   codetools_0.2-18           
#> [123] MASS_7.3-58.1               assertthat_0.2.1           
#> [125] withr_2.5.0                 GenomeInfoDbData_1.2.9     
#> [127] mgcv_1.8-41                 MultiAssayExperiment_1.24.0
#> [129] parallel_4.2.1              hms_1.1.2                  
#> [131] grid_4.2.1                  rpart_4.1.19               
#> [133] class_7.3-20                rmarkdown_2.17             
#> [135] googledrive_2.0.0           ggforce_0.4.1              
#> [137] lubridate_1.8.0

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.