Open juan2089 opened 1 year ago
Unfortunately, you need to select at least three consecutive residues to display the protein in the cartoon representation due to a restriction in the NGL.js library. However, for the ball and stick representation, you can select a single residue.
I hope the below example also answers your second question. For more examples see: link
library(shiny)
library(NGLVieweR)
ui <- fluidPage(NGLVieweROutput("structure"))
server <- function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("3RY2") %>%
addRepresentation("cartoon",
param = list(
name = "test",
colorValue = "red",
colorScheme = "element"
)) %>%
addRepresentation(
"ball+stick",
param = list(
name = "test",
colorValue = "green",
colorScheme = "element",
sele = "20"
)) %>%
addRepresentation(
"ball+stick",
param = list(
name = "test",
colorValue = "yellow",
colorScheme = "element",
sele = "19"
))
})
}
shinyApp(ui, server)
Hello there, I am trying to use NGLViewer in Shiny. I want to color a specific amino acid in the cartoon representation. However, it seems that NGL is only able to color the selection if I select more than one residue. Is anybody having the same issue? Here is the code im using:
Also, do you know how to color by residue in a ball+stick or surface representation? I would like to color all atoms in a residue using the same color in any of those two representations.
Thank you in advance, NGLVieweR rocks!!