nglviewer / nglview

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

Selection language for an MD analysis universe #981

Closed Quynh2710 closed 3 years ago

Quynh2710 commented 3 years ago

I have been trying to visualize an MDAnalysis trajectory of a protein with a ligand and a metal using nglview, but I have not been able to choose the representation for the ligand. I tried different combinations of selection, but I only able to get the ligand only when I use 'sele' : 'not (protein or water or ion or ligand)' , which does not make much sense and does not apply to other similar universes. Can you suggest what I should do to apply the representation only for the ligand? image

hainm commented 3 years ago

Hi @Quynh2710: Is that possible to upload your file here?

Quynh2710 commented 3 years ago

Yes, sure. This is the link to one of the MD Analysis universes that I use. The file is large, and I don't think of any other way to share it. https://drive.google.com/file/d/1AG0xBftTjjIqZ7Qhw94ppqDLrVfKHoNr/view?usp=sharing

hainm commented 3 years ago

It's too large (5.9G) for me. Why don't you just extract 1 frame and save it to pdb file and upload here?

hainm commented 3 years ago

And make sure to past exact commands so I can reproduce the issue (e.g: I am not sure how you created view).

Quynh2710 commented 3 years ago

Thank you for helping me out and I'm sorry for the confusion. This is the file for one time step in the trajectory. universe.pdb.zip To view to the universe, this is the code that I used image To selectively choose the representations for the ligand, this is the code that I used image

hainm commented 3 years ago

hi @Quynh2710, I think nglview (NGL under the hood) fails to recognize TIP as water. So it treats TIP molecules as ligands. I suggest to use view.add_licorice('ANP') explicitly for your ligand(s).

Screen Shot 2021-05-25 at 11 19 13 PM
Quynh2710 commented 3 years ago

Thank you very much! It's worked beautifully now.

hainm commented 3 years ago

Cheers.