Contents

Compiled date: 2024-02-15

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
black tea leaf (dry) 7 5 0.0000003 0.0000176 FOBI:030….
kale leaf (raw) 7 5 0.0000003 0.0000176 FOBI:030….
Red meat 13 6 0.0000003 0.0000176 FOBI:030….
apple juice 8 5 0.0000007 0.0000211 FOBI:030….
orange juice 8 5 0.0000007 0.0000211 FOBI:030….
green tea leaf (dry) 9 5 0.0000015 0.0000293 FOBI:030….
red tea 9 5 0.0000015 0.0000293 FOBI:030….
red velvet 9 5 0.0000015 0.0000293 FOBI:030….
lemon (whole, raw) 17 6 0.0000024 0.0000398 FOBI:030….
White fish 5 4 0.0000031 0.0000398 FOBI:030….
white bread 5 4 0.0000031 0.0000398 FOBI:030….
white wine 5 4 0.0000031 0.0000398 FOBI:030….
white sugar 6 4 0.0000092 0.0001007 FOBI:030….
cherry (whole, raw) 12 5 0.0000092 0.0001007 FOBI:030….
grapefruit (whole, raw) 13 5 0.0000148 0.0001329 FOBI:030….
sweet potato vegetable food product 13 5 0.0000148 0.0001329 FOBI:030….
tomato (whole, raw) 13 5 0.0000148 0.0001329 FOBI:030….
soybean (whole) 23 6 0.0000180 0.0001526 FOBI:030….
almond (whole, raw) 7 4 0.0000212 0.0001703 FOBI:030….
soybean oil 3 3 0.0000269 0.0002061 FOBI:030….
cocoa 8 4 0.0000416 0.0003032 FOBI:030….
bread food product 9 4 0.0000737 0.0004697 FOBI:030….
rye food product 9 4 0.0000737 0.0004697 FOBI:030….
whole bread 9 4 0.0000737 0.0004697 FOBI:030….
eggplant (whole, raw) 4 3 0.0001058 0.0006228 FOBI:030….
stem or spear vegetable 4 3 0.0001058 0.0006228 FOBI:030….
carrot root (whole, raw) 10 4 0.0001208 0.0006601 FOBI:030….
dairy food product 10 4 0.0001208 0.0006601 FOBI:030….
wine (food product) 20 5 0.0001606 0.0008471 FOBI:030….
grain plant 11 4 0.0001867 0.0008927 FOBI:030….
grain product 11 4 0.0001867 0.0008927 FOBI:030….
oregano (ground) 11 4 0.0001867 0.0008927 FOBI:030….
herb 5 3 0.0002599 0.0012050 FOBI:030….
olive (whole, ripe) 13 4 0.0003913 0.0017609 FOBI:030….
black pepper food product 6 3 0.0005106 0.0021693 FOBI:030….
vinegar 6 3 0.0005106 0.0021693 FOBI:030….
coffee (liquid drink) 14 4 0.0005388 0.0021693 FOBI:030….
cumin seed (whole, dried) 14 4 0.0005388 0.0021693 FOBI:030….
strawberry (whole, raw) 15 4 0.0007225 0.0028345 FOBI:030….
egg food product 7 3 0.0008777 0.0033572 FOBI:030….
chicory (whole, raw) 2 2 0.0010033 0.0037442 FOBI:030….
beer 17 4 0.0012183 0.0043348 FOBI:030….
flour 17 4 0.0012183 0.0043348 FOBI:030….
ale 8 3 0.0013793 0.0044902 FOBI:030….
blackberry (whole, raw) 8 3 0.0013793 0.0044902 FOBI:030….
blueberry (whole, raw) 8 3 0.0013793 0.0044902 FOBI:030….
wheat 8 3 0.0013793 0.0044902 FOBI:030….
oil 19 4 0.0019184 0.0061148 FOBI:030….
pear (whole, raw) 9 3 0.0020322 0.0062184 FOBI:030….
raspberry (whole, raw) 9 3 0.0020322 0.0062184 FOBI:030….
black coffee 3 2 0.0029562 0.0082235 FOBI:030….
black turtle bean (whole) 3 2 0.0029562 0.0082235 FOBI:030….
chickpea (whole) 3 2 0.0029562 0.0082235 FOBI:030….
lentil (whole) 3 2 0.0029562 0.0082235 FOBI:030….
turnip (whole, raw) 3 2 0.0029562 0.0082235 FOBI:030….
black currant (whole, raw) 11 3 0.0038505 0.0101574 FOBI:030….
orange (whole, raw) 11 3 0.0038505 0.0101574 FOBI:030….
tea food product 11 3 0.0038505 0.0101574 FOBI:030….
cauliflower (whole, raw) 4 2 0.0058065 0.0145638 FOBI:030….
celery stalk (raw) 4 2 0.0058065 0.0145638 FOBI:030….
pea (whole) 4 2 0.0058065 0.0145638 FOBI:030….
legume food product 111 8 0.0063296 0.0156197 FOBI:030….
grape (whole, raw) 14 3 0.0080462 0.0192355 FOBI:030….
meat food product 14 3 0.0080462 0.0192355 FOBI:030….
Whole grain cereal products 117 8 0.0092659 0.0217036 FOBI:030….
pomegranate (whole, raw) 5 2 0.0095042 0.0217036 FOBI:030….
rice grain food product 5 2 0.0095042 0.0217036 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 Under development (unstable) (2024-01-16 r85808)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 22.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#> 
#> 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       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] SummarizedExperiment_1.33.3   Biobase_2.63.0               
#>  [3] GenomicRanges_1.55.3          GenomeInfoDb_1.39.6          
#>  [5] IRanges_2.37.1                S4Vectors_0.41.3             
#>  [7] BiocGenerics_0.49.1           MatrixGenerics_1.15.0        
#>  [9] matrixStats_1.2.0             metabolomicsWorkbenchR_1.13.0
#> [11] POMA_1.13.14                  ggrepel_0.9.5                
#> [13] rvest_1.0.4                   kableExtra_1.4.0             
#> [15] lubridate_1.9.3               forcats_1.0.0                
#> [17] stringr_1.5.1                 dplyr_1.1.4                  
#> [19] purrr_1.0.2                   readr_2.1.5                  
#> [21] tidyr_1.3.1                   tibble_3.2.1                 
#> [23] ggplot2_3.4.4                 tidyverse_2.0.0              
#> [25] fobitools_1.11.4              BiocStyle_2.31.0             
#> 
#> loaded via a namespace (and not attached):
#>   [1] rstudioapi_0.15.0           jsonlite_1.8.8             
#>   [3] MultiAssayExperiment_1.29.1 magrittr_2.0.3             
#>   [5] magick_2.8.2                farver_2.1.1               
#>   [7] rmarkdown_2.25              zlibbioc_1.49.0            
#>   [9] vctrs_0.6.5                 memoise_2.0.1              
#>  [11] RCurl_1.98-1.14             janitor_2.2.0              
#>  [13] S4Arrays_1.3.3              htmltools_0.5.7            
#>  [15] curl_5.2.0                  qdapRegex_0.7.8            
#>  [17] tictoc_1.2                  SparseArray_1.3.4          
#>  [19] sass_0.4.8                  parallelly_1.37.0          
#>  [21] bslib_0.6.1                 impute_1.77.0              
#>  [23] RecordLinkage_0.4-12.4      cachem_1.0.8               
#>  [25] igraph_2.0.1.1              lifecycle_1.0.4            
#>  [27] pkgconfig_2.0.3             Matrix_1.6-5               
#>  [29] R6_2.5.1                    fastmap_1.1.1              
#>  [31] snakecase_0.11.1            GenomeInfoDbData_1.2.11    
#>  [33] future_1.33.1               selectr_0.4-2              
#>  [35] digest_0.6.34               syuzhet_1.0.7              
#>  [37] colorspace_2.1-0            ps_1.7.6                   
#>  [39] RSQLite_2.3.5               labeling_0.4.3             
#>  [41] fansi_1.0.6                 timechange_0.3.0           
#>  [43] abind_1.4-5                 httr_1.4.7                 
#>  [45] polyclip_1.10-6             compiler_4.4.0             
#>  [47] proxy_0.4-27                bit64_4.0.5                
#>  [49] withr_3.0.0                 BiocParallel_1.37.0        
#>  [51] viridis_0.6.5               DBI_1.2.1                  
#>  [53] highr_0.10                  ggforce_0.4.1              
#>  [55] MASS_7.3-60.2               lava_1.7.3                 
#>  [57] DelayedArray_0.29.2         textclean_0.9.3            
#>  [59] tools_4.4.0                 chromote_0.2.0             
#>  [61] future.apply_1.11.1         nnet_7.3-19                
#>  [63] glue_1.7.0                  promises_1.2.1             
#>  [65] grid_4.4.0                  fgsea_1.29.0               
#>  [67] generics_0.1.3              gtable_0.3.4               
#>  [69] lexicon_1.2.1               tzdb_0.4.0                 
#>  [71] class_7.3-22                websocket_1.4.1            
#>  [73] data.table_1.15.0           hms_1.1.3                  
#>  [75] XVector_0.43.1              tidygraph_1.3.1            
#>  [77] xml2_1.3.6                  utf8_1.2.4                 
#>  [79] pillar_1.9.0                limma_3.59.3               
#>  [81] vroom_1.6.5                 later_1.3.2                
#>  [83] splines_4.4.0               tweenr_2.0.2               
#>  [85] lattice_0.22-5              survival_3.5-8             
#>  [87] bit_4.0.5                   tidyselect_1.2.0           
#>  [89] knitr_1.45                  gridExtra_2.3              
#>  [91] bookdown_0.37               svglite_2.1.3              
#>  [93] xfun_0.42                   graphlayouts_1.1.0         
#>  [95] statmod_1.5.0               stringi_1.8.3              
#>  [97] yaml_2.3.8                  evaluate_0.23              
#>  [99] codetools_0.2-19            evd_2.3-6.1                
#> [101] ggraph_2.1.0                BiocManager_1.30.22        
#> [103] cli_3.6.2                   ontologyIndex_2.11         
#> [105] rpart_4.1.23                xtable_1.8-4               
#> [107] systemfonts_1.0.5           struct_1.15.4              
#> [109] munsell_0.5.0               processx_3.8.3             
#> [111] jquerylib_0.1.4             Rcpp_1.0.12                
#> [113] globals_0.16.2              parallel_4.4.0             
#> [115] blob_1.2.4                  bitops_1.0-7               
#> [117] ff_4.0.12                   listenv_0.9.1              
#> [119] viridisLite_0.4.2           ipred_0.9-14               
#> [121] scales_1.3.0                prodlim_2023.08.28         
#> [123] e1071_1.7-14                crayon_1.5.2               
#> [125] clisymbols_1.2.0            rlang_1.1.3                
#> [127] ada_2.0-5                   cowplot_1.1.3              
#> [129] fastmatch_1.1-4

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.