Skip to content

Commit

Permalink
Fix get_ontology. add plot_graph_visnetwork opt for arrows
Browse files Browse the repository at this point in the history
  • Loading branch information
bschilder committed Mar 15, 2024
1 parent a8ccb98 commit dc6c5ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/get_ontology.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
2 changes: 2 additions & 0 deletions R/plot_graph_visnetwork.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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]])) |>
Expand Down

0 comments on commit dc6c5ec

Please sign in to comment.