Set selection parameters.
selectionParameters(NGLVieweR, proximity = 3, level = "residue")
A NGLVieweR object.
Set distance in angstrom for atoms to return in proximity of selection. Default = 3
.
Set level on which atoms in proximity of selection are returned. Options are "residue" (default) or atom".
Returns list of selection parameters to NGLVieweR
htmlwidgets
object.
NGLVieweR("7CID") %>%
addRepresentation("cartoon") %>%
selectionParameters(3, "residue")
# Shiny context
if (interactive()) {
library(shiny)
ui <- fluidPage(NGLVieweROutput("structure"))
server <- function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon") %>%
selectionParameters(3, "residue")
})
observeEvent(input$structure_selAround, {
NGLVieweR_proxy("structure") %>% removeSelection("selAround")
NGLVieweR_proxy("structure") %>%
addSelection(
"ball+stick",
param =
list(
name = "selAround",
sele = input$structure_selAround,
colorValue = "grey"
)
)
})
}
shinyApp(ui, server)
}