Create sub-DAGs
# S4 method for ontology_DAG,ANY,ANY,missing
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,ANY,ANY,ANY
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,ANY,missing,missing
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,ANY,missing,ANY
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,missing,ANY,missing
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,missing,ANY,ANY
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,missing,missing,missing
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,missing,missing,ANY
[(x, i, j, ..., drop = FALSE)
# S4 method for ontology_DAG,character,missing
[[(x, i, j, ...)
An ontology_DAG
object.
A single term name. The value should be a character vector. It corresponds to the roots.
A single term name. The value should be a character vector. It corresponds to the leaves.
Ignored.
Ignored.
An ontology_DAG
object.
It returns a sub-DAG taking node i
as the root and j
as the leaves. If i
is a vector, a super root will be added.
parents = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
dag = create_ontology_DAG(parents, children)
dag["b"]
#> An ontology_DAG object:
#> Source: Ontology
#> 5 terms / 4 relations / a tree
#> Root: b
#> Terms: b, c, d, e, ...
#> Max depth: 2
#> Aspect ratio: 1:1
dag[["b"]]
#> An ontology_DAG object:
#> Source: Ontology
#> 5 terms / 4 relations / a tree
#> Root: b
#> Terms: b, c, d, e, ...
#> Max depth: 2
#> Aspect ratio: 1:1
dag["b", "f"]
#> An ontology_DAG object:
#> Source: Ontology
#> 3 terms / 2 relations / a tree
#> Root: b
#> Terms: b, d, f, ...
#> Max depth: 2
#> Aspect ratio: 0.51:1
dag[, "f"]
#> An ontology_DAG object:
#> Source: Ontology
#> 4 terms / 3 relations / a tree
#> Root: a
#> Terms: a, b, d, f, ...
#> Max depth: 3
#> Aspect ratio: 0.34:1