Contents

Compiled date: 2022-04-26

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

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.0 RC (2022-04-19 r82224)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.15-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.26.0  Biobase_2.56.0              
#>  [3] GenomicRanges_1.48.0         GenomeInfoDb_1.32.0         
#>  [5] IRanges_2.30.0               S4Vectors_0.34.0            
#>  [7] BiocGenerics_0.42.0          MatrixGenerics_1.8.0        
#>  [9] matrixStats_0.62.0           metabolomicsWorkbenchR_1.6.0
#> [11] POMA_1.6.0                   ggrepel_0.9.1               
#> [13] rvest_1.0.2                  kableExtra_1.3.4            
#> [15] forcats_0.5.1                stringr_1.4.0               
#> [17] dplyr_1.0.8                  purrr_0.3.4                 
#> [19] readr_2.1.2                  tidyr_1.2.0                 
#> [21] tibble_3.1.6                 ggplot2_3.3.5               
#> [23] tidyverse_1.3.1              fobitools_1.4.0             
#> [25] BiocStyle_2.24.0            
#> 
#> loaded via a namespace (and not attached):
#>   [1] utf8_1.2.2                  tidyselect_1.1.2           
#>   [3] RSQLite_2.2.12              grid_4.2.0                 
#>   [5] BiocParallel_1.30.0         gmp_0.6-5                  
#>   [7] pROC_1.18.0                 munsell_0.5.0              
#>   [9] codetools_0.2-18            future_1.25.0              
#>  [11] withr_2.5.0                 colorspace_2.0-3           
#>  [13] highr_0.9                   knitr_1.38                 
#>  [15] rstudioapi_0.13             listenv_0.8.0              
#>  [17] labeling_0.4.2              GenomeInfoDbData_1.2.8     
#>  [19] polyclip_1.10-0             bit64_4.0.5                
#>  [21] farver_2.1.0                parallelly_1.31.1          
#>  [23] vctrs_0.4.1                 generics_0.1.2             
#>  [25] ipred_0.9-12                xfun_0.30                  
#>  [27] randomForest_4.7-1          R6_2.5.1                   
#>  [29] doParallel_1.0.17           clue_0.3-60                
#>  [31] graphlayouts_0.8.0          syuzhet_1.0.6              
#>  [33] bitops_1.0-7                cachem_1.0.6               
#>  [35] fgsea_1.22.0                DelayedArray_0.22.0        
#>  [37] assertthat_0.2.1            scales_1.2.0               
#>  [39] vroom_1.5.7                 ggraph_2.0.5               
#>  [41] nnet_7.3-17                 gtable_0.3.0               
#>  [43] globals_0.14.0              tidygraph_1.2.1            
#>  [45] timeDate_3043.102           tictoc_1.0.1               
#>  [47] rlang_1.0.2                 clisymbols_1.2.0           
#>  [49] systemfonts_1.0.4           GlobalOptions_0.1.2        
#>  [51] splines_4.2.0               impute_1.70.0              
#>  [53] ModelMetrics_1.2.2.2        selectr_0.4-2              
#>  [55] broom_0.8.0                 RecordLinkage_0.4-12.3     
#>  [57] reshape2_1.4.4              BiocManager_1.30.17        
#>  [59] yaml_2.3.5                  modelr_0.1.8               
#>  [61] backports_1.4.1             caret_6.0-92               
#>  [63] tools_4.2.0                 lava_1.6.10                
#>  [65] bookdown_0.26               ellipsis_0.3.2             
#>  [67] jquerylib_0.1.4             ff_4.0.5                   
#>  [69] RColorBrewer_1.1-3          proxy_0.4-26               
#>  [71] MultiAssayExperiment_1.22.0 Rcpp_1.0.8.3               
#>  [73] plyr_1.8.7                  zlibbioc_1.42.0            
#>  [75] RCurl_1.98-1.6              rpart_4.1.16               
#>  [77] GetoptLong_1.0.5            viridis_0.6.2              
#>  [79] haven_2.5.0                 cluster_2.1.3              
#>  [81] fs_1.5.2                    magrittr_2.0.3             
#>  [83] RSpectra_0.16-1             data.table_1.14.2          
#>  [85] magick_2.7.3                circlize_0.4.14            
#>  [87] reprex_2.0.1                hms_1.1.1                  
#>  [89] evaluate_0.15               xtable_1.8-4               
#>  [91] readxl_1.4.0                gridExtra_2.3              
#>  [93] shape_1.4.6                 compiler_4.2.0             
#>  [95] ellipse_0.4.2               crayon_1.5.1               
#>  [97] htmltools_0.5.2             mgcv_1.8-40                
#>  [99] corpcor_1.6.10              tzdb_0.3.0                 
#> [101] qdapRegex_0.7.2             lubridate_1.8.0            
#> [103] DBI_1.1.2                   tweenr_1.0.2               
#> [105] dbplyr_2.1.1                ComplexHeatmap_2.12.0      
#> [107] MASS_7.3-57                 Matrix_1.4-1               
#> [109] permute_0.9-7               cli_3.3.0                  
#> [111] gower_1.0.0                 parallel_4.2.0             
#> [113] textclean_0.9.3             evd_2.3-6                  
#> [115] RankProd_3.22.0             igraph_1.3.1               
#> [117] pkgconfig_2.0.3             lexicon_1.2.1              
#> [119] recipes_0.2.0               xml2_1.3.3                 
#> [121] foreach_1.5.2               rARPACK_0.11-0             
#> [123] svglite_2.1.0               hardhat_0.2.0              
#> [125] bslib_0.3.1                 webshot_0.5.3              
#> [127] XVector_0.36.0              prodlim_2019.11.13         
#> [129] ada_2.0-5                   digest_0.6.29              
#> [131] vegan_2.6-2                 rmarkdown_2.14             
#> [133] cellranger_1.1.0            fastmatch_1.1-3            
#> [135] curl_4.3.2                  rjson_0.2.21               
#> [137] glasso_1.11                 lifecycle_1.0.1            
#> [139] nlme_3.1-157                jsonlite_1.8.0             
#> [141] mixOmics_6.20.0             limma_3.52.0               
#> [143] viridisLite_0.4.0           fansi_1.0.3                
#> [145] pillar_1.7.0                ontologyIndex_2.7          
#> [147] lattice_0.20-45             fastmap_1.1.0              
#> [149] httr_1.4.2                  survival_3.3-1             
#> [151] glue_1.6.2                  png_0.1-7                  
#> [153] iterators_1.0.14            glmnet_4.1-4               
#> [155] bit_4.0.4                   ggforce_0.3.3              
#> [157] class_7.3-20                stringi_1.7.6              
#> [159] sass_0.4.1                  struct_1.8.0               
#> [161] blob_1.2.3                  memoise_2.0.1              
#> [163] Rmpfr_0.8-7                 e1071_1.7-9                
#> [165] future.apply_1.9.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.