Parent/child/ancestor/offspring terms
dag_parents(dag, term, in_labels = TRUE)
dag_children(dag, term, in_labels = TRUE)
dag_siblings(dag, term, in_labels = TRUE)
dag_ancestors(dag, term, in_labels = TRUE, include_self = FALSE)
dag_offspring(dag, term, in_labels = TRUE, include_self = FALSE)
An ontology_DAG
object.
The value can be a vector of multiple term names. If it is a vector, it returns
union of the upstream/downstream terms of the selected set of terms. For dag_siblings()
,
the value can only be a single term.
Whether the terms are represented in their names or as integer indices?
For dag_offspring()
and dag_ancestors()
, this controls whether to also include the query term itself.
An integer vector or a character vector depending on the value of in_labels
.
parents = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
dag = create_ontology_DAG(parents, children)
dag_parents(dag, "b")
#> [1] "a"
dag_parents(dag, "c", in_labels = FALSE)
#> [1] 1 2
dag_children(dag, "b")
#> [1] "c" "d"
dag_siblings(dag, "c")
#> [1] "b" "d"
dag_ancestors(dag, "e")
#> [1] "a" "b" "c"
dag_ancestors(dag, "b")
#> [1] "a"