Convert an igraph to data for a 3D plotly plot.
graph_to_plotly(
g,
ont = get_ontology("hpo"),
layout_func = igraph::layout.fruchterman.reingold,
dim = 3,
id_col = "name",
label_var = "hpo_name",
seed = 2023
)
ggnetwork object (or an igraph/tbl_graph to be converted to ggnetwork format).
An ontology of class ontology_DAG.
Layout function for the graph.
Number of dimensions to create layout in.
Column containing the unique identifier for each node in a graph (e.g. "name").
Column containing the label for each node in a graph (e.g. "hpo_name").
Set the seed for reproducible clustering.
Named list of data.frames.
ont <- get_ontology("hp", terms=10)
#> Loading cached ontology: /github/home/.cache/R/KGExplorer/hp.rds
#> Randomly sampling 10 term(s).
g <- ontology_to(ont, to="tbl_graph")
#> Translating ontology terms to ids.
#> Converted ontology to: tbl_graph
p <- graph_to_plotly(g)
#> Converting igraph to plotly data.
#> Translating ontology terms to names.
#> ⠙ Iterating 9 done (4.2/s) | 2.2s
#> ⠙ Iterating 14 done (4.6/s) | 3s
#> Importing cached file: /github/home/.cache/R/KGExplorer/hp.obo
#> Adding term metadata.
#> IC_method: IC_offspring
#> Adding ancestor metadata.
#> Getting absolute ontology level for 19,025 IDs.
#> 79 ancestors found at level 2
#> Translating ontology terms to names.
#> Translating ontology terms to ids.
#> Converted ontology to: adjacency
#> Getting absolute ontology level for 19,025 IDs.
#> Saving ontology --> /github/home/.cache/R/KGExplorer/hpo.rds