Skip to content
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

Density map cannot be set to opacity #868

Open
xizhang0819 opened this issue Jan 27, 2020 · 7 comments
Open

Density map cannot be set to opacity #868

xizhang0819 opened this issue Jan 27, 2020 · 7 comments

Comments

@xizhang0819
Copy link

Hello! I am using NGLview to visualize density map and protein. One issue I met is that I cannot set opacity for some density maps. The attached file contains two maps: a density map orriginally downloaded from EMDB, which can be set to opacity; and its "save map as..." saving map by Chimera, which cannot be set to opacity. Following is the code on Jupyter Notebook.

#############################
import nglview as nv

view = nv.NGLWidget()
filename1 = 'save_test.mrc'
filename2 = 'emd_1461.map'
view = nv.show_file(filename2)
view.add_component(filename2)
view

view.component_0.update_surface(color="orange", isolevel=0.5, opacity=0.5)
#################################################

Could you help me throuth this? This is the first time I post an issue on Github. If you need more information, please feel free to ask me. Thank you very much!

Xi

@hainm
Copy link
Collaborator

hainm commented Jan 27, 2020

view = nv.show_file(filename2)
view.add_component(filename2)

hi @xizhang0819 what you mean in above code (you added the filename2 twice).

@xizhang0819
Copy link
Author

Hi @hainm , to test if the opacity is working or not, I import a map and change its representation to opacity with smaller isovalue (larger volume). Then I add the same map as a hard core reference subject. In fact, they are not necessary to be the same. For example, we can change it to:
#######
view = nv.show_file(filename1)
view.add_component(filename2)
########
In this case, it will used to examine if filename1 can be set to opacity or not.

since I used:
#############
view.component_0.update_surface(...)
##############
therefore, the code can change the first imported file (filename1 or filename2, changable) and examine if it can be set to opacity.

@hainm
Copy link
Collaborator

hainm commented Jan 27, 2020

I think you made thing much more complicated to report.
So basically with emd_1461.map, you can set the opacity and it works correctly but you can not change the opacity for save_test.mrc. Is that correct?

@xizhang0819
Copy link
Author

Yes thats correct, and both of the map can correctly show in Chimera.

@hainm
Copy link
Collaborator

hainm commented Jan 27, 2020

thanks, it sounds like a bug from [NGL](https://github.com/arose/ngl.
Unfortunately it (NGL) is not actively developed anymore. cc @arose

@xizhang0819
Copy link
Author

Thank you. I believe I locate the bug. In density map, there are three parameters to indicate the coordinate system:
mapc, mapr, maps.
Normally, we use [mapc, mapr, maps] = [1,2,3] to stand for a right-hand xyz system. However, sometimes the density map is measured and recorded under different coordinate system such as yxz or zyx, represented as [2,1,3] and [3,2,1] respectively.
I have tested all 6 combination cases of coordinate systems. Results are as follows ("N" means cannot set to opacity):
123 N
132 Y
213 Y
231 N
312 N
321 Y

As you can see, all of the right-hand coordinate systems are failed to set to opacity while all of the left-hand coordinate systems work fine. If the bug cannot be fixed, I may manully set the density map to a left-hand coordinate system for visualization.

Thank you again!

@hainm
Copy link
Collaborator

hainm commented Jan 28, 2020

thanks @xizhang0819. It takes time to have the bug fixed (or it might not even fixed :D in NGL). Please go head make adjustment for your work. cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants