nglviewer / nglview

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

Problems visualzing resnumbers greater than 9999 #993

Open davidRFB opened 2 years ago

davidRFB commented 2 years ago
python -c 'import nglview; print(nglview.__version__)'
3.0.1
python -c 'import ipywidgets; print(ipywidgets.__version__)'
7.6.4

Hi ! I am using nglview with show_pytraj(). However I have a problem visualizing water close to a residue because, some water residue number are greater than 9999. And therefore I do not see these waters. Here is an example image

I do not know if there is a problem with the topology with pytraj or maybe the visualizer.

Thank you for your time ! What an amazing proyect !

hainm commented 2 years ago

I do not know if there is a problem with the topology with pytraj or maybe the visualizer.

hi @davidRFB:

Can you please save one frame to .pdb format and try again with

view = nv.show_file("your.pdb")
view
[...]

to see if that's an issue with pytraj or nglview? Cheers.

davidRFB commented 2 years ago

Hi @hainm ! Thanks for your answer.

Here is the code with nglview and the pdb. image

The water number 1065 appears twice. I guess because also represent the water 1065X.

hainm commented 2 years ago

So I guess it's the issue with pytraj of how pytraj save the pdb file. Let me investigate (although I don't promise a time frame for that). Cheers and thanks.

davidRFB commented 2 years ago

Thank you very much ! Please, let me know if I can help with something.

juliasubbotina commented 1 year ago

The issue is with not pytraj. I had the same problem with mdtraj or reading PDB directly. The problem with large structures is that residue number is becoming to big, so there is not enough field characters to hold it in PDB file in proper place. As a result the x,y,z values get shifted and NGLview (VMD has the same issue actually) can not read it. For me the trick around was to renumber residue numbers so they fit to 23-30 position @ATOM section and vois là, everything worked just fine. For me new numbers were not needed for further analysis. But if this information is important (e.g. for further analysis of proteins), it is probably better to split protein in shorter chains and restart resnumbers each time. And "re-map" back to original numbering when needed.

hainm commented 1 year ago

Thank you very much for your comment.

Hai

On Wed, Aug 10, 2022 at 7:51 AM juliasubbotina @.***> wrote:

The issue is with not pytraj. I had the same problem with mdtraj or reading PDB directly. The problem with large structures is that residue number is becoming to big, so there is not enough field characters to hold it in PDB file in proper place https://zhanggroup.org/SSIPe/pdb_atom_format.html. As a result the x,y,z values get shifted and NGLview (VMD has the same issue actually) can not read it. For me the trick around was to renumber residue numbers (it wasn't a big thing for my situation) and vois là. Everything worked just fine.

— Reply to this email directly, view it on GitHub https://github.com/nglviewer/nglview/issues/993#issuecomment-1210565936, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB645N6B5KD5RTVCSVU6B3VYOJS7ANCNFSM5DMOE5JA . You are receiving this because you were mentioned.Message ID: @.***>