walk_ontology_tree {OmnipathR} | R Documentation |
Starting from the selected nodes, recursively walks the ontology tree until it reaches either the root or leaf nodes. Collects all visited nodes.
walk_ontology_tree( terms, ancestors = TRUE, db_key = "go_basic", ids = TRUE, method = "gra", relations = c("is_a", "part_of", "occurs_in", "regulates", "positively_regulates", "negatively_regulates") )
terms |
Character vector of ontology term IDs or names. A mixture of IDs and names can be provided. |
ancestors |
Logical: if |
db_key |
Character: key to identify the ontology database. For the
available keys see |
ids |
Logical: whether to return IDs or term names. |
method |
Character: either "gra" or "lst". The implementation to use for traversing the ontology tree. The graph based implementation is faster than the list based, the latter will be removed in the future. |
relations |
Character vector of ontology relation types. Only these relations will be used. |
Note: this function relies on the database manager, the first call might
take long because of the database load process. Subsequent calls within
a short period should be faster. See get_ontology_db
.
Character vector of ontology IDs. If the input terms are all
leaves or roots NULL
is returned. The starting nodes won't
be included in the result unless they fall onto the traversal path
from other nodes.
walk_ontology_tree(c('GO:0006241', 'GO:0044211')) # [1] "GO:0006139" "GO:0006220" "GO:0006221" "GO:0006241" "GO:0006725" # [6] "GO:0006753" "GO:0006793" "GO:0006796" "GO:0006807" "GO:0008150" # ... (truncated) walk_ontology_tree(c('GO:0006241', 'GO:0044211'), ancestors = FALSE) # [1] "GO:0044210" "GO:0044211" walk_ontology_tree( c('GO:0006241', 'GO:0044211'), ancestors = FALSE, ids = FALSE ) # [1] "'de novo' CTP biosynthetic process" "CTP salvage"