An `ontology_index` can contain multiple relations (for example in the case of the Gene Ontology, "is_a"
and "part_of"
could be stored as separate properties in an `ontology_index`). Transitive relations (i.e. relations such that x related to y and y related to z implies x related to z, for example the relation 'is an ancestor of') stored by an `ontology_index` can be propagated using this function. The 'inverse relations' (i.e. x inversely related to y if y related to x) can also be propagated by setting the use_inverse_relations
parameter to TRUE
.
propagate_relations(
ontology,
roots,
relations,
use_inverse_relations = FALSE,
exclude_roots = FALSE
)
Character vector of terms
ontology_index
object.
Character vector of term IDs from which relations will be propagated.
Character vector given names of transitive relations to be propagated.
Boolean vector indicating whether to propagate inverse relations. If use_inverse_relations
is the same length as relations
, each element determines whether the corresponding relation in relations
is inverted.
Boolean determining whether to remove the given roots
terms from the result.
get_ancestors
, get_descendants