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, ...)

Arguments

x

An ontology_DAG object.

i

A single term name. The value should be a character vector. It corresponds to the roots.

j

A single term name. The value should be a character vector. It corresponds to the leaves.

...

Ignored.

drop

Ignored.

Value

An ontology_DAG object.

Details

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.

Examples

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