Question: How do I view data in pymol via Ipymol for visualisation in a Jupyter notebook?
1
1
Entering edit mode
4.8 years ago
M.O.L.S ▴ 100

I am analysing protein data using Python programming language and Jupyter notebook.

In the Terminal I have put an alias in a hidden file on the home directory entitled .bash_profile, in order to be able to open pymol directly from the Terminal .

   alias pymol=/folder/where/pymol/is/located/Applications/PyMOL.app

In Jupyter notebook, the first two commands are executed:

from ipymol import viewer as pymol
pymol.start()

However, the following command gives an attribute error.

pymol.fetch('4MBS') # Fetch PDB

Is there another way to load a file directly from my hardrive for viewing?

The only workaround I have found is using.

import nglview as nv

view = nv.show_file(/path/to/folder/where/protein/located.protein)
view

I appreciate any help in advance as i would like to use pymol in this way, if possible.

Thanks

pymol jupyter python idle • 3.2k views
ADD COMMENT
1
Entering edit mode
2.4 years ago
M.O.L.S ▴ 100

The answer to this question is that a bash shell .pml script needs to be made instead of a python .py script.

The shell script can be shown in a Jupyter Notebook by using RawNBConvert setting, which is found underneath the help menu.

The images generated from the .pml script can be viewed using Pymol and snapshot jpeg or png files can be taken of the molecules.

The ipymol does not work and the nglview is not required.

ADD COMMENT
1
Entering edit mode

I don't think that's the only answer. I have been able to use PyMOL and Python scripts. I have no experience with ipymol.

(There's a difference.
.pml are pymol scripts.
There's a different syntax and set of commands when you are using Python to interact with PyMOL.)

Go to pymol-binder and click launch binder. The sessions that launch show making scripts and running them in several examples.
Those examples should help you in running things in your situation.

ADD REPLY

Login before adding your answer.

Traffic: 2683 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6