Output and render functions for using JBrowseRApp() within Shiny applications and interactive Rmd documents. These are separate from JBrowseROutput() because the app is a separate widget with its own JavaScript bundle: htmlwidgets dispatches on the output element's class, so rendering a JBrowseRApp() into a JBrowseROutput() loads the single-view bundle and fails to build.

JBrowseRAppOutput(outputId, width = "100%", height = "400px")

renderJBrowseRApp(expr, env = parent.frame(), quoted = FALSE)

Arguments

outputId

output variable to read from

width

Must be a valid CSS unit or a number, which will be coerced to a string and have 'px' appended.

height

Must be a valid CSS unit or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a JBrowseRApp

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

the Shiny UI bindings for a JBrowseRApp htmlwidget

the Shiny server bindings for a JBrowseRApp htmlwidget

Details

Whatever the user does to the layout — navigating, opening tracks, adding or rearranging views — is reported as input[[paste0(outputId, "_session")]], in the same shape session = takes. So "save this layout" is storing that value, and reopening it is passing it back:

output$app <- renderJBrowseRApp(JBrowseRApp(assemblies, views = saved()))
observeEvent(input$save, { saved(input$app_session) })

It rides a coarse signal — which views exist, what each has open, and where each is looking — so it settles after a gesture instead of firing per frame. As with _location, reading it in the reactive that feeds renderJBrowseRApp() builds a loop: store it on an event, don't wire it straight through.