Output and render functions for using JBrowseR within Shiny applications and interactive Rmd documents.
JBrowseROutput(outputId, width = "100%", height = "400px")
renderJBrowseR(expr, env = parent.frame(), quoted = FALSE)output variable to read from
Must be a valid CSS unit or a number, which will be coerced to a string and have 'px' appended.
Must be a valid CSS unit or a number, which will be coerced to a string and have 'px' appended.
An expression that generates a JBrowseR
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.
the Shiny UI bindings for a JBrowseR htmlwidget
the Shiny server bindings for a JBrowseR htmlwidget
Clicking a feature sets input[[paste0(outputId, "_selected_feature")]],
which is namespaced per output and so is safe with several browsers on a
page or inside a Shiny module. It also sets the global input$selectedFeature
for backwards compatibility; prefer the per-output id in new apps.
Panning or zooming sets input[[paste0(outputId, "_location")]] to the
visible region, so the server can recompute for what the user is looking at.
It settles after the gesture rather than firing per frame, and there is no
global twin — use the namespaced id:
output$browser <- renderJBrowseR(JBrowseR("hg38", location = "BRCA1"))
output$region <- renderText(input$browser_location)The value is the same string the location box displays, which means it is
formatted for reading rather than for parsing: coordinates carry thousand
separators ("17:43,044,295..43,125,483"), and a view showing several
regions gives them space-separated. Strip the commas before doing arithmetic
with it — as.numeric(gsub(",", "", x)). It feeds straight back into
location = unchanged, though (JBrowse parses what it prints).
Note that reading it in a reactive that also feeds renderJBrowseR() builds
a loop: the widget rebuilds on every change, and a rebuild resets the view.
Read it to drive other outputs.