diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index 16dc805..d831bfa 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -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 diff --git a/DESCRIPTION b/DESCRIPTION index 8d209fd..05dc2dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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, @@ -65,8 +65,7 @@ Imports: pheatmap, ggplot2, ggnetwork, - intergraph, - networkD3 + intergraph Suggests: BiocStyle, ggtree, @@ -75,7 +74,8 @@ Suggests: knitr, rmarkdown, testthat (>= 3.0.0), - xml2 + xml2, + networkD3 Config/testthat/edition: 3 VignetteBuilder: knitr LinkingTo: diff --git a/NAMESPACE b/NAMESPACE index 89f69b0..bf9d348 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) diff --git a/R/06_dataviz.R b/R/06_dataviz.R index 6213f54..b708c13 100644 --- a/R/06_dataviz.R +++ b/R/06_dataviz.R @@ -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 @@ -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( @@ -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