obo_parser: Generic OBO parser

View source: R/obo.R

obo_parserR Documentation

Generic OBO parser

Description

Reads the contents of an OBO file and processes it into data frames or a list based data structure.

Usage

obo_parser(
  path,
  relations = c("is_a", "part_of", "occurs_in", "regulates", "positively_regulates",
    "negatively_regulates"),
  shorten_namespace = TRUE,
  tables = TRUE
)

Arguments

path

Path to the OBO file.

relations

Character vector: process only these relations.

shorten_namespace

Logical: shorten the namespace to a single letter code (as usual for Gene Ontology, e.g. cellular_component = "C").

tables

Logical: return data frames (tibbles) instead of nested lists.

Value

A list with the following elements: 1) "names" a list with terms as names and names as values; 2) "namespaces" a list with terms as names and namespaces as values; 3) "relations" a list with relations between terms: terms are keys, values are lists with relations as names and character vectors of related terms as values; 4) "subsets" a list with terms as keys and character vectors of subset names as values (or NULL if the term does not belong to any subset); 5) "obsolete" character vector with all the terms labeled as obsolete. If the tables parameter is TRUE, "names", "namespaces", "relations" and "subsets" will be data frames (tibbles).

See Also

  • relations_list_to_table

  • relations_table_to_list

  • swap_relations

Examples

goslim_url <-
    "http://current.geneontology.org/ontology/subsets/goslim_generic.obo"
path <- tempfile()
httr::GET(goslim_url, httr::write_disk(path, overwrite = TRUE))
obo <- obo_parser(path, tables = FALSE)
unlink(path)
names(obo)
# [1] "names"      "namespaces" "relations"  "subsets"    "obsolete"
head(obo$relations, n = 2)
# $`GO:0000001`
# $`GO:0000001`$is_a
# [1] "GO:0048308" "GO:0048311"
#
# $`GO:0000002`
# $`GO:0000002`$is_a
# [1] "GO:0007005"


saezlab/OmnipathR documentation built on Nov. 10, 2024, 11:02 p.m.