Code Monkey home page Code Monkey logo

Comments (2)

virologist avatar virologist commented on May 20, 2024 2

works for me, thank you very much.

from r3dmol.

BradyAJohnston avatar BradyAJohnston commented on May 20, 2024 1

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

image

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.