For a given list of terms, it returns a subset of terms which have no ancestor relations to each other.

dag_distinct_ancestors(
  dag,
  terms,
  in_labels = TRUE,
  verbose = simona_opt$verbose
)

Arguments

dag

An ontology_DAG object.

terms

A vector of term names.

in_labels

Whether the terms are represented in their names or as integer indices?

verbose

Whether to print messages.

Consider a subgraph that contains terms and their offspring terms, induced from the complete DAG. the returned subset of terms are those with zero in-degree, or have no finite directional distance from others in the subgraph.

Value

An integer vector or a character vector depending on the value of in_labels.

Examples

parents  = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
dag = create_ontology_DAG(parents, children)
dag_distinct_ancestors(dag, c("c", "d", "e", "f"))
#> collecting all ancestors of input terms ...
#> 
#> going through 0 / 4 nodes ...
#> 
#> going through 4 / 4 nodes ... Done.
#> [1] "c" "d"