swap_relations: Reverse the direction of ontology relations

swap_relationsR Documentation

Reverse the direction of ontology relations

Description

Reverse the direction of ontology relations

Usage

swap_relations(relations)

Arguments

relations

The 'relations' component of the data returned by obo_parser or any '...ontology_download' function such as go_ontology_download. Depending on the tables argument of those functions the 'relations' can be a data frame or a nested list.

Value

Same type as the input, but the relations swapped: if in the input these pointed from each child to the parents, in the output they point from each parent to their children, and vice versa.

See Also

  • relations_list_to_table

  • relations_table_to_list

  • obo_parser

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)
unlink(path)
rel_swapped <- swap_relations(obo$relations)


saezlab/OmnipathR documentation built on May 3, 2024, 5:32 a.m.