Closed hainm closed 5 years ago
Until such gui is implemented, is there a way to set the value to use for the isovolume?
hi, in which context? (update_surface
?)
@arose
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.
Are you loading it with view.add_component('my.ccp4')
?
@hainm after loading such a component, how can you add representations to it?
view.add_surface(..., component=0) # or 1, 2,
# or
view.component_0.add_surface(...)
so view.component_0.add_surface(threshold=1.0)
should work, I think
also update current surface repr.
view.component_0.update_surface(threshold=1.0)
It works, indeed. Thanks.
Is there a mailing list somewhere to ask questions without polluting the bug tracker?
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: https://github.com/arose/nglview/issues/589
The amount of questions is not that high, so just having them as separate issues marked as question if fine with me
go back to the original issue: demo from @arose
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?
@arose Can you please provide a code spinet for this so I could introduce to nglview? thanks.
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)
Hi @hainm! Thanks for the suggestion, I will try to use it and report!
~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
edit. Now I found out that it is jupyterlab specific issue. as it works in a plain notebook =( that's sad (
I think it is in 1.1.9
Hai
On Wed, Apr 17, 2019 at 7:34 AM Grigoriy Armeev notifications@github.com wrote:
Hi @hainm https://github.com/hainm, am I missing something, or method _execute_js_code() is not in the current release?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/561#issuecomment-484046354, or mute the thread https://github.com/notifications/unsubscribe-auth/ABB645O2BW2YAX62F6HCWX3PQ4DLNANCNFSM4C4D7UCQ .
@hainm It looks like nothing happens on _execute_js_code(), is there any simple way to know if it works?
Have you tried my attached notebook above yet? It works for me.
I will post another example soon, not at my computer right now.
Hai
On Wed, Apr 17, 2019 at 9:02 AM Grigoriy Armeev notifications@github.com wrote:
@hainm https://github.com/hainm It looks like nothing happens on _execute_js_code(), is there any simple way to know if it works?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/561#issuecomment-484074778, or mute the thread https://github.com/notifications/unsubscribe-auth/ABB645LGT57OEGSWAMIOLQ3PQ4NVHANCNFSM4C4D7UCQ .
Yeap, I've tried it. No color change for me =(
Uhm
I just saw your editted comment (it would be better if you can post a new post so I can get notification): can you summarize again what doesn’t work and in which environment?
Just try with notebook first. Jupyterlab is not that stable (in my opinion).
To make sure the _execute_js_code work, just try a simple JavaScript code
code = “”” console.log(‘hello’) “””
Call the method and open the JavaScript console to see the ‘hello’ word.
(Right click -> Inspection (or similar))
On Wed, Apr 17, 2019 at 9:09 AM Grigoriy Armeev notifications@github.com wrote:
Yeap, I've tried it. No color change for me =(
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/561#issuecomment-484077490, or mute the thread https://github.com/notifications/unsubscribe-auth/ABB645ICKTYHAI5YVQGUB3LPQ4ORPANCNFSM4C4D7UCQ .
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
As for the jupyterlab support there is a bug, I believe as it can not load any files with add_component
method.
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!
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)
great. Thanks.
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
Hello @hainm ! Great news and thank you a lot!