Lesson 1b - PyMol Scripting

Lesson 1b - PyMol Scripting

How to use your keyboard to dive into the world of proteins

Part 1: PDB ID and property selectors

In this part, you will learn more about the Protein Data Bank (PDB), the unique PDB ID each protein gets and how you can select parts of a protein with property selectors.

Part 2: Using Python scripts in PyMOL

Often, there are certain things we want to do repeatedly such as coloring proteins a certain way, remove some heteroatoms etc. We can do this manually every time, but there is a better way to do it: Python scripts.

In case you are not familiar with Python: don’t worry, you will survive this course anyway. However, in case you are interested in programming and Python (as you should be) there are Python courses that I and other students organise every semester, so drop at one of these or look at the material from a past course to get an introduction!

For this part, the only thing you will need is a text editor in which you can write plain text. And no, Word does not count! We need something that writes plain text, no formatting etc. One for this would be for example VSCode, a full-fledged editor environment that I often use for coding as well. Although I would reommend that one, there are others you can use like Sublime Text, Notepad++ or the simple Notepad/TextEdit application on your laptop. With this, you can dive right into PyMOL scripting via this video!

Part 3: Getting help at the PyMOL wiki

If you are stuck with a certain problem, there is a good chance someone had this problem before! Good places to look for answers in general for coding problems are for example StackOverFlow or the relevant repositories on GitHub, but for PyMol there is the so-called PyMol Wiki where you can find a lot of explanations to the different commands. You can also look at this video to learn more about the PyMol Wiki.

Part 4 (Optional): Writing extensions in the PyMOL API

For the ones among you who are deeper interested in coding and have a bit of Python experience: you can write your own extensions and commands for PyMOL via Python functions! Learn how to do it in this video.

Extra (Optional)

Congrats, you made it to the end! Now you know how to find your way around PyMol and use it to look at protein structures. The program has way more power than I showed you, and we will explore some of it in upcoming lectures.

However, I wanted to mention on extra point for the adventarous among you: you all probably heard of ChatGPT by now, a language model by OpenAI that popularised this line of research in the general public. Well, guess what: someone has written a PyMOL ChatGPT plugin that lets you use ChatGPT inside of PyMOL. In case you are interested, here is the GitHub repository with instructions on how to use it.