From dc6c5ec46d7a5cb9075d8c217d76b3bc166285ad Mon Sep 17 00:00:00 2001 From: "Brian M. Schilder" <34280215+bschilder@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:58:30 +0000 Subject: [PATCH] Fix get_ontology. add plot_graph_visnetwork opt for arrows --- R/get_ontology.R | 9 ++++++--- R/plot_graph_visnetwork.R | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/R/get_ontology.R b/R/get_ontology.R index 4f434a9..dee016b 100644 --- a/R/get_ontology.R +++ b/R/get_ontology.R @@ -52,6 +52,9 @@ get_ontology <- function(name=c("mondo", if(isFALSE(force_new) && file.exists(save_path)){ messager("Loading cached ontology:",save_path) ont <- readRDS(save_path) + #### Subset ontology #### + ont <- filter_ontology(ont = ont, + terms = terms) return(ont) } ol <- rols::Ontologies() @@ -115,15 +118,15 @@ get_ontology <- function(name=c("mondo", add_ancestors=add_ancestors, add_ontology_levels=add_ontology_levels) } - #### Subset ontology #### - ont <- filter_ontology(ont = ont, - terms = terms) #### Cache RDS object #### if(!is.null(save_dir)){ dir.create(save_dir, recursive=TRUE, showWarnings = FALSE) messager("Saving ontology -->",save_path) saveRDS(ont, save_path) } + #### Subset ontology #### + ont <- filter_ontology(ont = ont, + terms = terms) #### Return #### return(ont) } \ No newline at end of file diff --git a/R/plot_graph_visnetwork.R b/R/plot_graph_visnetwork.R index c917940..1b6a55f 100644 --- a/R/plot_graph_visnetwork.R +++ b/R/plot_graph_visnetwork.R @@ -30,6 +30,7 @@ plot_graph_visnetwork <- function(g, avoidOverlap = 0.5, gravitationalConstant = -50), scaling = NULL, + arrows = "from", smooth = list(enabled = TRUE, type = "cubicBezier", roundness = 0.5), @@ -111,6 +112,7 @@ plot_graph_visnetwork <- function(g, ) |> visNetwork::visEdges(shadow = list(enabled=FALSE), smooth = smooth, + arrows = arrows, color = list(opacity = 0.5)) |> # visNetwork::visLegend() |> # visNetwork::visClusteringByConnection(nodes = unique(top_targets[[group_var]])) |>