Shiny bindings for geneviewer
Output and render functions for using geneviewer within Shiny applications and interactive Rmd documents.
Usage
r
GC_chartOutput(outputId, width = "100%", height = "400px")
renderGC_chart(expr, env = parent.frame(), quoted = FALSE)Arguments
| Argument | Description |
|---|---|
outputId | Output variable to read from. |
width | Width of the output widget, must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended. |
height | Height of the output widget, must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended. |
expr | An expression that generates a GC chart. |
env | The environment in which to evaluate expr. |
quoted | Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable. |
Value
GC_chart widget that can be placed in the UI.
Details
In Shiny, a fixed pixel width set by GC_chart() (or GC_grid()) takes precedence over the output width. Put the output in a container with overflow-x: auto to scroll a chart wider than the available space. Responsive charts keep the width set by GC_chartOutput(), including when switching back from a fixed width. Standalone widgets keep their usual htmlwidgets sizing. Height behavior is unchanged.
See also
Examples
r
if (interactive()) {
library(shiny)
library(geneviewer)
ui <- fluidPage(
titlePanel("Omphalotin Gene Cluster Visualization"),
mainPanel(
GC_chartOutput("gcChart", width = "100%", height = "500px")
)
)
server <- function(input, output) {
output$gcChart <- renderGC_chart({
GC_chart(
ophA_clusters, # Ensure 'ophA_clusters' data is defined or available
cluster = "cluster",
group = "class"
) %>%
GC_title(title = c("<i>O. olearius</i>", "<i>D. bispora</i>")) %>%
GC_labels("name") %>%
GC_legend(position = "bottom") %>%
GC_scaleBar() %>%
GC_clusterLabel(title = "ophA")
})
}
shinyApp(ui = ui, server = server)
}