Skip to content

Commit

Permalink
Moved {networkD3} to Suggests
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidasilvaf committed Oct 8, 2024
1 parent 2b17e15 commit bcffc9a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ jobs:

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-results
path: check
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ biocViews: Software,
Network
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Imports:
Rcpp (>= 1.0.8),
BiocParallel,
Expand All @@ -65,8 +65,7 @@ Imports:
pheatmap,
ggplot2,
ggnetwork,
intergraph,
networkD3
intergraph
Suggests:
BiocStyle,
ggtree,
Expand All @@ -75,7 +74,8 @@ Suggests:
knitr,
rmarkdown,
testthat (>= 3.0.0),
xml2
xml2,
networkD3
Config/testthat/edition: 3
VignetteBuilder: knitr
LinkingTo:
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ importFrom(igraph,cluster_infomap)
importFrom(igraph,graph_from_data_frame)
importFrom(igraph,simplify)
importFrom(methods,is)
importFrom(networkD3,forceNetwork)
importFrom(networkD3,igraph_to_networkD3)
importFrom(pheatmap,pheatmap)
importFrom(rlang,.data)
importFrom(rtracklayer,import)
Expand Down
8 changes: 7 additions & 1 deletion R/06_dataviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ plot_profiles <- function(
#' @return A ggplot object with the network.
#'
#' @importFrom ggnetwork ggnetwork theme_blank geom_edges geom_nodes
#' @importFrom networkD3 igraph_to_networkD3 forceNetwork
#' @importFrom igraph graph_from_data_frame
#' @importFrom ggplot2 aes ggplot scale_color_manual guides
#' @importFrom grDevices colorRampPalette
Expand Down Expand Up @@ -241,6 +240,12 @@ plot_network <- function(network = NULL, clusters = NULL,
palette <- colorRampPalette(custom_palette(1))(nlevels(genes$Group))
}
if(interactive) {
if(!requireNamespace("networkD3", quietly = TRUE)) {
stop(
"Package 'networkD3' is required for interactive visualizations.\n",
"You can install it with `BiocManager::install('networkD3')`."
)
}
graph_d3 <- networkD3::igraph_to_networkD3(graph, group = genes)
d <- dim_interactive
p <- networkD3::forceNetwork(
Expand All @@ -250,6 +255,7 @@ plot_network <- function(network = NULL, clusters = NULL,
height = d[2], width = d[1], Nodesize = 'Degree',
opacity=0.8, zoom = TRUE, fontSize = 12
)

} else {
n <- ggnetwork::ggnetwork(graph, arrow.gap = 0)
# Plot graph
Expand Down

0 comments on commit bcffc9a

Please sign in to comment.