-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set the amino acid with special color? #33
Comments
Hi Yang! Thanks for the bug report. I've poked around and found that the problem is not your code, but a bug. It seems to be coming a result of the default that we have set for the At the moment for all of the colorScheme="default" So when you are setting the style with: m_style_sphere(scale = 0.5, color = "#e41a1c") Even though you have set a specific colour it is being overriden by the default I will fix this, but as a workaround for you code at the moment to get it working, you can override the m_style_sphere(scale = 0.5, color = "#e41a1c", colorScheme = NULL) Adjusting your code with the workaround: rm(list = ls())
gc()
library(bio3d)
library(r3dmol)
p <- r3dmol() %>%
m_add_model(data = m_fetch_pdb("6D7U", save.pdb = TRUE)) %>%
m_add_model(data = m_bio3d(pdb)) %>%
# m_set_style(style = m_style_cartoon(color = 'spectrum', ribbon = TRUE)) %>%
m_set_style(style = m_style_cartoon()) %>%
m_add_outline() %>%
# m_set_style(style = c(m_style_cartoon(color = "spectrum", ribbon = TRUE), m_style_line())) %>%
m_add_surface(atomsel = m_sel(chain =c('A', 'B')), style = m_style_surface(opacity = 0.9, colorScheme="chain")) %>%
m_add_style(sel = m_sel(resi = c(206:220), chain="E"), style = m_style_sphere(scale = 0.5, color = "#e41a1c", colorScheme = NULL)) %>%
# m_set_style(sel = m_sel(resi = c(206:220), chain = "A", byres = TRUE), style = m_style_cartoon(color = "red")) %>%
m_add_surface(atomsel = m_sel(resi = c(206:220), chain = "C"), style = m_style_surface(opacity = 0.9, color = "#e41a1c", colorScheme = NULL)) %>%
# m_add_line(start = m_sel(resi = 1:10, chain = "A"), end = m_sel(resi = 1:10, chain = "B"), spec = list(dashed = TRUE)) %>%
m_add_label(text = "Site A", sel = m_sel( resi = 206:220, chain = "C"), style = m_style_label(borderColor = "green", borderThickness = 1, inFront = FALSE)) %>%
# m_zoom_to(sel = m_sel(resi = c(206:220), chain = "A"))
# m_set_zoom_limits(upper = 200, lower = 30)
m_zoom_to()
p I hope this is what you are after at the moment, and thanks so much for the bug report! We really appreciate it :) |
works for me, thank you very much. |
change to colorScheme = NULL fixing #33
Hi, Su
How to set certain amino acids with a special color?
See this demo trimer protein with 6 chains, including HA1: A, C, and E; HA2: B, D, and F.
My purpose is set the 206:220 on HA1 with red color (#e41a1c).
So, I try to use m_add_style and m_add_surface. But they look like do not as work as my desire.
Is there something wrong with my code?
Thanks,
Yang
The text was updated successfully, but these errors were encountered: