PyMOL: 10 very basic commands that you really need to know- Part 2

The Bioinformatics Manual
10 min readAug 13, 2022

--

Hey people! Welcome to another blog episode with the Bioinformatics Manual, where we happily talk about all heard and unheard Bioinformatics software, in the easiest language possible!

Part 1 of the blog on PyMOL, we discussed 5 basic commands that could make your PyMOL life easier, and totally help you out navigating through the software. In this blog post, we will be adding another 5 commands, to our list of commands, helping you become a master of PyMOL! ( This blog is only a continuation of the Part1 blog of the same series, and I would suggest you go through Part 1, if you haven't gone through it yet, and only then move ahead with this blog post.)

Note: We will be using protein 6fey from the PDB database for proteins in this entire session. In case you haven’t downloaded the structure for the protein you can go ahead and read Part 1 of this blog to help you do the same. Not to mention we will be needing PyMOL installed on a Linux/Windows/Mac system.

Awesome right? What are we waiting for then? Let’s begin!

Command 6- Changing the background color of the PyMOL session

Woohoo! This is gonna be a fun command! Easy and simple, you gotta type in the following in the PyMOL command box.

bg_color white

The color you specify after the keyword bg_color is the one you choose as your background, so choose carefully! Hehe.

This is the result for choosing bg_color white. It’s great for publications and official stuff. Trust me.

Let’s try something cool now. How about cyan? Let’s try it.

bg_color cyan

Looks cool! Yeahh! Awesome!

Finally, let’s revert it back to black since nothing’s better than black now, is it?

Awesome! Now that we know how to change the background color, let’s move on to the next awesome PyMOL command!

Command 7- Removing the solvent in PyMOL

Now sometimes, you might just find solvent molecules attached to a particular protein, and this happens because solvent molecules give stability to the protein structure.

There are interactions between the solvent and the amino acids of the protein (hydrophobic and hydrophilic) that you must have studied in your classes, but if you haven’t, not to worry, the solvent molecules are just there to help the protein stay in a particular configuration.

As a protein scientist (Uff, calling myself a protein scientist, how posh! I am actually not, but I wish I could be :)), or rather a protein structure specialist ( I don’t know if this job title actually exists hehe), I don’t really care about where the solvent molecules lie, and how they are oriented. It's the last thing I care about really. So, I want my protein structure but I wanna remove the solvent molecules.

How do I do that? Easy. Simple command to be put in the PyMOL command line.

remove solvent
This is my protein before removing the solvent. You can see small red solvent molecules surrounding my protein if you observe closely.
Using the command, we have removed the solvent molecules. Woohoo!

And Ta-da! We’re done! Awesome! And my protein structure looks so pretty without those small interfering interrupting solvent molecules! Yay!

Command 8- The help command in PyMOL

I am a forgetful person. I am sure some people (some, I know most people reading this blog are super duper smart) like me, are forgetful, and folks this is the ultimate command for people like us!

The help command followed by any keyword (any word that makes sense to PyMOL) helps us to understand what that keyword can be used for. For example- let’s type in help color in the PyMOL command line and see what happens.

help color

Typing help color in the command box gives us the following lines in the PyMOL console.

EXAMPLE    color cyan
color yellow, chain A

Therefore, some examples of using the color keyword would be to write “color cyan” in the command line and see your protein getting colored cyan.

Wow! So, this is what our protein colored in cyan looks like! Nice!

Or perhaps you just wanted to color the chain A of your protein yellow, and hence you would be specifying that by typing “color yellow, chain A” in the command box.

Woah! This protein looks so pretty now! And look how its chain A has been marked in yellow! Awesome!

And voila! You’ve learned how to use the color keyword, just by using the help keyword! As we saw, using this command, we can just get out of any sticky situation or even use this command to learn how to use even more commands! How awesome is that!

Command 9- Saving your files and Snapshotting in PyMOL

These are some of the important things now. Once you’re done playing around with your files, you would obviously want to save your files for future reference, and this is how you can do it.

Saving your files -

This is a basic thing only, but sometimes it might just get difficult to know how to save your files (if it's your first time). Therefore, this command is simple, but useful my friend. Here’s how you save a PyMOL file.

Go to the File tab at the top of the PyMOL page. Here you will see options like save session, export molecule, export movie as, etc.

You have a couple of options for saving your work. Here are some of the important ones.

Get PDB: This generates a PDB file of all the molecules that you have in your final PyMOL window. This means if you’ve removed some solvent molecules from the protein, their data will not be included in the PDB that will be generated.

Save Session/Save Session As: This saves your whole session as a session file, and you can access it as a PyMOL file anytime, where you can continue to make changes and work on your protein. Your work gets saved as it is and you can continue from where you left off.

Export Image As: Using this option, you can save images of your protein. This is an alternative to the Ray/Draw option that we are going to learn about.

Export Movie As: Alternatively, we can also export the molecule and the protein structure as a movie/video, where our protein can be seen rotating around and moving on the screen. Sounds cool right? You gotta try it out!

Now that we know how to save our work, let’s move on to snapshotting a protein.

Snapshotting a protein in PyMOL -

Friends, we all absolutely love how beautiful protein structures are, how complex they are, how we admire them, and how complicated a biotechnologist’s life can often get, but if I wanna show my friend, my eventful journey with a protein, I need to show him pictures from the protein’s life.

So, here’s how you photoshoot a protein and make it model for you.

It’s easy. If you’ve seen the PyMOL page, you have an option on the right side of the page called Draw/Ray, and this is used to take snapshots of our protein.

When the dialog box for the Draw/Ray appears, put in the specifications, and use either Ray or Draw options. The Draw function is used for rendering images quickly, and the Ray option renders images slowly. The Ray option is supposed to give us high-def good quality images.

This is the image we got from the Draw option.

Whereas this is the image we obtained using the Ray function. The Ray option is clearly better and gives us publication-level images. Awesome!

Next time you have a publication to make, and you gotta snapshot a protein structure, you know what to do! Woohoo! Awesome!

Command 10- Aligning two proteins together to find the RMSD score

Now, sometimes, you might just have another protein that you want to align your protein to, or maybe, you’ve performed homology modeling on a particular protein, and you wanna check how well your model has been built, in either case, you can definitely use this command to check the RMSD score.

This is some really cool functionality that PyMOL provides us with! Just follow the steps below to use this functionality.

We will first find a protein similar in structure to our protein 6fey by performing a BLAST. We’ll go to the RCSB PDB page and type 6FEY, as we did earlier, go to the download files option, and this time we will download the FASTA sequence. Save the FASTA sequence in a text file on your system.

Now that we have the FASTA sequence, let’s go to the NCBI BLAST page and do a protein BLAST since the FASTA sequence we have is of a protein.

In the parameters for running the BLAST, choose the FASTA file we downloaded, in the Enter Query Sequence section, and give a Job title of 6FEY_similar_proteins. Choose Standard databases as the search set.

In the Standard option, choose Protein Data Bank proteins (PDB) from the dropdown, and choose blastp(protein-protein BLAST) in the Program selection. We could also change some parameters in the Algorithm parameters, however, for simplicity, we will keep all the Algorithm parameters default.

Once we have put in all of the required parameters, we will click on BLAST, and run it. Woohoo! It might just take a few minutes for the BLAST to run, and that’s all right, you just need to have some patience, haha.

Once you’re done running BLAST, you’ll get a table of this sort, that gives you the proteins similar to our protein 6FEY. Awesomeeee!

Have a look at the table, and you’ll find that the first protein in the list is 6FEY_A, which is our protein, and we want to choose a protein other than our protein, so we’ll choose the second protein, 4CBP_A as our similar protein.

Notice that, in the naming for the protein, 6FEY is named as 6FEY_A, where 6FEY is the name of the protein, and A refers to the chain A of the protein. Therefore, our protein is 4CBP, which we will fetch in the Python command. Awesome!

Type fetch 4CBP (see that fetch is not case sensitive) in the PyMOL command box to get the protein on your PyMOL visualizer.

fetch 4CBP

Looking at the protein, we can see that the protein has a lot of solvent molecules attached to it.

Removing solvent molecules-

These solvent molecules in a protein help it to maintain its structure, and hence they are also represented when you fetch a protein’s structure. However, we don’t need these solvent molecules for the alignment, and we will remove them using the remove solvent command.

remove solvent

Removing the solvent molecules makes our protein look much cleaner, and now we are ready for the alignment! Yay! Let’s go!

The alignment-

We’ve fetched both the proteins onto the PyMOL visualizer screen, and now we type the command align 6fey, 4CBP (type the exact name of the proteins, as given in the layer) in the PyMOL command box, to align both the proteins.

align 6fey, 4CBP

This is what the alignment looks like, and to get the RMSD score, you can look at the RMSD value given in the PyMOL console, just above the command box.

The final RMSD score for this particular alignment is 21.762, which means this isn’t a very good alignment. Good alignment RMSD values are closer to 0. The closer RMSD is to 0, the better the alignment is.

Now that we weren’t able to find a similar protein with lesser RMSD, we will go back to our BLAST Results Page and choose another protein to align and check the RMSD.

However, this part, I leave to you as an assignment, which you can complete and put in the comment box below, and we will meet in the next blog, where we discuss more awesome software like PyMOL. Till then, bye-bye!

And Lemme know whence you become a PyMOL master, sire! Till then, keep practicing!

To do more on PyMOL, refer to the following resources available online.

  1. https://pymol.org/pymol-command-ref.html
  2. https://pymolwiki.org/index.php/Main_Page
  3. https://pymol.org/2/

Congratulations on making it to the end! You’re a hard worker! Keep learning to work on new software every day! And thanks for reading!

Simple.Concise.Precise. That’s the motto.

Note from the Author: Hey there! How you doin’? Hope you enjoyed my writing! Let me know if you liked it! You can always write to me if you want me to write the manual for a particular software, give me a feedback, or even want to reach out regarding anything in general. I’ll be happy! Reach out to me at snippetsbio@gmail.com. Thank you!

--

--

The Bioinformatics Manual

If you're a biologist just starting out with bioinformatics, this is the best place you could be at! We discuss all heard & unheard bioinformatic software here!