Add per-term metadata to ontology.

add_ontology_metadata(
  ont,
  lvl = 2,
  force_new = FALSE,
  add_n_edges = TRUE,
  add_ontology_levels = TRUE
)

Arguments

ont

An ontology of class ontology_DAG.

lvl

Depth of the ancestor terms to add. Will get the closest ancestor to this level if none have this exact level.

force_new

Add the data again even if the associated column already exists.

add_n_edges

Add the number of edges (connections) for each term.

add_ontology_levels

Add the ontology level for each term.

Examples

ont <- get_ontology("hp", terms=10)
#> Loading cached ontology: /github/home/.cache/R/KGExplorer/hp.rds
#> Randomly sampling 10 term(s).
ont2 <- add_ontology_metadata(ont)
#> Adding term metadata.
#> IC_method: IC_offspring
#> Adding ancestor metadata.
#> Ancestor metadata already present. Use force_new=TRUE to overwrite.
#> Translating ontology terms to ids.
#> Converted ontology to: adjacency 
#> Getting absolute ontology level for 91 IDs.