For more details on installing libraries for specific editors, go to the GitHub Page.
- easypymol
- pymolshortcuts (useful for non-coders)
- orgpymolpysnips
- rstudiopymolpysnips
- taggedpymolpysnips
- jupyterlabpymolpysnips
- colabOpenSourcePyMOLpySnips
- colabPyMOLpySnips
- PyMOLwallhangings
The animation below demonstrates the use of the ao tab trigger in the text editor Visual Studio Code to insert 17 lines of code for generating the ambient occlusion effect. Two levels of cascading menus appear. The menu on the left shows the alternate tab triggers that contain the letters a and o. The corresponding code for the selected tab trigger is displayed in the right window. By entering these two letters, you have inserted 16 lines of code!
The result of applying a variant of the above code to a 27-nucleotide RNA hairpin is shown below.
To make such an image, PyMOL does not have a pulldown menu option; a script is required.
This code can be applied to any molecular object in PyMOL's viewport, not just RNA.
If you are not ready to write PyMOL scripts, please consider using PyMOL shortcuts to enhance your productivity in PyMOL interactive sessions.
For example, the above ambient occlusion effect can be invoked at any time by entering AO
at the PyMOL prompt if the pymolshortcuts.py file has been loaded.
The pymolsnips library contains 256 code fragments (i.e., templates or snippets) written in the PyMOL macro language (pml) for eighteen text editors. It is highly likely that you have experience with one of these text editors. If you want support for an additional text editor, please open an issue under the issues tab above or send me an e-mail. My contact information is at the bottom.
Note that each line in a snippet is terminated with a semicolon. This means that a user can copy multiple lines of code out of their script file and paste them at the PyMOL prompt in one operation. This is an alternative to saving and reloading the script file.
For more details on using the snippets, a gallery of output, the supported text editors, library installation, and the content of the library, please see the associated GitHub Page. This page takes several seconds to load due to a large number of animated gifs.
The page has the content of the old README.md referred to in the associated manuscript. The old README.md file was moved to the webpage on 25 November 2020.
- Tech Stack
- Installation
- Configuration Setup
- Usage
- Testing
- Requests for new snippets and text editors
- Bug reports
- License
- Contact Information
- How to cite
Technology | Description |
---|---|
PyMOL 2.4 | Molecular graphics program |
Python 3.7 | Programming language |
Some of the snippets have Python3 code. If you are using an ancient version of PyMOL that relies on Python2, you can buy a license to the current version of PyMOL, install a free open-source version of PyMOL that depends on Python3 (See the PyMOL Wiki), or you can rewrite the snippet's code to be Python2 compliant. This often merely involves replacing print statements in Python2 with print() functions in Python3. Note that multiple versions of PyMOL can operate side-by-side on a computer: You do not have to delete that ancient version of PyMOL.
Unfortunately, GitHub does not yet provide an easy way to download part of a repository. It is easier to download the whole repository, select the necessary parts, and delete the rest. Setting up and maintaining 18 separate repositories was too unwieldy.
Download all of the libraries by using the command git clone https://github.com/MooersLab/pymolsnips.git
in a terminal window if you have git installed.
Alternatively, you download all of the libraries as a zip file by clicking on the green code button above.
See the GitHub Page for installation instructions for a specific text editor.
The snippet libraries are independent of PyMOL. No modification of PyMOL is required. The configuring of text editors is found on the GitHub Page.
Examples of the snippets in use in various editors are found in the animated gifs on the GitHub Page. These gifs convey the essential knowledge in seconds.
Try the ao snippet. You should get a result similar to the one in the demo above.
Please use the Issues tab above to request support for additional text editors, suggest additional snippets, or ask questions. Alternatively, you can send e-mail to me.
Questions about PyMOL should be directed to the PyMOL Mailing List.
Please use the Issues tab above to report bugs or send me [e-mail](# contact information) via the form. Refer bugs in the text editors to the developers of the text editors.
We use the permissive MIT license. The license information for this project is found in the License.txt file above.
I can be reached via the Issue tab above or via e-mail: blaine-mooers at ouhsc.edu
.
If you use this library to make figures for publication, please cite the following publication:
Mooers, BHM, Brown, ME. Templates for writing PyMOL scripts. Protein Science. 2021; 262--269. https://doi.org/10.1002/pro.3997
For BibTex library.bib file:
@article{mooers2021templates,
title={Templates for writing PyMOL scripts},
author={Mooers, Blaine HM and Brown, Marina E},
journal={Protein Science},
volume={30},
number={1},
pages={262--269},
year={2021},
publisher={Wiley Online Library}
url={https://onlinelibrary.wiley.com/doi/abs/10.1002/pro.3997}
doi={10.1002/pro.3997}
abstract={PyMOL commands are used to exert exquisite control over the
appearance of a molecular model. This control has made PyMOL popular
for making images of protein structures for publications and presentations.
However, many users have poor recall of the commands due to infrequent
use of PyMOL. This poor recall hinders the writing of new code in scripts.
One solution is to build the new script by using code fragments as
templates for modular parts of the task at hand. The code fragments
can be accessed from a library while writing the code from inside a
text editor (e.g., Visual Studio Code, Vim, and Emacs). We developed a
library of PyMOL code templates or snippets called pymolsnips to ease
the writing of PyMOL code in scripts. We made pymolsnips available on
GitHub in formats for 18 popular text editors. Most of the supported
text editors are available for Mac, Windows, and Linux operating systems.
The GitHub site includes animations that complement the instructions
for installing the library for each text editor. We expect that the
library will help many PyMOL users to be more productive when writing
PyMOL script files.}
}
For ENDNOTE library.enw file.
%0 Journal Article
%T Templates for writing PyMOL scripts
%A Mooers, Blaine HM
%A Brown, Marina E
%J Protein Science
%V 30
%N 1
%P 262-269
%@ 0961-8368
%D 2021
%I Wiley Online Library
Version | Changes | Date |
---|---|---|
Version 0.2 | Added funding and update table | 2024 April 13 |
- NIH: R01 CA242845, R01 AI088011
- NIH: P30 CA225520 (PI: R. Mannel); P20GM103640 and P30GM145423 (PI: A. West)