Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions R/exportNetworkToHTML.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
#' Export network data with Cytoscape visualization
```r
#' Export Network to HTML with Cytoscape Visualization
#'
#' Convenience function that takes nodes and edges data directly and creates
#' both the configuration and HTML export in one step.
#' @description
#' This function exports network data to an HTML file using Cytoscape for visualization.
#' It combines the configuration and HTML export into a single step, making it easy to
#' visualize networks directly from node and edge data.
#'
#' @param nodes \code{data.frame} containing the nodes of the network. Must include an \code{id} column.
#' @param edges \code{data.frame} containing the edges of the network. Must include \code{source} and \code{target} columns.
#' @param filename \code{character} string specifying the output HTML filename. Defaults to \code{"network_visualization.html"}.
#' @param displayLabelType \code{character} string specifying the type of label to display on nodes. Defaults to \code{"id"}.
#' @param nodeFontSize \code{numeric} value indicating the font size of node labels. Defaults to \code{12}.
#' @param ... Additional arguments passed to \code{exportCytoscapeToHTML()}.
#'
#' @return Invisibly returns the file path of the created HTML file.
#'
#' @examples
#' \dontrun{
#' nodes <- data.frame(id = c("A", "B", "C"))
#' edges <- data.frame(source = c("A", "B"), target = c("B", "C"))
#' exportNetworkToHTML(nodes, edges, filename = "my_network.html")
#' }
#'
#' @inheritParams cytoscapeNetwork
#' @param filename Output HTML filename
#' @param ... Additional arguments passed to exportCytoscapeToHTML()
#' @export
#' @return Invisibly returns the file path of the created HTML file
exportNetworkToHTML <- function(nodes, edges,
filename = "network_visualization.html",
displayLabelType = "id",
Expand Down Expand Up @@ -65,4 +80,5 @@ previewNetworkInBrowser <- function(nodes, edges,
}

invisible(temp_file)
}
}
```