Comments (2)
works for me, thank you very much.
from r3dmol.
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 colorscheme
.
At the moment for all of the m_style_*()
functions it is:
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 colorScheme = "default"
.
I will fix this, but as a workaround for you code at the moment to get it working, you can override the colorScheme
default by:
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 :)
from r3dmol.
Related Issues (20)
- Addition of Interactive Buttons HOT 1
- Layout Support HOT 1
- 就是问一下,如何在jupyter lab 里输出图片?虽然貌似不是包本身的问题。 HOT 4
- Next Official Release HOT 7
- Bug about button layout
- predicted 3D structures in *pdb format HOT 3
- m_png() with wrong result HOT 3
- Function request: resi label with less overlap HOT 1
- Implement `mapAtomProperties` function
- Problems with Widget Resizing Inside `{xaringan}` slides HOT 1
- Bump 3Dmol.js version to 1.7 HOT 2
- m_grid does not update in Shiny app with selectInput HOT 3
- Color by b-factor (spectrum) HOT 13
- Feature request: add colorfunc to argument to m_style_surface() and others HOT 2
- Save image as PNG in Shiny with a download button HOT 2
- How can I export this figure in the ShinyApp HOT 2
- Parts of structure disappear when rotating without m_zoom_to() HOT 2
- CRAN outdates
- m_add_label() prints label at wrong position HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from r3dmol.