nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
821 stars 134 forks source link

Custom coloring of residues #714

Closed surgebiswas closed 7 years ago

surgebiswas commented 7 years ago

I'm trying to color each residue in a structure according to a list of colors. I am trying to replicate the demo in issue #492 . I copied and pasted the code, but the demo structure remains blue.

I've installed nglview using pip install nglview==1.0.b2.

hainm commented 7 years ago

Can you post your notebook screen? Thx

hainm commented 7 years ago

never mind, I can reproduce this issue.

screen shot 2017-10-26 at 7 40 24 pm
hainm commented 7 years ago

@arose oh boy, ColorMakerRegistry was renamed to ColormakerRegistry

I should add a notebook test for this. (uhm, actually it's intention not to test private (experimental) method)).

arose commented 7 years ago

sorry, things like that will be caught by the type checker once typescript is used throughout...

hainm commented 7 years ago

Can you confirm ngl expose that now? I change Maker to maker but does not seem to work.

hainm commented 7 years ago

never mind again. Make it work.

screen shot 2017-10-26 at 8 24 58 pm
surgebiswas commented 7 years ago

What should I do then at this point to make it work? Or should I wait for an update from you? Thanks for the quick responses.

hainm commented 7 years ago

yeah, just wait for me. will try to commit code today.

hainm commented 7 years ago

should be available in 1.0.b7 now. Please try it again. Note that this is private function and subjected to change. Feel free to reopen this issue if you get trouble again. thanks.

surgebiswas commented 7 years ago

Looks like its working now. Great work and again, thanks for the quick responses!

jbloom commented 5 years ago

I'm just curious about the _set_color_by_residue method. Since it begins with an underscore does that mean we should not use this method, or is it something you plan to maintain for the foreseeable future?

hainm commented 5 years ago

hi @jbloom, yeah, it's subjected to change in the future. Please treat it as a sandbox.

jbloom commented 5 years ago

Hi @hainm, thanks. One other question: is there a straightforward way to map the residue numbers as they appear into the PDB (and as they function in commands such as add_spacefill) to the residue indices that are used in _set_color_by_residue?

hainm commented 5 years ago

is there a straightforward way to map the residue numbers as they appear into the PDB

@jbloom unfortunately, there's not.

hainm commented 5 years ago

@jbloom oh, you can use the private (yeah, not public yet) class _ColorScheme for basically any custom color.

https://github.com/arose/nglview/pull/755

screen shot 2018-10-27 at 1 01 21 pm
jbloom commented 5 years ago

@hainm: This _ColorScheme is perfect for my needs, thanks!