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

volume viewer GUI #561

Closed
hainm opened this issue Jan 11, 2017 · 30 comments
Closed

volume viewer GUI #561

hainm opened this issue Jan 11, 2017 · 30 comments

Comments

@hainm
Copy link
Collaborator

hainm commented Jan 11, 2017

  • Support color by volume.
@jbarnoud
Copy link

jbarnoud commented Mar 9, 2017

Until such gui is implemented, is there a way to set the value to use for the isovolume?

@hainm
Copy link
Collaborator Author

hainm commented Mar 9, 2017

hi, in which context? (update_surface?)

@hainm
Copy link
Collaborator Author

hainm commented Mar 9, 2017

@arose

@jbarnoud
Copy link

jbarnoud commented Mar 9, 2017

I calculated a 3D density grid. I can display that grid as an isosurface around my molecule of interest, but I would like to choose what density value to use to draw the isosurface.

@arose
Copy link
Collaborator

arose commented Mar 9, 2017

Are you loading it with view.add_component('my.ccp4')?

@hainm after loading such a component, how can you add representations to it?

@hainm
Copy link
Collaborator Author

hainm commented Mar 9, 2017

view.add_surface(..., component=0) # or 1, 2,

# or
view.component_0.add_surface(...)

@arose
Copy link
Collaborator

arose commented Mar 9, 2017

so view.component_0.add_surface(threshold=1.0) should work, I think

@hainm
Copy link
Collaborator Author

hainm commented Mar 9, 2017

also update current surface repr.

view.component_0.update_surface(threshold=1.0)

@jbarnoud
Copy link

jbarnoud commented Mar 9, 2017

It works, indeed. Thanks.

Is there a mailing list somewhere to ask questions without polluting the bug tracker?

@hainm
Copy link
Collaborator Author

hainm commented Mar 9, 2017

Is there a mailing list somewhere to ask questions without polluting the bug tracker?

we don't mind about this. I myself prefer to use github issue here.
Just create a topic for posting random + usage questions: #589

@arose
Copy link
Collaborator

arose commented Mar 9, 2017

The amount of questions is not that high, so just having them as separate issues marked as question if fine with me

@hainm
Copy link
Collaborator Author

hainm commented Jun 23, 2017

go back to the original issue: demo from @arose

https://codepen.io/arose/full/oWOQMg/

@satary
Copy link
Contributor

satary commented Mar 28, 2019

Hi @hainm, Hi @arose !
I wonder if it is possible to color a structure (cartoon, surface and other atomic representations) by volume data (loaded with ccp4 or dx).
I see that there is a volumeColormaker but I don't get how to use it. I guess that volume is loaded as a separate component, so can it be done?

@hainm
Copy link
Collaborator Author

hainm commented Mar 28, 2019

@arose Can you please provide a code spinet for this so I could introduce to nglview? thanks.

@hainm
Copy link
Collaborator Author

hainm commented Mar 30, 2019

hi @satary,

It turns out that nglview has not supported that feature yet. But fortunately, you can use the workaround (taken from: https://github.com/arose/ngl/blob/master/examples/scripts/color/volume.js)

Notebook: volume_color.ipynb.txt

Screen Shot 2019-03-30 at 12 33 41 AM

@satary
Copy link
Contributor

satary commented Mar 30, 2019

Hi @hainm!
Thanks for the suggestion, I will try to use it and report!

@satary
Copy link
Contributor

satary commented Apr 17, 2019

Hi @hainm, am I missing something, or method _execute_js_code() is not in the current release?
OK, my bad, solved that one.
BTW, for jupyterlab users you have to jupyter-labextension install nglview-js-widgets both in environment jupyterlab is started in and in the environment, where they use nglview, why so?
Your example does not work, for some reason, I have just an empty widget.

Hm, I guess I found an error, but I have no Idea how to solve it, I can not add any component as file is not found for some reason
image

edit.
Now I found out that it is jupyterlab specific issue. as it works in a plain notebook =( that's sad (

@hainm
Copy link
Collaborator Author

hainm commented Apr 17, 2019 via email

@satary
Copy link
Contributor

satary commented Apr 17, 2019

@hainm It looks like nothing happens on _execute_js_code(), is there any simple way to know if it works?

@hainm
Copy link
Collaborator Author

hainm commented Apr 17, 2019 via email

@satary
Copy link
Contributor

satary commented Apr 17, 2019

Yeap, I've tried it. No color change for me =(

@hainm
Copy link
Collaborator Author

hainm commented Apr 17, 2019 via email

@satary
Copy link
Contributor

satary commented Apr 17, 2019

Thanks for the reply!
In jupyter notebook (run from jupyter hub) I tested your code snippet and nothing seems to be in the console output. But! There is an info message widget_ngl.js:1010 can not create func for execute_code
image

@satary
Copy link
Contributor

satary commented Apr 17, 2019

As for the jupyterlab support there is a bug, I believe as it can not load any files with add_component method.

@satary
Copy link
Contributor

satary commented Apr 17, 2019

Update, I've managed to get Hello in the console, It was due to some mismatch in js extension and python extension. Gosh, it is a bit messy.
Now I can color the surface! Will attach my example later!
Thank you!

@hainm
Copy link
Collaborator Author

hainm commented Apr 17, 2019

image

@satary
Copy link
Contributor

satary commented Apr 17, 2019

To recap for the Google bots:
My task was to color molecular surface according to electostatic potential map (calculated by APBS) loaded from .dx file.
Here is a code snippet for that.

view=nv.show_structure_file('1KX5.pdb')
view.add_component('resources/pot.dx')
view

code = """
var ms = this.stage.compList[0];
var potential = this.stage.compList[1];

ms.addRepresentation('surface', {
    colorVolume: potential.volume,
    colorScheme: 'volume',
    colorScale: 'rwb',
    colorReverse: false,
    colorDomain: [ 0, 1500 ]
})

"""
view.component_1.clear_representations()
view.component_0.clear_representations()
view._execute_js_code(code)

image

@hainm
Copy link
Collaborator Author

hainm commented Apr 17, 2019 via email

@hainm
Copy link
Collaborator Author

hainm commented May 15, 2019

I wonder if it is possible to color a structure (cartoon, surface and other atomic representations) by volume data (loaded with ccp4 or dx).

hi @satary, this feature is added in #804

@satary
Copy link
Contributor

satary commented May 16, 2019

Hello @hainm !
Great news and thank you a lot!

@hainm hainm closed this as completed Jul 12, 2019
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

4 participants