diff --git a/R/cytoscapeNetwork.R b/R/cytoscapeNetwork.R index 149ca72..095f957 100644 --- a/R/cytoscapeNetwork.R +++ b/R/cytoscapeNetwork.R @@ -1,3 +1,4 @@ +```r # R/cytoscapeNetwork.R # # htmlwidgets binding for the Cytoscape network visualisation. @@ -490,8 +491,44 @@ cytoscapeNetworkOutput <- function(outputId, ) } -#' Shiny render binding for cytoscapeNetwork -#' @inheritParams htmlwidgets::shinyRenderWidget +#' Render a Cytoscape network in a Shiny application +#' +#' This function is used to render a Cytoscape network visualization within a Shiny application. +#' +#' @param expr \code{expression} that generates a Cytoscape network widget. +#' @param env \code{environment} in which to evaluate \code{expr}. Defaults to \code{parent.frame()}. +#' @param quoted \code{logical}, is \code{expr} a quoted expression (with \code{quote()})? Default is \code{FALSE}. +#' +#' @return A rendered Cytoscape network widget for use in Shiny applications. +#' +#' @examples +#' \dontrun{ +#' library(shiny) +#' library(MSstatsBioNet) +#' +#' ui <- fluidPage( +#' cytoscapeNetworkOutput("cytoNetwork") +#' ) +#' +#' server <- function(input, output, session) { +#' output$cytoNetwork <- renderCytoscapeNetwork({ +#' nodes <- data.frame( +#' id = c("TP53", "MDM2", "CDKN1A"), +#' logFC = c(1.5, -0.8, 2.1), +#' stringsAsFactors = FALSE +#' ) +#' edges <- data.frame( +#' source = c("TP53", "MDM2"), +#' target = c("MDM2", "TP53"), +#' interaction = c("Activation", "Inhibition"), +#' stringsAsFactors = FALSE +#' ) +#' cytoscapeNetwork(nodes, edges) +#' }) +#' } +#' +#' shinyApp(ui, server) +#' } #' @export renderCytoscapeNetwork <- function(expr, env = parent.frame(), quoted = FALSE) { if (!quoted) expr <- substitute(expr) @@ -502,3 +539,4 @@ renderCytoscapeNetwork <- function(expr, env = parent.frame(), quoted = FALSE) { quoted = TRUE ) } +``` \ No newline at end of file