Number of parent/child/ancestor/offspring/leaf terms
n_offspring(dag, terms = NULL, use_cache = TRUE, include_self = FALSE)
n_ancestors(dag, terms = NULL, use_cache = TRUE, include_self = FALSE)
n_connected_leaves(dag, terms = NULL, use_cache = TRUE)
n_parents(dag, terms = NULL)
n_children(dag, terms = NULL)
avg_parents(dag)
avg_children(dag)
An ontology_DAG
object.
A vector of term names. If the value is NULL
, it returns for all terms in the DAG.
Internally used.
For n_offspring()
and n_ancestors()
, this controls whether to also include the query term itself.
An integer vector.
For n_connected_leaves()
, leaf nodes have value of 1.
In avg_parents()
, root term is removed.
In avg_children()
, leaf term is removed.
parents = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
dag = create_ontology_DAG(parents, children)
n_parents(dag)
#> a b c d e f
#> 0 1 2 1 1 1
n_children(dag)
#> a b c d e f
#> 2 2 1 1 0 0
n_offspring(dag)
#> a b c d e f
#> 5 4 1 1 0 0
n_ancestors(dag)
#> a b c d e f
#> 0 1 2 2 3 3
n_connected_leaves(dag)
#> a b c d e f
#> 2 2 1 1 1 1