Closed hainm closed 3 years ago
Hi, I notice a bunch of tempfiles in my /tmp directory after using nglviewer, containing essentially the molecular coordinates in pdb format. Do they stay there because of abrupt termination of nglivew or something?
@gph82 I guess we did not do great job in cleaning those files. No, nglview do not need them to be there all the times.
updated: remove expired link.
Hi is there a way to access and manipulate the rotation and zoom independently in the view object. NGL seems to support this. https://github.com/arose/ngl/issues/240#issuecomment-264039568
I know about view.orientation
but it handles zoom and rotation and at the same time and not separately.
Hi, can you open a new issue so we can make it in our todo list. thx.
Hi all. I would like to do the following thing: each cell of my iPython notebook should contain only a "portion" of the entire protein. I explain: in each cell I would like to make visible only the portion of the protein that corresponds to a particular sequence. Is this possible? Is it possible to at least highlight in some way some portions of a protein using a sequence of amino acids as input? Thank you.
@lorenzoFabbri
: in each cell I would like to make visible only the portion of the protein that corresponds to a particular sequence. Is this possible?
No it's not possible. You can can always create 3 views
and display them.
views = [nglview.show_structure_file('my.pdb') for _ in range(3)]
# views[0]: do something
views[0]
# another cell
# views[1]: do something
views[1]
...
Is it possible to at least highlight in some way some portions of a protein using a sequence of amino acids as input? Thank you.
May be just adding representations for given residue selection if you know where they are? http://arose.github.io/ngl/api/tutorial-selection-language.html
PR is welcome if you think those utils useful for you and others. Cheers. Ping @arose here in case you have different answers.
In a notebook I recently viewed two structures in different notebook cells. That worked fine.
In a notebook I recently viewed two structures in different notebook cells. That worked fine.
Yes, you can create as many views as you want.
Hi, is there a way to assign color to a given atom type in ball and stick model? It seems like other than common atoms in organic chemistry the rest of the atoms are represented with white color which makes it hard to distinguish with hydrogen atoms. Is there a way use something like CPK coloring? Thanks!
Is there a way to install a development version as a isolated environment? I found using a different conda environment screws with the javascript in my root environment.
@kbsezginel can you please provide screenshot?
Ping @arose
is there a way to assign color to a given atom type in ball and stick model
There is CPK coloring based on the element. So if everything is white there is likely an error in determining the element. I would need an example file to look into that.
When I create a list of different atoms such as this:
atom_names = ['C', 'H', 'O', 'N', 'F', 'Cl', 'Br', 'Li', 'Zn', 'Cu', 'Pd', 'Co']
separate them 4 angstroms apart and save to a pdb file, this is what I see with nglview:
When I load the same pdb file using a molecular graphics software this is what I get:
As you can see only a handful of atoms are colored and their radii are all the same as well.
I attached the jupyter notebook and pdb file below: atom-color.zip
The issue are non all-upper-case atom names. Fixed in the ngl development version. Will take some time to go into nglview. Workaround is providing all-upper-case atom names.
Will take some time to go into nglview
if you push to npm, will be available tonight :D
if you push to npm, will be available tonight :D
there are some issues with the current version... ;)
Thanks a lot! It seems like the radii are all the same though, is that also fixed in the ngl development version?
It seems like the radii are all the same though
that is just due to the default parameters of the ball+stick representation. Have a look at the radiusType
parameter (http://arose.github.io/ngldev/api/global.html#StructureRepresentationParameters)
Hi again! I run into this problem that in ball and stick model the bonds are not displayed after a certain number of atoms. Is there a way to force calculation of the bonds or does it just skip that when there is too many atoms?
Here with approximately 300 atoms:
Here with approximately 500 atoms:
Thanks!
@kbsezginel Can you please provide the file you are loading. Thanks!
Here, I attached the pdb files. Thanks!
You assign the same group/residue number to all molecules. If you give every molecule its own number the bond calculation will work fine.
Thanks, that seems to get the bond calculation working however now I am seeing incorrect assignments of the bonds for some molecules:
When I visualize the same file without groups I see no bonds as expected:
I also tried with a smaller number of molecules:
Group:
No group:
Any idea why that's the case? Thanks!
Attached pdb files here: mol_grouping.zip
I haven't looked at it but my hunch is that it will work if you give each group its own distinct three letter name instead of calling them all MOL. For efficiency reasons, NGL tries to reuse calculated bonds for identical groups. However the identity calculation seem wrong here.
Thanks, that worked perfectly!
I wanted to ask, if it is possible to also display external densities, extracted e.g. from a Gaussian Cube file?
I think Yes: https://github.com/arose/ngl#features
view.add_component(file_name)
cc @arose
Yes, cube files are supported. Currently the density is read and unitcell transformations. Let me know if you need something else.
Thanks a lot, that works well for densities.
I am doing QM/MM calculations and wanted also to visualize molecular orbitals. Therefore I would need to change the isovalue add_component uses to generate the surface. Also I changed the color of the surface (adding the color keyword in add_component did not change anything). I could do this by calling view.component_1.add_surface(color='blue'), afterwards, which renders a blue surface on top of the gray standard one. But this does not work nicely once one wants to use a lower opacity, as the gray standard surface is still there. Is there a way to solve this?
import nglview view=nglview.show_structure_file('benzene2.mol2') view.add_component('benzene_homo.cube') view
view.component_1.add_surface(color='blue')
May be try 'clear' before calling add_surface?
Hai
On Apr 16, 2017, at 5:20 PM, morpholin notifications@github.com wrote:
Thanks a lot, that works well for densities.
I am doing QM/MM calculations and wanted also to visualize molecular orbitals. Therefore I would need to change the isovalue add_component uses to generate the surface. Also I changed the color of the surface (adding the color keyword in add_component did not change anything). I could do this by calling view.component_1.add_surface(color='blue'), afterwards, which renders a blue surface on top of the gray standard one. But this does not work nicely once one wants to use a lower opacity, as the gray standard surface is still there. Is there a way to solve this?
**
My code:
import nglview view=nglview.show_structure_file('benzene2.mol2') view.add_component('benzene_homo.cube') view
view.component_1.add_surface(color='blue')
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Yes, calling clear did the job.
Still is the issue with the isovalue remains, it would be very nice to choose the isovalue! ( I did the job by writing a script that reads the Cubefile, and writes a new one with Values of opposite sign)
Here the pictures that I managed to create and thanks again for the help.
view.component_1.add_surface(color='blue', isolevelType="value", isovalue=1);
view.component_1.add_surface(color='red', isolevelType="value", isovalue=-1);
see http://arose.github.io/ngldev/api/global.html#SurfaceRepresentationParameters
isolevelType="value"
On Mon, Apr 17, 2017 at 12:26 PM, Alexander Rose notifications@github.com wrote:
view.component_1.add_surface(color='blue', isolevelType: "value", isovalue: 1); view.component_1.add_surface(color='red', isolevelType: "value", isovalue: -1);
see http://arose.github.io/ngldev/api/global.html# SurfaceRepresentationParameters
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/589#issuecomment-294521117, or mute the thread https://github.com/notifications/unsubscribe-auth/AEPudfKm082avuWkjtYm8J2zNaBJYp0qks5rw5KpgaJpZM4MYmYa .
Hi. Is it possible to display the nglview for a trajectory without the "progress bar" control and the "play" button? Thanks.
I think it's @arose intention to always display player if using trajectory. I added an option to not display it but changed back after chatting with him (if I remember correctly).
@arose what do you think? @jbarnoud what's your reason to not display it?
I think having a parameter to control its display is a good idea.
In y current notebook I control what frame I want to display with a slider that updates both the nglview and a series of plots. In that context, the trajectory controler of nglview adds clutter and risks having the view and the plot out of sync.
ok, I will add that.
Thanks!
Hi @jbarnoud , i'm curious. Something like this: https://github.com/markovmodel/molPX/blob/master/molpx/notebooks/Projection_Explorer.ipynb?
(ps. the notebook has not saved the nglview, but only the plots that the slidebar influences)
On 04/21/2017 02:34 PM, Guillermo Pérez-Hernández wrote:
Hi @jbarnoud https://github.com/jbarnoud , i'm curious. Something like this: https://github.com/markovmodel/molPX/blob/master/molpx/notebooks/Projection_Explorer.ipynb?
(ps. the notebook has not saved the nglview, but only the plots that the slidebar influences)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arose/nglview/issues/589#issuecomment-296178804, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUWurxt2ENarsdgl3hSkuWDzzT9Fd6oks5ryKJqgaJpZM4MYmYa.
I am not plotting the same thing. But it is the same principle, yes.
Hi @hainm , how do I add_distance to all the structures in the widget? Currently it only adds one of them:
I guess you need to pass the component
argument
view.add_distance(..., component=0) # 1st structure
view.add_distance(..., component=1) # 2nd
Hi, all
I just encountered a strange problem with this PDB file:
TITLE WATER
CRYST1 50.000 50.000 99.000 90.00 90.00 90.00 P 1 1
MODEL 1
ATOM 1 OW HOH 1 28.620 2.010 62.876 1.00 0.00
ATOM 2 HW1 HOH 1 28.420 2.470 62.016 1.00 0.00
ATOM 3 HW2 HOH 1 29.610 1.970 63.016 1.00 0.00
ATOM 4 OW HOH 2 14.690 7.330 76.086 1.00 0.00
ATOM 5 HW1 HOH 2 15.660 7.570 76.146 1.00 0.00
ATOM 6 HW2 HOH 2 14.140 8.010 76.566 1.00 0.00
ATOM 7 OW HOH 3 3.880 32.660 88.266 1.00 0.00
ATOM 8 HW1 HOH 3 4.560 32.870 88.966 1.00 0.00
ATOM 9 HW2 HOH 3 2.960 32.880 88.616 1.00 0.00
ATOM 10 OW HOH 4 16.770 24.120 74.116 1.00 0.00
ATOM 11 HW1 HOH 4 16.990 24.360 75.066 1.00 0.00
ATOM 12 HW2 HOH 4 15.810 24.340 73.946 1.00 0.00
TER
ENDMDL
if I remove atoms 10-12, everything is fine. By including them, I get an empty view
import nglview as nv
view=nv.show_structure_file('./test.pdb')
view
(nglview version == 0.6.3 from PyPI)
Any clue what could be the reason for this behaviour?
I answer myself: apparently the problem is in the residue sequence number. By setting it to 3 in the last water molecule,
ATOM 10 OW HOH 3 16.770 24.120 74.116 1.00 0.00
ATOM 11 HW1 HOH 3 16.990 24.360 75.066 1.00 0.00
ATOM 12 HW2 HOH 3 15.810 24.340 73.946 1.00 0.00
(or by setting it to 1 everywhere, for that matter) the view is displayed correctly.
Could this be a bug, or is it intended to be so?
hi thanks for your report. No, it's not intention.
cc @arose since this relates to NGL.
this is just a problem with the default representation, if you have something as uncommon as only water in a model it is best to choose your own representation
Hi guys, going back to this issue about densities (https://github.com/arose/nglview/issues/589#issuecomment-294437822), any idea why I'm not getting any output on this?:
import nglview
print(nglview._version.version_json)
{
"date": "2017-03-09T15:43:07-0500",
"dirty": false,
"error": null,
"full-revisionid": "fc6dfc01bdefeb457d1c374e8dc01080eac1f267",
"version": "0.6.2.3"
}
iwd = nglview.show_structure_file('struct.pdb')
iwd.component_0.clear_representations()
iwd.add_component('dens.cube')
iwd.component_1.add_surface(color='blue', isolevelType="value", isovalue=.10)
iwd
More info:
hi,
please try following
0.6.3
For any questions relating to how/why/ ... Or anything you don't know where to ask.
For bug, suggestion, ... please open seperate issue