Output and renderer functions for using tidycwl within Shiny apps and interactive R Markdown documents.
cwl_output(outputId, width = "100%", height = "600px")
render_cwl(expr, env = parent.frame(), quoted = FALSE)
output variable to read from
Must be a valid CSS unit (like "100%"
,
"600px"
, "auto"
) or a number, which will be coerced to
a string and have "px"
appended.
An expression that generates a CWL graph
The environment in which to evaluate expr
.
Is expr
a quoted expression (with quote()
)?
This is useful if you want to save an expression in a variable.
An output or render function that enables the use of the widget within Shiny apps.
if (interactive()) {
library("shiny")
library("tidycwl")
cwl_folder <- system.file("cwl/sbg/workflow/", package = "tidycwl")
file_all <- list.files(cwl_folder)
cwl_name <- file_all[which(tools::file_ext(file_all) == "json")]
ui <- fluidPage(
selectInput("cwl_file", "Select a CWL file:", cwl_name),
cwl_output("cwl_plot", height = "800px")
)
server <- function(input, output, session) {
output$cwl_plot <- render_cwl({
flow <- paste0(cwl_folder, input$cwl_file) %>% read_cwl_json()
get_graph(
flow %>% parse_inputs(),
flow %>% parse_outputs(),
flow %>% parse_steps()
) %>% visualize_graph()
})
}
shinyApp(ui, server)
}