Table from a nested list of ontology relationsSource:
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.
A nested list of ontology relations (the "relations" element of the list returned by
obo_parserin case its argument `tables` is
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".
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: 2023-03-22 17:53 #> Status: 200 #> Content-Type: text/obo #> Size: 113 kB #> <ON DISK> /tmp/Rtmpp8VEpU/file300770aa56b7 obo <- obo_parser(path, tables = FALSE) unlink(path) rel_tbl <- relations_list_to_table(obo$relations)