Description Usage Arguments Value See Also Examples
Update the selected residues of an existing NGLVieweR selection in
1 | updateSelection(NGLVieweR_proxy, name = name, sele = "none")
|
NGLVieweR_proxy |
A NGLVieweR object. |
name |
Name of selection. |
sele |
Selected atoms/residues. See the section "selection-language" in the official NGL.js manual. |
API call containing NGLVieweR
id
and list of message parameters.
NGLVieweR_example()
See example "updateSelection".
Other selections:
addSelection()
,
removeSelection()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ## 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.