PyMOL Schrödinger

Advanced Scripting Workshop

Part 2: How to run scripts conveniently...

With PyMOL 2.0 on all platforms

Drag the .pml script from Explorer/Finder/Dolphin etc. into PyMOL window.

... on Linux

Using a terminal (e.g. xterm):

  1. cd to the directory where you have your script and/or data
  2. Run PyMOL with the script:
    # run a PyMOL command script (opens PyMOL GUI)
    pymol script.pml
    
    # run a Python script
    pymol script.py
    
    # batch mode (no PyMOL GUI)
    pymol -c script.pml
    
    # use absolute path if "pymol" is not in $PATH
    /opt/pymol-2.2.3/pymol -c script.pml

... on Mac

... on Windows

Register .pml extension with PyMOLWin.exe

Using Windows Explorer:

  1. Create a PyMOL application shortcut on the Desktop.
  2. Drag the .pml script to the application shortcut.

... from the PyMOL command line

Load PML scripts with @:

PyMOL> @example.pml
PyMOL> @/tmp/PyMOLScripts/example.pml
PyMOL> @C:\PyMOLScripts\example.pml

Load Python scripts with run:

PyMOL> run example.py
PyMOL> run /tmp/PyMOLScripts/example.py
PyMOL> run C:\PyMOLScripts\example.py

Open a Script with PyMOL

Download the PyMOL (PML) script example.pml and open it with PyMOL by dragging it into the PyMOL window.

Expected result:

Run a script with the PyMOL command line

Run the same example.pml script on the PyMOL command line with @.

Hints: The commands cd, pwd and ls are useful to first navigate to the right directory. Filename auto-completion speeds up typing and avoids typos. You can also use environemnt variables (e.g. $HOME) and ~ (home directory).

Run a Python script from the PyMOLWiki

  1. Download and run bbPlane.py from https://pymolwiki.org/index.php/BbPlane. For example like this:
    run ~/Downloads/bbPlane.py
  2. Load a protein structure, e.g. by typing into the PyMOL command line:
    fetch 1ubq
  3. The bbPlane.py script added the new bbPlane command to PyMOL, type it into the PyMOL command line and hit Enter
    bbPlane

Expected result:


© 2017 Schrödinger, Inc.