selectionParameters: Set selection parameters

View source: R/NGLVieweR.R

selectionParametersR Documentation

Set selection parameters

Description

Set selection parameters.

Usage

selectionParameters(NGLVieweR, proximity = 3, level = "residue")

Arguments

NGLVieweR

A NGLVieweR object.

proximity

Set distance in angstrom for atoms to return in proximity of selection. Default = 3.

level

Set level on which atoms in proximity of selection are returned. Options are "residue" (default) or atom".

Value

Returns list of selection parameters to NGLVieweR htmlwidgets object.

Examples

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)
}


NGLVieweR documentation built on April 4, 2025, 4:33 a.m.