Pymol_Tutorial_1. Complete Codes Used by PyMol in Generating High Quality Figures

PyMol is an important package for analyzing and generating publication-quality or high-quality images. After reading this tutorial, you will be able to generate simple ribbon diagrams with labels if required. Generating specific surface representation to your system and the last section is all about how to generate high-quality figures of protein and ligands. The current document is a basic tutorial and those who are already familiar with Pymol are advised to follow here. 


Before going to the following sections, you are required to load your PDB file, and change your display color to the one intended.

Display --- Background

How to read the below part, if you are new?

A sentence that starts with "#" is just an explanation of the code present in the very next line.

Pymol offers you two parts in the GUI interface, and you can use the below codes in any interface.

1. Tutorial on generating a ribbon diagram and adding labels:

# Load a protein structure

load protein_name.pdb

# Show the protein as a ribbon

show cartoon

#Tweek cartoon settings (Optional)

set cartoon_helix_length, 0.8

set cartoon_helix_width, 0.2

# Add labels to the amino acid residues (Optional)

label resi 10-20, "%s%i" % (resn,resi)

# Change the label font size

set label_size, 20

# Remove the shadow (Optional)

set ray_shadow, off

# Save the figure as a PNG file

png figure.png, width=800, height=600, dpi=300

# If the above code is not working, try this (you can increase or decrease the values)

ray 2400, 2400

# In case you have used the ray command, then to save your figure run the following command

png picture_name.png


2. Tutorial on generating a surface representation and coloring by electrostatic potential:

I assume that structure is loaded already.

# Show the protein as a surface representation

show surface

# Color the protein by electrostatic potential

color electrostatic, protein_name

# Set the range of the electrostatic potential

set range_ electrostatic, -10, 10

# Add a color bar legend

set color_negative, blue

set color_positive, red

set color_background, white

set color_label, "Electrostatic Potential (kT/e)"

set color_legend, on

# Save the figure as a PNG file

png figure.png, width=800, height=600, dpi=300


3. Tutorial on generating a cartoon diagram and highlighting a ligand:

I assume that structure is loaded already.

# Show the protein as a cartoon representation

show cartoon, protein_name

# Color the protein by secondary structure

color white, ss h

color yellow, ss s

# Highlight the ligand in the stick representation

show sticks, ligand

color green, ligand

# Add labels to the ligand atoms

label ligand and name CA, "%s%i" % (resn,resi)

# Save the figure as a PNG file

png figure.png, width=800, height=600, dpi=300

These are just a few examples of what you can do with Pymol. There are many more tutorials and features available in Pymol, so feel free to explore and experiment with different options to generate high-quality protein figures. Also, stay tuned, what other tricks you can perform with Pymol, will be discussed soon. 

Comments

Popular posts from this blog

Quick Start Tutorial of BioEdit Sequence Tool

The Hamming and Levenshtein or Edit Distances in Bioinformatics

Tips for Research Project Design