updateVisibility {NGLVieweR} | R Documentation |
Update visibility
Description
Hide or show an existing NGLVieweR selection in Shinymode.
Usage
updateVisibility(NGLVieweR_proxy, name, value = FALSE)
Arguments
NGLVieweR_proxy |
A NGLVieweR object. |
name |
Name of selection to alter the color. |
value |
Hide |
Value
API call containing NGLVieweR
id
and list of message parameters.
See Also
NGLVieweR_example()
See example "updateVisibility".
Other updates:
updateColor()
,
updateRepresentation()
,
updateStage()
Examples
## Not run:
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = TRUE)
## End(Not run)
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
actionButton("show", "Show"),
actionButton("hide", "Hide"),
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server = function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color="residueindex"))
})
observeEvent(input$show, {
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = TRUE)
})
observeEvent(input$hide, {
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = FALSE)
})
}
shinyApp(ui, server)
}
[Package NGLVieweR version 1.3.1 Index]