Skip to content

04.7 Command Line Tutorial

Chris Swain edited this page Apr 27, 2021 · 1 revision

4.7 Command Line Tutorial

1. Obtain your protein structure:

fetch 3uag

General format: fetch + “pdb code”

2. Remove a chain you are not going to work on (if applicable):

A protein’s chains are already defined in its pdb file, the chains will have a name denoted to them such as “chain A” or “chain B”. In the case of 3uag, the MurD protein only has one chain (chain A) in its crystal structure, so there is no need to delete or select chains. Thus, here we need to take another protein structure as an example: 1p3d (MurC ligase from H. influenzae crystalised with UMA, ANP) which has two chains (A&B) and is shown in cyan in the picture below.

Type in the following commands

fetch 1p3d obtain 1p3d pdb structure

remove chain B obtain 1p3d pdb structure delete the chain B from 1p3d structure

3. Hide water molecules for a better view of interactions (for unoptimised proteins):

Back to 3uag as you can see below, water molecules were shown as red crosses in the left-hand side figure and disappeared in the right-hand side figure after the commands were applied.

hide nonbonded hide water molecules from view; can also hide cartoons, ribbons, lines, etc

General format: hide “object”

4. Select the ligand and give it a system-recognised name:

In this case, UMA is the ligand that needs to be selected and named. The PyMOL system recognises the UMA ligand as “resi 450”. So we need to select UMA first by its residue name (a temporary name ”sele” will be given to the selection and it will appear on your right-hand side in the side menu) and then change its name to be “UMA” (“UMA” will appear in the side menu and will stay there forever unless you delete it).

1) 1-step strategy:

sele UMA, resi 450 “sele” is the abbreviation of “select”

“resi” means residue identifier, can be abbreviated as “i.”

General format: sele “new_name”, “object”

2) 2-step strategy:

sele resi 450 a temporary name “sele” is assigned to the selection (residue 450)

set_name sele, UMA rename the selection

General format: sele “object”; set_name “old_name”, “new_name”

5. Select and name the active site residues around the target substrate

As we have defined UMA with a name recognised by the PyMOL system, we can now move on to further explore the surrounding residues and define them as the active site residues. In the case of 3uag, We have chosen residues within a 5Å distance of UMA as the active site residues. If you only want to find strong interactions, such as H-bonding, a range between 1.5-3Å is suitable. However, you should choose a larger range (i.e. up to 5Å) to explore weaker interactions such as hydrophobic contacts.

Define all residues within distance of 5Å towards UMA as “UMA_activesite”:

sele UMA_activesite, br. all near_to 5 of UMA

General format: sele “new_name”, br. all near_to “distance” of “object”

“sele UMA_activesite” defines the name of the selection as “UMA_activesite”.

“br.” is the abbreviation of “byres”, “byres selection” means expand selection to complete residues.

“near_to” has the same functionality as “around”, meaning select things around the centre within a distance while the centre is not included. (Sometimes one of them may not work because of bugs, need to restart PyMOL or go with the leftover one).

“5” means “5 Å”; “UMA” has been defined in Step 4.

Specifically, if you want to visualise all of the UMA active site water molecules, type in the following syntaxes:

sele UMA_activewater, ( (UMA_activesite and chain A) around 3) and (resn HOH)

show licorice, UMA_activewater

General format: sele “new_name”, ( (“object” and “chain_x”) around “distance”) and (“residue name”); show licorice, “object”

“UMA_activewater” is the new name given to the selection (you can change it to whatever you like).

“UMA_activesite” has already been defined in the previous step, so you can use it directly here.

“chain A” represents the chain you are working on (can be replaced by chain B, C, D…any chain you like).

“around 3” means that your selections will be limited to the distance of 3 Å towards the centre object.

“resn” represents “residue name”; “resn HOH” means water molecules. “

“licorice” is a way of representation. “sticks” and “lines” are used frequently as well.

“UMA_activewater” has been defined already.

6. Colour anything you want:

Here we have two ways of colouring the UMA ligand and the surrounding residues.

1) basic colouring (fig a):

colour yellow, UMA

General format: colour “object”

2) colour by atom types (fig b & c):

util.cbay UMA

util.cbac UMA_activesite

General format: util.cba* “object”

“util” means utility control.

“cba****” means colouring by atom, and the default settings for atoms are as followings: oxygen (red), nitrogen (blue), hydrogen (white), manganese (purple)… Carbon atoms will have different colours depending on the commands (shown in Table 1)*

Table 1: A collection of “util.cba*” commands
util.cbag util.cbac util.cbam util.cbay util.cbas
Green cyan light magenta yellow salmon
util.cbaw util.cbab util.cbao util.cbap util.cbak
white/grey slate bright orange purple pink

7. Visualise active site residues in detail:

1) show line structures of active site residues (fig d):

show lines, UMA_activesite UMA_activesite will be shown in lines, “lines” is a way of representation

General format: show lines, “object”

2) show stick structures of active site residues (fig e):

show sticks, UMA_activesite UMA_activesite will be shown in sticks, “sticks” is another way of representation

General format: show sticks, “object”

8. Only show the active site:

As you might have found already, the ribbons/cartoons of the protein backbone can sometimes make it difficult to see the interactions at the binding site. Therefore, the following commands should help you to focus only on the active-site residues and the ligand. In the case of 3uag, UMA, UMA_activesite, UMA_activewater have been defined in the previous steps. The only thing left is the manganese cation, so we need to define it and make it visible. Here Mn^2+^ is recognised as “resi 1000” which can be found when viewing the sequence.

hide

show licorice, UMA

show licorice, UMA_activesite

show licorice, UMA_activewater

sele resi 1000

set_name sele, MN

show sphere, MN

“sphere” is a way of representation. “hide” is equivalent to “hide all”.

9. Get a general view of where the substrate is bound and where you should target:

show surface

You can also hide the surface if you want:

hide surface

For specific illustration of the active site:

The following sequence of code is an example of a script, which can be copied and pasted into the PyMOL command line. When scripts are entered into the command line PyMOL will execute each command individually (performing the entire sequence of commands) thus eliminating the need for you to type in each command separately.

show surface

colour white, all

util.cbay UMA

util.cbac UMA_activesite

show licorice, UMA

show licorice, UMA_activesite

show licorice, UMA_activewater

You can make many scripts such as the one above to quickly transform your pdb file into displaying the protein in a specific fashion. You can create scripts in a script compiler (e.g. text editor) and from there you can directly copy and paste the entire script into your PyMOL command line. This can help when making pre-made pdb files to view your docking results in (see section 4.3) and can drastically cut down the time to do a series of complex manipulations. Note – you will not be able to directly copy and paste a script from a pdf or word document into the command line (it will not work), but you can copy and paste the commands individually in this way.

10. Focus on the substrate in the active site:

zoom UMA

General format: zoom “object”

11. Illustrate interactions at the active site:

In the case of 3uag, only the polar interactions within 3Å were illustrated. But there are more options of visualising different types interactions as explained above.

dist interactions, UMA, UMA_activesite, 3, mode=2

hide labels

General format: dis “new_name”, “object1”, “object2”, “distance _cutoff”, mode=2

[note here: if “hide labels” was not applied, this function can be used for distance measurement between object1 and object2 and the distance will be visualised on labels]

“dist” creates a distance link between two selections.

“mode=2” means only show polar contact distances. There are several other modes (shown in table 2)

Table 2: A collection of “mode” commands
mode=0 mode=1 mode=2 mode=3 mode=4
all interatomic distances only bond distances only show polar contact distances like mode=0, but use distance_exclusion setting distance between centroids
mode=5 mode=6 mode=7 mode=8
pi-pi and pi-cation interactions pi-pi interactions pi-cation interactions

like mode=3, but cutoff is the ratio between

distance and sum of VDW radii

12. Add hydrogens to your ligand, water molecules and active site residues

You can select the residues, water molecules, or atoms of the ligand (which will give them a temporary name called “sele”) that participate in the visualised interactions in step 11 and then add hydrogen atoms to the structure to visualise interactions in detail. (Not necessary to do this in the unoptimised structures.)

h_add sele add hydrogen atoms to anything you select, in this case it is an atom

h_add UMA_activewater

General format: h_add “object”

13. Labelling your preferred residues:

In order to label a residue, you need to select one of its atoms (we would suggest selecting the central atom of that residue) and then type in the following commands to generate a label with the proper size and colour.

label sele, "%s:%s %s" % (resi, resn, name)

set label_size, 20

set label_color, white, sele

General format: label “selection”, "%s:%s %s" % (resi, resn, name); set label_size, “size_number”; set label_color, “colour_name”, sele

[note here: label_color must be American spelling otherwise it will not work]

14. Background settings:

bg_colour white

transparency = 0.5

General format: bg_color “colour_name”;

transparency = “number”

15. Generating an image:

png 3uag.png, height=1920, width=1920, dpi=300, ray=1

General format: png “new_name”, height=”height”, width=”width”, dpi=”pixel”, ray=1

"ray" creates a ray-traced image of the current frame, could be time-consuming Here “ray = 1” this means ray should be run first (the default is “ray = 0”).

“png” set the generated image format to png.

Clone this wiki locally