Reorder the DAG

dag_reorder(dag, value, verbose = simona_opt$verbose)

dag_permutate_children(dag, verbose = simona_opt$verbose)

Arguments

dag

An ontology_Dag object.

value

A vector of numeric values. See the Details section.

verbose

Whether to print messages.

Value

An ontology_DAG object.

Details

In dag_reorder(), there are two ways to set the value argument. It can be a vector corresponding to all terms (in the same order as in dag_all_terms()) or a vector corresponding to all leaf terms (in the same order as in dag_leaves()). If value corresponds to all terms, the score associates to each term is the average value of all its offspring terms. And if value corresponds to all leaf terms, the score for each term is the average of all its connectable leaves.

The reordering is simply applied on each term to reorder its child terms.

dag_permutate_children() randomly permute child terms under a term.

Examples

parents  = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
# by default, c and e locate on the left side, d and f locate on the right side
dag = create_ontology_DAG(parents, children)
dag_children(dag, "b")
#> [1] "c" "d"

# move c and e to the right side of the diagram
dag2 = dag_reorder(dag, value = c(1, 1, 10, 1, 10, 1))
#> 
#> going through 0 / 6 terms ...
#> 
#> going through 6 / 6 terms ... Done.
dag_children(dag2, "b")
#> [1] "d" "c"

# we can also only set values for leaf terms
# there are two leaf terms c and e
# we let v(c) > v(e) to move c to the right side of the diagram
dag3 = dag_reorder(dag, value = c(10, 1))
#> 
#> going through 0 / 6 terms ...
#> 
#> going through 6 / 6 terms ... Done.
dag_children(dag3, "b")
#> [1] "d" "c"