updateSelection {NGLVieweR} | R Documentation |
Update a selection
Description
Update the selected residues of an existing NGLVieweR selection in
Usage
updateSelection(NGLVieweR_proxy, name = name, sele = "none")
Arguments
NGLVieweR_proxy |
A NGLVieweR object. |
name |
Name of selection. |
sele |
Selected atoms/residues. See the section "selection-language" in the official NGL.js manual. |
Value
API call containing NGLVieweR
id
and list of message parameters.
See Also
-
NGLVieweR_example()
See example "updateSelection".
Other selections:
addSelection()
,
removeSelection()
Examples
## Not run:
NGLVieweR_proxy("structure") %>%
updateSelection("ball+stick", sele = "1-20")
## End(Not run)
if (interactive()) {
library(shiny)
ui <- fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
textInput("selection", "Selection", "1-20"),
actionButton("update", "Update")
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server <- function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color = "red")
) %>%
addRepresentation("ball+stick",
param = list(
name = "ball+stick",
colorValue = "yellow",
colorScheme = "element",
sele = "1-20"
)
)
})
observeEvent(input$update, {
NGLVieweR_proxy("structure") %>%
updateSelection("ball+stick", sele = isolate(input$selection))
})
}
shinyApp(ui, server)
}
[Package NGLVieweR version 1.3.1 Index]