Package 'fobitools'

Title: Tools for Manipulating the FOBI Ontology
Description: A set of tools for interacting with the Food-Biomarker Ontology (FOBI). A collection of basic manipulation tools for biological significance analysis, graphs, and text mining strategies for annotating nutritional data.
Authors: Pol Castellano-Escuder [aut, cre] , Alex Sánchez-Pla [aut]
Maintainer: Pol Castellano-Escuder <[email protected]>
License: GPL-3
Version: 1.15.1
Built: 2024-11-28 03:11:52 UTC
Source: https://github.com/bioc/fobitools

Help Index


Text Mining Pipeline to Annotate Free Nutritional Text with FOBI

Description

This function provides a text mining pipeline to map nutritional free text to Food-Biomarker Ontology. This pipeline is composed of five sequential layers to map food items to FOBI with the maximum accuracy as possible.

Usage

annotate_foods(foods, similarity = 0.85, reference = fobitools::foods)

Arguments

foods

A two column data frame. First column must contain the ID (should be unique) and the second column must contain food items (it can be a word or a string).

similarity

Numeric between 0 (low) and 1 (high). This value indicates the semantic similarity cutoff used at the last layer of the text mining pipeline. 1 = exact match; 0 = very poor match. Values below 0.85 are not recommended.

reference

FOBI foods table obtained with 'parse_fobi(terms = "FOBI:0001", get = "des")'. If this value is set to NULL, the last version of FOBI will be downloaded from GitHub.

Value

A list containing two tibble objects: annotated and unannotated food items.

Author(s)

Pol Castellano-Escuder

References

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

# Free text annotation in FOBI
free_text <- data.frame(id = c(101, 102, 103, 104),
                        text = c("Yesterday I ate eggs and bacon with a butter toast and black tea", 
                                 "Crisp bread and rice crackers with wholegrain", 
                                 "Beef and veal, one apple", "pizza without meat"))
annotate_foods(free_text)

FOBI Table File - Jul 23, 2021

Description

FOBI table obtained with 'parse_fobi()'

Usage

fobi

Format

A tibble: 4069 FOBI entities with their associated information.

id_code

FOBI entity ID.

name

FOBI entity name.

is_a_code

FOBI entity direct parent class ID.

is_a_name

FOBI entity direct parent class name.

id_BiomarkerOf

FOBI entity associated food ID (in terms of biomarker).

BiomarkerOf

FOBI entity associated food name (in terms of biomarker).

ChemSpider

ChemSpider ID.

KEGG

KEGG ID.

PubChemCID

PubChemCID ID.

InChIKey

InChIKey ID.

InChICode

InChICode ID.

FOBI

FOBI ID.

alias

FOBI entity alias name.

HMDB

HMDB ID.

id_Contains

FOBI entity associated food ID (in terms of a recipe).

Contains

FOBI entity associated food ID (in terms of a recipe).

Source

https://github.com/pcastellanoescuder/FoodBiomarkerOntology


Generate FOBI Graphs

Description

This function allows users to create networks based on FOBI relationships.

Usage

fobi_graph(
  terms = NULL,
  get = NULL,
  property = c("is_a", "BiomarkerOf", "Contains"),
  layout = "sugiyama",
  labels = FALSE,
  labelsize = 3,
  legend = FALSE,
  legendSize = 10,
  legendPos = "bottom",
  curved = FALSE,
  pointSize = 3,
  fobi = fobitools::fobi
)

Arguments

terms

A character vector with FOBI term IDs.

get

A character string indicating desired relationships between provided terms. Options are 'anc' (for ancestors) and 'des' (for descendants). Default is NULL and all information related with input terms will be provided.

property

A character vector indicating which properties should be plotted. Options are 'is_a', 'BiomarkerOf', and 'Contains'. By default all of them are included.

layout

A character string indicating the type of layout to create. Options are 'sugiyama' (default) and 'lgl'.

labels

Logical indicating if node names should be plotted or not.

labelsize

Numeric value indicating the size of labels.

legend

Logical indicating if legend should be plotted or not.

legendSize

Numeric value indicating the size of legend.

legendPos

A character string indicating the legend position (if legend parameter is set to TRUE). Options are 'bottom' (default) and 'top'.

curved

Logical indicating if the shape of the edges shape should be curved or not.

pointSize

Numeric value indicating the size of graph points.

fobi

FOBI table obtained with 'parse_fobi()'. If this value is set to NULL, the last version of FOBI will be downloaded from GitHub.

Value

A ggraph object.

Author(s)

Pol Castellano-Escuder

References

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

terms <- c("CHEBI:16164","CHEBI:16243","FOODON:00001139","FOODON:00003274","FOODON:00003275")
fobi_graph(terms, get = "anc")

# Red meat related FOBI biomarkers
fobi_graph(terms = "FOBI:0193", 
           property = c("is_a", "BiomarkerOf"), 
           layout = "lgl", curved = TRUE) # set labels = TRUE to display node names

FOBI's 'ontology_index' object - Jul 23, 2021

Description

FOBI terms obtained with 'ontologyIndex::get_ontology()'

Usage

fobi_terms

Format

An ontology_index object with 1201 terms.

format-version:

1.2

data-version:

fobi.owl

ontology

fobi

Properties

id: character, name: character, parents: list, children: list, ancestors: list, obsolete: logical

Roots

FOBI:0001 - Foods, FOBI:01501 - Biomarkers, FOBI:00422 - BiomarkerOf, FOBI:00423 - HasBiomarker, FOBI:00424 - Contains, FOBI:00425 - IsIngredientOf

Source

https://github.com/pcastellanoescuder/FoodBiomarkerOntology


FOBI Foods Table File - Feb 02, 2021

Description

FOBI foods table obtained with 'parse_fobi(terms = "FOBI:0001", get = "des")'

Usage

foods

Format

A tibble: 568 FOBI food entities with their associated information.

id_code

FOBI entity ID.

name

FOBI entity name.

is_a_code

FOBI entity direct parent class ID.

is_a_name

FOBI entity direct parent class name.

id_BiomarkerOf

FOBI entity associated food ID (in terms of biomarker).

BiomarkerOf

FOBI entity associated food name (in terms of biomarker).

ChemSpider

ChemSpider ID.

KEGG

KEGG ID.

PubChemCID

PubChemCID ID.

InChIKey

InChIKey ID.

InChICode

InChICode ID.

FOBI

FOBI ID.

alias

FOBI entity alias name.

HMDB

HMDB ID.

id_Contains

FOBI entity associated food ID (in terms of a recipe).

Contains

FOBI entity associated food ID (in terms of a recipe).

Source

https://github.com/pcastellanoescuder/FoodBiomarkerOntology


Convert Metabolite Identifiers

Description

This function can convert metabolite identifiers to other available IDs in FOBI. Input vector can be a combination of different IDs.

Usage

id_convert(ids, to = "FOBI", fobi = fobitools::fobi)

Arguments

ids

A vector with metabolite IDs to convert. Input ID types can be FOBI, raw metabolite names (used in FOBI), HMDB, KEGG, PubChemCID, InChIKey, InChICode, ChemSpider, and a combination of them.

to

Target ID type. If possible, metabolites will be converted to this ID type. Options are "FOBI" (default), "metaboliteNames", "HMDB", "KEGG", "PubChemCID", "InChIKey", "InChICode", and "ChemSpider".

fobi

FOBI table obtained with 'parse_fobi()'. If this value is set to NULL, the last version of FOBI will be downloaded from GitHub.

Value

A tibble with input IDs and converted IDs.

Author(s)

Pol Castellano-Escuder

References

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

ids <- c(fobitools::idmap$HMDB[1:10], 
         fobitools::idmap$KEGG[11:23], 
         fobitools::idmap$InChIKey[100:150])
fobitools::id_convert(ids, to = "FOBI")

FOBI Identifier Map File - Jul 18, 2021

Description

Identifier mappings for FOBI metabolites

Usage

idmap

Format

A tibble: 590 FOBI metabolites with 8 different IDs.

metaboliteNames

Raw metabolite names.

FOBI

FOBI ID.

HMDB

HMDB ID.

KEGG

KEGG ID.

PubChemCID

PubChemCID ID.

InChIKey

InChIKey ID.

InChICode

InChICode ID.

ChemSpider

ChemSpider ID.

Source

https://github.com/pcastellanoescuder/FoodBiomarkerOntology


Performs a preranked metabolite set enrichment analysis (MSEA)

Description

This function performs a MSEA based on the adaptive multilevel splitting Monte Carlo approach.

Usage

msea(
  metaboliteRanks,
  subOntology = "food",
  pvalCutoff = 0.01,
  fobi = fobitools::fobi
)

Arguments

metaboliteRanks

A named vector of FOBI metabolite identifiers with their metabolite-level stats.

subOntology

A character string specifying one of the two FOBI sub-ontologies: "food", or "biomarker".

pvalCutoff

A numeric value indicating a p-value cutoff for raw p-values generated by MSEA.

fobi

FOBI table obtained with 'parse_fobi()'. If this value is set to NULL, the last version of FOBI will be downloaded from GitHub.

Value

A tibble with MSEA results.

Author(s)

Pol Castellano-Escuder

References

G. Korotkevich, V. Sukhov, A. Sergushichev. Fast gene set enrichment analysis. bioRxiv (2019), doi:10.1101/060012

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

metabolites <- c(fobitools::idmap$FOBI[1:49], fobitools::idmap$FOBI[70:80])
random_pvals <- c(runif(n = length(metabolites)*0.3, min = 0.001, max = 0.05), runif(n = length(metabolites)*0.7, min = 0.05, max = 0.99))
names(random_pvals) <- metabolites
metaboliteRanks <- random_pvals[order(random_pvals)]

# Food enrichment analysis
fobitools::msea(metaboliteRanks = metaboliteRanks, 
                pvalCutoff = 1)

# Chemical class enrichment analysis
fobitools::msea(metaboliteRanks = metaboliteRanks, 
                subOntology = "biomarker", 
                pvalCutoff = 1)

Classical Over Representation Analysis with FOBI

Description

This function performs a traditional over representation analysis based on hypergeometric test: classes are treated as sets of individual metabolites and all metabolites are treated as equally informative. This function uses Food-Biomarker Ontology knowledge as biological information.

Usage

ora(
  metaboliteList,
  metaboliteUniverse,
  subOntology = "food",
  pvalCutoff = 0.01,
  fobi = fobitools::fobi
)

Arguments

metaboliteList

A vector of FOBI metabolite identifiers that define the selected list of metabolites.

metaboliteUniverse

A vector of FOBI metabolite identifiers that define the universe of possible metabolites (all metabolites analyzed in the study).

subOntology

A character string specifying one of the two FOBI sub-ontologies: "food", or "biomarker".

pvalCutoff

A numeric value indicating a p-value cutoff for raw p-values generated by hypergeometric test.

fobi

FOBI table obtained with 'parse_fobi()'. If this value is set to NULL, the last version of FOBI will be downloaded from GitHub.

Value

A tibble with ORA results.

Author(s)

Pol Castellano-Escuder

References

G. Korotkevich, V. Sukhov, A. Sergushichev. Fast gene set enrichment analysis. bioRxiv (2019), doi:10.1101/060012

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

metaboliteUniverse <- c(fobitools::idmap$FOBI[1:200], fobitools::idmap$FOBI[400:450])
metaboliteList <- c(fobitools::idmap$FOBI[1:50], fobitools::idmap$FOBI[70:80])

# Food enrichment analysis
fobitools::ora(metaboliteList = metaboliteList, 
               metaboliteUniverse = metaboliteUniverse, 
               pvalCutoff = 1)

# Chemical class enrichment analysis
fobitools::ora(metaboliteList = metaboliteList, 
               metaboliteUniverse = metaboliteUniverse, 
               subOntology = "biomarker", 
               pvalCutoff = 1)

Parse FOBI in a Readable Tabular Format

Description

This function allows users to download and parse the last version of the Food-Biomarker Ontology into a readable table format.

Usage

parse_fobi(terms = NULL, get = NULL)

Arguments

terms

A character vector with FOBI term IDs. Default is NULL.

get

A character string indicating desired relationships between provided terms. Options are 'anc' (for ancestors) and 'des' (for descendants). Default is NULL and only information of single input terms will be provided.

Value

A tibble with FOBI terms information.

Author(s)

Pol Castellano-Escuder

References

Pol Castellano-Escuder, Raúl González-Domínguez, David S Wishart, Cristina Andrés-Lacueva, Alex Sánchez-Pla, FOBI: an ontology to represent food intake data and associate it with metabolomic data, Database, Volume 2020, 2020, baaa033, https://doi.org/10.1093/databa/baaa033.

Examples

# Download and parse whole FOBI
fobi <- parse_fobi()

# Download and parse 'apple' related terms
fobi_apple <- parse_fobi(terms = "FOODON:00002473")

# Download and parse 'apple' term ancestors
fobi_apple_anc <- parse_fobi(terms = "FOODON:00002473", get = "anc")

# Download and parse 'apple' and 'alpha-Chaconine' related terms
fobi_subset <- parse_fobi(terms = c("FOODON:00002473", "CHEBI:10219"))