Skip to contents

Converting the nested list to a table is a more costly operation, it takes a few seconds. Best to do it only once, or pass tables = TRUE to obo_parser, and convert the data frame to list, if you also need it in list format.

Usage

relations_list_to_table(relations, direction = NULL)

Arguments

relations

A nested list of ontology relations (the "relations" element of the list returned by obo_parser in case its argument `tables` is FALSE).

direction

Override the direction (i.e. child -> parents or parent -> children). The nested lists produced by functions in the current package add an attribute "direction" thus no need to pass this value. If the attribute and the argument are both missing, the column will be named simply "side2" and it won't be clear whether the relations point from "term" to "side2" or the other way around. The direction should be a character vector of length 2 with the values "parents" and "children".

Value

The relations converted to a data frame (tibble).

Examples

goslim_url <-
    "http://current.geneontology.org/ontology/subsets/goslim_generic.obo"
path <- tempfile()
httr::GET(goslim_url, httr::write_disk(path, overwrite = TRUE))
#> Response [http://current.geneontology.org/ontology/subsets/goslim_generic.obo]
#>   Date: 2024-04-07 15:00
#>   Status: 200
#>   Content-Type: text/obo
#>   Size: 115 kB
#> <ON DISK>  /tmp/RtmpgsvP1J/file165a603a57763c
obo <- obo_parser(path, tables = FALSE)
unlink(path)
rel_tbl <- relations_list_to_table(obo$relations)