Basic notes and tutorials

33
Basic notes and tutorials This set of notes and tutorials are a collection of material from Warren DeLano, DeLano Scientific Gareth Stockwell, European Bioinformatics institute Arvind Varsani, University of Cape Town 13 th April 2005

Transcript of Basic notes and tutorials

Page 1: Basic notes and tutorials

Basic notes and tutorials

This set of notes and tutorials are a collection of material from

Warren DeLano, DeLano Scientific

Gareth Stockwell, European Bioinformatics institute

Arvind Varsani, University of Cape Town

13th April 2005

Page 2: Basic notes and tutorials

PyMOL: Basic notes and tutorials

2

Contents

1 Introduction .................................................................................................................................3

1.1 Obtaining Pymol _________________________________________________________3

1.1.1 Microsoft Windows3

1.1.2 Macintosh OS X ______________________________________________________4

1.1.3 Linux ______________________________________________________________4

1.1.1 IRIX and Solaris______________________________________________________5

1.1.4 Other Unix __________________________________________________________5

1.2 Capabilities______________________________________________________________6

2 The Basics.....................................................................................................................................8

2.1 The PyMol GUI __________________________________________________________8

2.2 Manipulating the View____________________________________________________10

2.2.1 Basic Mouse Control _________________________________________________10

2.2.2 Moving Clipping Planes_______________________________________________10

2.2.3 Changing the Origin of Rotation ________________________________________11

2.2.4 Getting Comfortable__________________________________________________11

2.3 PyMOL command language________________________________________________12

2.3.1 Filename Completion using TAB _______________________________________12

2.3.2 Reading / loading coordinate files _______________________________________13

2.3.3 Other important features_______________________________________________17

2.3.4 Selection ___________________________________________________________17

2.3.5 Settings ____________________________________________________________23

2.3.6 Ray tracing and images _______________________________________________24

2.3.7 Online help _________________________________________________________24

2.3.8 Other important notes_________________________________________________25

2.3.9 Scripts and log files __________________________________________________28

2.3.10 Hydrogen bonds _____________________________________________________28

2.3.11 Density Maps _______________________________________________________29

2.3.12 Movies ____________________________________________________________30

Page 3: Basic notes and tutorials

PyMOL: Basic notes and tutorials

3

1 Introduction

PyMOL is a molecular graphics system with an embedded Python interpreter designed for real-time visualization and rapid generation of high-quality molecular graphics images and animations. It can also perform many other valuable tasks (such as editing PDB files) to assist you in your research.

PyMOL was launched to create a viable alternative to high-priced commericial visualization software. Although many molecular viewers exist today, nearly all place some restriction on how, when, and where you can use them. PyMOL isn't like that -- it is designed to be as unrestrictive and useful as possible. Furthermore, because much of PyMOL is Open-Source, you can modify and extend the program to better meet your needs. PYMOL molecular graphics package is written by Warren DeLano.

In combination with other software, PyMOL (via Python) has the potential to evolve into a complete platform for crystallography, computational chemistry, modelling, and informatics. This will occur by folding in additional capabilities such as model building, energy minimization, conformational searching, simulation, and analysis.

With the advent of the Internet, there is no reason why we scientists should continue to be as dependent on high-priced commercial providers for our research software as we are today. Working together, we can build alternatives like PyMOL which are cost-effective, flexible, and able to meet our needs in a way no traditional commercial system could do.

1.1 OBTAINING PYMOL

It is available from www.pymol.org , with simple-to-install versions available for Windows, Mac, SGI and Linux platforms. Since the source code is available, it can in principle be run on any Unix system, as long as the OpenGL graphics library is installed.

April 3, 2004: PyMOL 0.95 has been released for all platforms. An official 0.95 release of the MacPyMOL Incentive Product for OS X is also available for download. New features include:

1.1.1 Microsoft Windows

Standalone PyMOL binaries for Windows provide the easist (one-step) installation.

1. Download and unzip pymol-0_97-bin-win32.zip. 2. Install PyMOL by clicking on "Setup.exe". 3. PyMOL can now be launched from the Start Menu.

If you already have Python installed and wish to use PyMOL with that external interpreter, then download and install the appropriate python-dependent binary instead: pymol-0_97-bin-win32-py21.zip pymol-0_97-bin-win32-py22.zip pymol-0_97-bin-win32-py23.zip

Page 4: Basic notes and tutorials

PyMOL: Basic notes and tutorials

4

1.1.2 Macintosh OS X

1.1.2.1 MacPyMOL Incentive Product

NOTE: MacPyMOL 0.97 has not yet been released -- use the hybrid version instead if you need the latest features...

MacPyMOL is a platform-specific enhancement of PyMOL for Mac OS X that includes extra features such as an Aqua port of the user interface, direct copy-and-paste of images, and automatic QuickTime movie export. It runs on Jaguar (10.2) and Panther (10.3).

Since MacPyMOL is an incentive product, PyMOL sponsorship via a current PyMOL subscription is required for research use of MacPyMOL, but you are welcome to try a free 90-day evaluation. Also note that subscriptions are optional for full-time students, for teaching, or when just viewing public or published data.

1.1.2.2 Mac OS X/X11 Hybrid Version

that you need Mac OS X 10.3 (Panther) with X11 installed in order to use it.

1. Download pymol-0_97-bin-osx-x11-hybrid.dmg.gz. 2. Double-click on the downloaded file to extract and open the disk image. If the ".dmg" file

does not open after downloading, try restoring the ".gz" extension after the ".dmg" and double-click again.

3. Copy the PyMOLX11Hybrid application on the disk image to the "Applications" folder on the System Disk.

4. Double-click /Applications/Utilities/X11 to launch X11 first. 5. Then double-click /Applications/PyMOLX11Hybrid to launch PyMOL.

1.1.2.3 Fink Version

The Fink version of PyMOL is another way to get PyMOL running on your Mac.

1.1.3 Linux

1.1.3.1 Dependency-Free Binary Version

This easiest-to-install and most compatible version of PyMOL for Linux.

1. Download pymol-0_97-bin-linux-libc6-i386.tgz 2. Extract the archive

tar -zxvf pymol-0_93-bin-linux-libc6-i386.tgz

to create a "pymol" directory

Page 5: Basic notes and tutorials

PyMOL: Basic notes and tutorials

5

3. Run the setup script

cd pymol ./setup.sh

4. Launch it

./pymol.com

1.1.3.2 RedHat RPM Packages (Requires "root" Access)

1.1.1 IRIX and Solaris

1. Download the binary for your system: pymol-0_97-bin-irix65-r10k.tgz pymol-0_97-bin-solaris-sun4u.tgz

2. Extract the archive into a location of your choice

gunzip < pymol-0_97-bin-irix65r10k.tgz | tar -xvf -

to create a "pymol" directory

3. Run the setup script 4. cd pymol

./setup.sh

5. Now try it

./pymol.com

NOTE: PyMOL on IRIX 6.5.18-6.5.21 requires patch 5316, which can be obtained from SGI.

NOTE: PyMOL on IRIX 6.5.18-6.5.21 requires patch 5316, which can be obtained from SGI.

1.1.4 Other Unix

1) Download the source: pymol-0_97-src.tgz. 2) Either configure PyMOL to use your existing external dependencies, or download and

compile from sources:

ext-0_95-src.tgz includes: Python-2.3.3 Numeric-22.0 Pmw-1.2 glut-3.7.6 tcl-8.4.6 tk-8.4.6 libpng-1.2.5

Page 6: Basic notes and tutorials

PyMOL: Basic notes and tutorials

6

zlib-1.2.1

3) Compile pymol (see INSTALL file for details).

1.2 CAPABILITIES

1) Optimized real-time 3D structure visualization.

2) Eight different molecular representations (lines, sticks, dots, mesh, spheres, ribbons,

cartoons, and surfaces (including dots [surface_type=1] & tri-mesh [surface_type=2])

3) Direct PDB downloading

4) Input of standard PDB, Macromodel, SDF, & MOL format files (including MOL2 and multi-

MOL2 file input), as well as "pickled" Chemical Python (ChemPy) objects.

5) Input of X-PLOR and CCP4 map files and generation of electron density isosurface meshes.

6) Merging and splitting of molecules using atom selections (much easier than editing files by

hand!).

7) Output of PDB and Macromodel files as well as pickled ChemPy models.

8) Support for real-time manipulation and rendering of Molscript cartoon ribbons (supplement

to above).

9) Support for distance measurement and arbitrary labels.

10) Front and back clipping planes, with optional depth cue/fogging and Mouse wheel control

clipping slab width and position.

11) Mouse driven manipulation of models and views.

12) Cartoons and spheres can be "picked" using the mouse.

13) A molecular editor enables click-and-drag changes to both conformation and chemical

structure.

14) Coarse interactive modelling using "molecular sculpting".

15) Crystallographic symmetry and display of unit cell box.

16) Automatic Python and command script generation via robust logging.

17) Transparent surfaces and spheres.

18) Point mutagenesis with rotamer library.

19) Optional POV-Ray integration and automatic script generation.

20) Display of "carved" electron density about an atom selection.

21) A built-in photorealistic ray tracer with anti-aliasing for Raster3D/PovRay-like quality.

22) Interactive command line with auto-completion, short-cuts, history, and inference logic.

23) A command language optimised for minimum keystrokes, but which maps into Python.

Page 7: Basic notes and tutorials

PyMOL: Basic notes and tutorials

7

24) Molecular superposition (fitting) capabilities, with on-the-fly sequence alignment (v0.80).

25) Concise hierarchical atoms selections "A/142/", "B//", "*/CB", "ILE/"

26) An algebraic atom selection language based on X-PLOR syntax, but with significant

shortcuts.

27) Execution of arbitrary operations over atom selections (trivial or programmatic).

28) Stereo display on high-end silicon graphics workstations and on some PCs.

29) A written manual and online help system.

30) A movie specification language enabling unattended batch movie generation of static and

dynamic movies.

31) Image input and output using libPNG ("png" format) -- use ImageMagick to convert to any

format.

32) Support for generic volume data, rendered using one or more solid (v0.80) or mesh

isosurfaces .

33) Batch mode for running jobs without a GUI.

34) Python support for two kinds of arbitrary graphics objects ("Compiled Graphics Objects" and

PyOpenGL).

35) Programmable OpenGL-based pop-up menus and OpenGL "developers" GUI.

36) Optional Tcl/Tk (Tkinter based) external GUI, also supports wxPython or your GUI of

choice.

37) An asychronous thread-safe Python programming interface (API) for extensiblity.

38) Modular, object-oriented design incorporating both Python and C components.

39) Presets (in the Action menu) provide common views very quickly.

40) Context-specific pop-up menus now direct actions to where you point.

41) Appearance wizard facilitates color and representation control.

42) Labels can be ray traced, with a few new fonts (label_font_id=0,1,2,3,4).

43) Numerous features and tweaks have been added.

44) Sequence viewer for sequence-based manipulation of 3D molecules.

45) Experimental vacuum electrostatic potential calculations for proteins (only).

46) Get view button copies matrix to clipboard automatically.

47) Display of aromatic bonds from SDF, MOL, and MOL2 files.

48) APBS interoperativity: PQR file input and output, DX file reading.

49) "surface_solvent" setting allows display of solvent accessible surfaces

Page 8: Basic notes and tutorials

PyMOL: Basic notes and tutorials

8

2 The Basics

2.1 THE PYMOL GUI

Figure 1 shows the main parts of the PyMOL window. The object list shows which objects are currently loaded; each object can be hidden by clicking on the bar containing its name. To the right of each object name are four buttons which (see Figure 2 for details) produce drop-down menus when clicked. The first allows you to perform basic actions on any one object (delete it, center the view on it, etc). The second is the 'show' menu, which turns on various representations (cartoon, wireframe, spacefill, etc). Conversely, the third menu is the 'hide' menu. The last controls the colour of each object.

By default, PyMOL comes with a single external GUI window which provides a standard menu bar, an output region, a command input field, and a series of buttons. One important advantage of the external GUI window is that standard "cut and paste" functions for text will only work within the External GUI, and not within in the PyMOL Viewer. Furthermore, you must use Ctrl-X, Ctrl-C, and Ctrl-V to cut, copy, and paste because a standard Edit menu has not yet been implemented.

Main PyMOL window

PyMOL external GUI window

Mouse commands

Movie controls

GUI menus

Object list

Main canvasCommand line

Main PyMOL window

PyMOL external GUI window

Mouse commands

Movie controls

GUI menus

Object list

Main canvasCommand line

FIGURE 1: Components of the PyMol external GUI and main windows

Page 9: Basic notes and tutorials

PyMOL: Basic notes and tutorials

9

FIGURE 2: GUI menus in the main PyMOL window

Page 10: Basic notes and tutorials

PyMOL: Basic notes and tutorials

10

2.2 MANIPULATING THE VIEW

In PyMOL, the mouse is the primary control device, and keyboard modifier keys (SHIFT, CTRL, SHIFT+CTRL) are used in order to modulate button behavior. A three button mouse is required for effective use of PyMOL, but common mice such as the Microsoft Intellimouse and Microsoft Wheel Mouse will work just fine under Windows.

2.2.1 Basic Mouse Control

On mice with a scroll wheel, you can push down on the wheel in order to use it as a middle button.

Here is a table of the basic mouse button/keyboard combinations for view manipulation:

An abbreviated version of this table, the Mouse Matrix, is always displayed in the Internal GUI, in order to help you remember which key and mouse button performs which action:

When using PyMOL on a laptop, it may be necessary to attach an external mouse or reassign the particular mouse controls you plan to use onto the reduced set of buttons that you have available internally (see reference on the "button" command).

2.2.2 Moving Clipping Planes

PyMOL's clipping plane control is somewhat unusual and may take a few minutes to get used to. Instead of having separate controls for the front and back clipping planes, controls are combined into

Page 11: Basic notes and tutorials

PyMOL: Basic notes and tutorials

11

a single mode where up down mouse motion moves the front (near) clipping plane and left right mouse motion controls the back (far) clipping plane.

The advantage of the PyMOL clipping plane control is that tedious tandem manipulations of the clipping planes now becomes easy through the diagonal motions shown below.

You can also use the "clip" command to control the clipping planes.

2.2.3 Changing the Origin of Rotation

When visualizing molecules, it is frequently necessary to change the origin of rotation so that you can inspect a particular region of the molecule. The fastest way to do this in PyMOL is to Control Shift Middle Click on a visible atom in the scene.

2.2.4 Getting Comfortable

At this point, we recommend that you spend five or ten minutes getting comfortable with the controls described in this chapter. Specifically, you should be able to accomplish the following tasks:

1. Load a PDB file into PyMOL. 2. Rotate, translate, and zoom the camera.

Page 12: Basic notes and tutorials

PyMOL: Basic notes and tutorials

12

3. Adjust the front and back clipping planes to clearly view a slice of the molecule. 4. Change the origin of rotation about any particular atom of interest.

2.3 PYMOL COMMAND LANGUAGE

While some simple functions are available via the GUI menus, most interaction with PyMOL is via a scripting language. This is superficially similar to that used in the RasMol viewer, but substantially more complex. The basic form of a command is a keyword, followed optionally by one or more comma-separated arguments. For example:

color red, hetatm

colours all non-protein atoms red. By contrast, the colour command can be used without the second argument

color red

in which case all atoms are coloured red. In most cases, the first argument is specific to the command being used (e.g. a filename for load/save, or a colour name for color), while the second, if specified, is the name of the object or selection to which the command should be applied.

The most commonly used commands are listed in table 1; for a full list, see the PyMOL manual. For simplicity, here not all optional arguments are listed, just the most commonly-used ones (shown between square brackets). Again, the official documentation is the place to look.

Table 1: Common PyMOL commands

Command Function

load Read in a data file. The file type is (usually) autodetected.

save Save coordinates to a file.

select Pick out atoms/residues from an object or existing selection

delete Delete an object

color Set colour of an object

show Turn on a particular representation type (e.g. cartoon, spacefill) for an object

hide Turn off a particular representation

set Alter a parameter (e.g. sphere size)

orient Center the view on a selection or object

distance Measure distance between two atoms, and draw a dashed line

2.3.1 Filename Completion using TAB

Some of the files you need to load into PyMOL may have long paths and filenames. PyMOL makes it easier to load such files by automatically completing unambiguous paths and filenames when you hit the TAB key. For instance,

Page 13: Basic notes and tutorials

PyMOL: Basic notes and tutorials

13

EXAMPLE

load cry # If "crystal.pdb" exists in the current directory,

hitting TAB will generate

load cystal.pdb

If there is some ambiguity in the filename, PyMOL will complete the name up to the point of ambiguity and then print out the matching files in the directory.

2.3.2 Reading / loading coordinate files

2.3.2.1 Using the External GUI Menu

The default external GUI provides a standard Open... item in the File menu which you can use to select the file you wish to open. It is important that you go into the right directory where your pdb files are located.

2.3.2.2 Using Commands

Example 1a

load <filename>

load data pen.pdb

The loaded coordinate file for Human paillomavirus capsid protein capsomer (pentamer) should appear on your screen as shown in Figure 3

Page 14: Basic notes and tutorials

PyMOL: Basic notes and tutorials

14

FIGURE 3: Image on the main canvas after loading pen.pdb file

Using the pull down menu on the right hand side of the main PyMOL window (H and S)

hide everything

explore the following features with the colour options (secondary structure [ss], chain)

show line show sticks show ribbon show cartoon

Also save each representation in different channels, to do this go to the PyMOL external GUI window and select

-scene -store -[F1-F12]

or use cmd scene F1, store

store these in channels F1-F4

Or using syntax type the commands

Page 15: Basic notes and tutorials

PyMOL: Basic notes and tutorials

15

hide everything show line show sticks show ribbon show cartoon

Then in the action pull down menu select the assign sec

Secondary structure should be assigned to all the chains.

store this is channel F5

Then select by chain in the colour pull down menus next to pen. You should get an image like that in Figure 4.

FIGURE 4: Cartoon representation of the HPV capsomer with assigned secondary structure and coloured by chain.

You can see the sequence of the protein and highlight and select regions

in the PyMOL external GUI window select sequence view in the display menu the sequence can be displayed as residue codes, residues, chains, atoms and states

Page 16: Basic notes and tutorials

PyMOL: Basic notes and tutorials

16

PLEASE TRY THESE OUT

More colour options are listed in the PyMOL external GUI window setting colors

You can render the chain differently. Type:

hide cartoon, chain a show ribbon, chain a set ribbon_width, 3

Store in channel F6

NOTE: The set command makes the ribbon more visible.

Similarly other representations can be used on the other chains

hide cartoon, chain b show spheres, chain b hide cartoon, chain c show sticks, chain c hide cartoon, chain d show surface, chain d

Store in channel F7

The end result of the above rendering will be as shown in Figure 5.

Page 17: Basic notes and tutorials

PyMOL: Basic notes and tutorials

17

FIGURE 5: Rendered representation of the HPV capsomer.

You can view the stored rendering in the various channels by using the F1-F12 keys on your keyboard. You can also rotate and further manipulate the object in these channels.

2.3.3 Other important features

2.3.4 Selection

2.3.4.1 Basic selection parameters/macros

Macros make it possible to represent a long atom selection phrase such as

select pept and lig and chain b and resi 142 and name ca

in a more compact form:

select /pept/lig/b/142/ca

Page 18: Basic notes and tutorials

PyMOL: Basic notes and tutorials

18

An atom selection macro uses slashes to define fields corresponding to identifiers. The macro is used to select atoms using the boolean "and," that is, the selected atoms must have all the matching identifiers:

/object name/segi identifier/chain identifier/resi identifier/name identifier

These identifiers form a hierarchy from the object name at the top, down to the name identifier at the bottom. PyMOL has to be able to recognize the macro as one word, so no spaces are allowed within it.

Macros come in two flavors: those that begin with a slash and those that don't. The presence or absence of a slash at the beginning of the macro determines how it is interpreted. If the macro begins with a slash, PyMOL expects to find the fields starting from the top of the hierarchy: the first field to the right of the slash is interpreted as an object name; the second field as an identifier to segi; the third as an identifier to chain, and so on. It may take any of the following forms:

/object name/segi identifier/chain identifier/resi identifier/name identifier /object name/segi identifier/chain identifier/resi identifier /object name/segi identifier/chain identifier /object name/segi identifier /object name

Examples

zoom /pept show spheres, /pept/lig/ show cartoon, /pept/lig/a color pink, /pept/lig/a/10 color yellow, /pept/lig/a/10/ca

If the macro does not begin with a slash, it is interpreted differently. In this case, PyMOL expects to find the fields ending with the bottom of the hierarchy. Macros that don't start with a slash may take the following forms:

resi identifier/name identifier chain identifier/resi identifier/name identifier segi identifier/chain identifier/resi identifier/name identifier object name/segi identifier/chain identifier/resi identifier/name identifier

Examples

zoom 10/cb show spheres, a/10 12/ca show cartoon, lig/b/6+8/c+o color pink, pept/enz/c/3/n

You can also omit fields between slashes. Omitted fields will be interpreted as wildcards, as in the following forms:

resi identifier/

Page 19: Basic notes and tutorials

PyMOL: Basic notes and tutorials

19

resi identifier/name identifier chain identifier// object name//chain identifier

zoom 142/ # Residue 142 fills the viewer. show spheres, 156/ca The alpha carbon of residue 156 is shown as a sphere

show cartoon, a// # Chain "A" is shown as a cartoon. color pink, pept//b # Chain "B" in object "pept" is colored pink.

Selection macros must contain at least one forward slash in order to distinguish them from other words in the selection language. Being words, they must not contain any spaces. When using macros, it is also important to understand that they are converted into long form before being submitted to the selection engine. This can help in the interpretation of error messages.

Examples 1b:

hide everything bg_color white show surface color white

before working with the examples below

select ///A/428 # Select residue 428 in chain A

color orange, sel01 #colour residue 428 orange

or color orange, ///A/428 #colour residue 428 orange

or in the sel01 menu choose the orange color #colour residue 428 orange

select ////261-280/CA # Select atoms called CA in residues 261-280 (anychain)

color blue, sel02 colour CA in residues 261-280 (anychain) blue

or as above

select ////430/C,N # Select atoms C and N in residue 430

color red, sel03 #colour atoms C and N in residue 430 red Might save as ////430/c

Store in channel F8

Page 20: Basic notes and tutorials

PyMOL: Basic notes and tutorials

20

FIGURE 6: Resulting image from example 1

Algebraic selections offer a bit more power, at the cost of slightly increased complexity. The idea here is to use terms (such as 'chain A', 'resn ALA'), which are combined using standard logical operators (AND, OR, NOT).

Example 2 (carried on with output from example 1):

select chain b

color cyan, sel04

select chain c and resi 428:465 # 'resi' specifies residue number

color yellow, sel05

select chain d

hide surface, sel06

color black, sel06

select resn PRO and name N # Select backbone nitrogens from proline residues

color magenta, sel07

select elem O and not name OH # Select all oxygen atoms except hydroxyls

color lime, sel08

Page 21: Basic notes and tutorials

PyMOL: Basic notes and tutorials

21

Store in channel F9

FIGURE 7: Resulting image from example 2

The keywords (chain, resn, resi) may be substituted with shorthands; the following are equivalent to the expressions above.

2.3.4.2 Selection with shorthands

Selections are enclosed in parentheses and contain predicates, logical operations, object names, selection names and nested parenthesis: ( [ [( ) }] )

name <atom names> n; <atom names> resn <residue names> r; <residue names> resi <residue identifiers> i; <residue identifiers> chain <chain ID> c; <chain ID> segi <segment identifier> s; <segment identifier> elem <element symbol> e; <element symbol> flag <number> f; <number> alt <code> numeric_type <numeric type> nt; <numeric type> text_type <text type> tt; <text type> hydrogen h; all * visible v; id <original-index> hetatm ss <secondary structure> around <distance> a; <distance>

Page 22: Basic notes and tutorials

PyMOL: Basic notes and tutorials

22

expand <distance> e; <distance> gap <distance> in <selection> like <selection> l; <selection> <selection> and <selection> <selection> & <selection> <selection> or <selection> <selection> | <selection> <selection> not <selection> <selection> ! <selection> <selection> and not <selection> <selection> & ! <selection> byres <selection> br; <selection> byobject <selection> bo; <selection>

Examples 1b (see page 18/19)

select (c;A and i;428) color orange, sel01 select (n;CA and i;261:280) color blue, sel02 select (n;C,N) and (i;430) color red sel03

Examples 2 (see page 19)

select (c;B) color cyan, sel 04 select (c;C and i;428:465) color yellow, sel05 select (c;D) hide surface, sel06 color black, sel06 select (r;PRO and n;N) color magenta, sel07 select (e;O and not n;OH) color lime, sel07

Similarly, the logical operators can be replaced with symbols:

Examples 1b (see page 18/19)

select (c;A & i;428) color orange, sel01 select (n;CA & i;261:280) color blue, sel02 select (n;C,N) & (i;430) color red sel03

Example 2 (see page 20)

select (c;B) color cyan, sel 04

Page 23: Basic notes and tutorials

PyMOL: Basic notes and tutorials

23

select (c;C & i;428:465) color yellow, sel05 select (c;D) hide surface, sel06 color black, sel06 select (r;PRO & n;N) color magenta, sel07 select (e;O & ! n;OH) color lime, sel07

2.3.5 Settings

Much of PyMOL's functionality is controlled by parameters which can be adjusted. For example, the size of spacefilling spheres generated by the 'show spheres' command is controlled by the parameter sphere_scale. This can be altered globally, for example

set sphere_scale, 0.5

or just for one object, e.g.

set sphere_scale, 0.5, protein_A

The list of parameters is huge, and is only partly documented on the PyMOL website. In order to see all available parameters, and change them quickly, the GUI interface can be used - from the menus on the external window, select

setting edit all

A list of the most useful settings is shown in the table 2.

TABLE 2:Common PyMOL settings

Setting Controls Type

antialias Whether antialiasing is used

during ray-tracing

boolean (0 or 1)

fog Extent of depth-cued fog float (0-1)

normalize_ccp4_maps Whether to normalise density

maps on loading

boolean (0 or 1)

sphere_scale Size of spacefilling spheres float (0-1)

sphere_transparency Transparency of spacefilling

spheres

float (0-1)

transparency Transparency of surfaces float (0-1)

Page 24: Basic notes and tutorials

PyMOL: Basic notes and tutorials

24

2.3.6 Ray tracing and images

One of PyMOL's most useful features is its built-in ray-tracing engine. At any point during use, simply typing

ray

ray-traces the current scene. In order to save the image as a PNG file, simply type

png <filename>

load pen.pdb color by chain show surface ray Important

ray tracing if on done for image in static position. Therefore important to get object in right orientation before ray tracing

png.[filename].png please make sure you are in the right directory to save the images.

store image in channel F10

Figure 8 shows the results before and after ray-tracing a protein surface. The use of the antialias setting greatly affects the quality of ray-tracing results - but also the time taken to perform the computation. Another parameter worth experimenting with is ray_trace_fog

while depth-cued fog can look nice in the raw image, it is sometimes a bit overpowering after ray-tracing.

FIGURE 8: Ray tracing with specular reflections

2.3.7 Online help

Help can be obtained while using the program simply by using the help command in conjunction with the name of the function on which you need help. For example, help show generates the screen showed in Figure 9.

Page 25: Basic notes and tutorials

PyMOL: Basic notes and tutorials

25

FIGURE 9: Displayed help options

2.3.8 Other important notes

1) High resolution images

ray 1600, 1200 png [imagename].png

2) To increase perspective (often best 150-200 but try 100-300)

set hash_max, 300 ray set hash_max, 275 ray set hash_max, 250 ray set hash_max, 225 ray

etc

Page 26: Basic notes and tutorials

PyMOL: Basic notes and tutorials

26

TUTORIAL 1

1. Load file 1L0T_sidechains 2. Colour code all the chains (a-f) 3. Assign secondary structure (based on crystal structure of HPV-16 L1) from the alignment

information in Figure 10 Secondary structure identifiers:

l loop h helix s beta sheet

NOTE: It is important to ask the software to rebuild the secondary structure profile after assignment/ alteration

FIGURE 10: Major capsid protein sequence alignments of nine HPV types from groups A7, A9 and A10. The secondary structural elements identified from the crystal structure of N-terminal truncated HPV-16 L1 ( N10L1) are shown above the sequence; -sheets are represented in blue and -helices in red. Basic residues that constitute the NLS are indicated in pink and the conserved cysteine residues 175 and 428 are indicated in yellow.

Here is an example on how to assign secondary structure details

1 27 38 41 49 68 78 95 109 ____ -B1____ __ -B2__ ____ -C____ ______ -D______

HPV-16 MSLWLPSEATVYLPPV.P.VSKVVSTDEYVARTNIYYHAGTSRLLAVGHPYFPI.KKPN.NNK.ILVPKVSGLQYRVFRIHLPDPNKFGFPDTSFYNPDTQRLVWACVGVEVGRGQPLGVGISGHPLLNKLDDTE HPV-35 ----rsn---------.s.-----------t---------s----------ya-.--qd.s--.-a-------------vk---------------d-as-------t--------------------------- HPV-31 ----r-----------.-.-----------t---------sa---t-----ys-.p-sd.-p-k-v-------------vr-----------------e----------l--------------------f---- HPV-33 --v-r-----------.-.-----------s--s---y--s-----------s-.-n-t.-a-kl--------------vr----------------------------l-i------------------f---- HPV-11 -..-r--ds---v--pn-.-----a--a--k----f---ss----------ys-.--v..-.-.tv------y-----kvv-------al--s-lfd-t--------t-l-----------v--------y--v- HPV-6 -..-r--ds---v--pn-.-----a--a--t----f---ss-----------s-.-ra..-.-.tv------y-----kvv-------al--s-lfd-t--------t-l-----------v----f---y--v- HPV-18 -a--r--dn------..-s-ar--n--d--t--s-f----s----t--n---rvpaggg.-.-.qdi----ay------vq--------l----i---e--------a---i---------l----fy------- HPV-45 -a--r--ds------..-s-ar-----d--s--s-f----s----t--n---rvvpngag-.-.qa-----ay------va--------l--sti---e----------m-i-------i-l----fy------- HPV-39 -am-rs-dsm-----..-s-a---n--d--t--g---y--s----t------kvgmngg.r.-.qdi----ay------vt-------si--a-l---e----------------------------y-rq---- CRPV -av--stqnkf----q.-.-t-ip------t---vf-y-ssd---t-----ye-rd-g....t.m------pn-------k-------a-g-kql-d-eke----clr-i--n-------svt-n-if--f--v- BPV1 -a--qqgq.kl----..tp----lcset--q-ks-f---e-e---ti----y-vsigak...t...-----an-----k-q-----q-al--rtvh--ske----pvi--q-s------gtvt---tf-a-l-a-

150 162 234 239 243 255 ____ -E______ __h1__ _____ -F_____

HPV-16 NASAYAANAG..VDNR.ECISMDYKQTQLCLIGCKPPIGEHWGKGSPCTNVAVNPG.DCPPLELINTVIQDGDMVDTGFGAMDFTTLQANKSEVPLDICTSICKYPDYIKMVSEPYGDSLFFYLRREQMFVRHLF HPV-35 -snk-vg-s-..t---.-----------------r----------t--nanq-ka-.e------l---l-----------------------d------s--------l---------m---------------- HPV-31 -snr--ggp-..t---.--------------l----------------s-n-it--.-------k-s------------------a--dt--n------n--------l---a-----t--------------f- HPV-33 tgnk-pgqp-..a---.--l-----------l-----t-------va---.-a.-an----------i-e----------c---k-------d--i---g-t------l--t----------f----------f- HPV-11 -sgg-gg-p-..q---vn.vg---------mv--a--l-------tq-s-ts-qn-.--------ts---------------n-ad--t---d------gtv------lq-aad----r------k----a--f- HPV-6 -sg.sgg-p-..q---vn.vg---------mv--a--l-------kq---tp-qa-.--------ts---------------n-ad--t---d--i---gtt------lq-aad----r---f--k----a--f- HPV-18 ss..h--tsnvse-v-.dnv-v--------il--a-a-----a--ta-ksrplsq-.-------k---le--------y-----s---dt-c-------q--------lq-sad-----m--c-----l-a-fw- HPV-45 s-..h--t-vitq-v-.dnv-v--------il--v-a-----a--tl-kpaqlq--.-------k--i-e--------y-----s---dt-c-------q--------lq-sad-----m--c-----l-a-fw- HPV-39 -sp.fssttn..k-s-.dnv-v--------i---v-a--------ka-kpnn-st-.-------v--p-e----i---y-----ga--et---------q--------lq-sadv----m--c-----l-a-fw- CRPV -ptk-yn-hadqq-y-.ksmaf-p--v--lml--v-at----aqakq-aedpp.qqt----i--v----e----cei------hk----sl-----elaq--s-----l--qkdqf---m---a-----ya--f- BPV-1 -vnrkvttqt..t-d-.kqtgl-a--q-il-l--t-ae--y-ttar--vtdrlen-.a------k-kh-e----mei----an-kein-s--dl----qne--l----l--aedaa-n-m--fa-k--vy---iw

300 304 311 314 327 337 342 348 360 382 384 _ -G1 -G2

___ -H1____ __ -H2_ ________ -I____________

___h2__

HPV-16 NRAGTVGENVPDDLYIKGS..G..STANLASSNYFPTPSGSMVTSDAQIFNKPYWLQRAQGHNNGICWGNQLFVTVVDTTRSTNMSLCAAIS.TS.ETTYKNTNFKEYLRHGEEYDLQFIFQLCKITLTADVMTY HPV-35 --------t--a------......t-gt-p-ts-----------------------------------s-----------------v-s-v-.s-.ds----d-------------------------------- HPV-31 --s-----s--t-------..-..---t--n-t----------------------m------------------------------v----a.n-.d--f-ss-----------f-------------s--i--- HPV-33 -----l--a----------..-..t--siq--af-----------es-l----------------------v-------------t--tqv..--.ds----e-----i--v-------v-----v----e---- HPV-11 --------p-----lv--g..n..nrssv---i-vh-----l-s-e--l--------k------------h--------------t---sv-.k-..a--t-sdy---m--v--f---------s---s-e--a- HPV-6 ----e---p---t-i----..-..nrtsvg--i-vn-----l-s-e--l--------k---------------------------t---svt.--..s--t-sdy---m--v------------s---s-e--a- HPV-18 -----m-dt--qs-----t..-..mr-spg-cv-s-s----i----s-l-------hk-------v--h---------------lti--stq.spvpgq-da-k--q-s--v------------t--------s- HPV-45 ----vm-dt--t------tsan..mretpg-cv-s-s----ii---s-l-------hk----------h---------------lt---stq.npvps--dp-k--q-s--v------------t-----e--s- HPV-39 --g-m--dai-aq-----t..d..ir--pg--v-c-s---------s-l-------hk----------h----l----------ft-sts-e.s-ips--dpsk----t--v------------tv---t---s- CRPV s---gdk---ksra---rtqmqgean--i-td--ci-----l-s--s-v--ra----k---m---v--d--i------n--g-il--vtkskeqikk-hg-tvh-ss----v---e---vl----vk--penls- BPV-1 t-g-sek-aptt-f-l-nnkgd...atlkip-vh-gs----l-st-n----r----f----m----a-n-l--l--g-n--g--ltisv-sdg-p.l-e-dssk-nv-h--m---k-a--le--svei-qtvsh-

393 395 402 414 429 446 452 462 473 504 ___

___h3___ _____ _h4 ______ __ -J__ _____h5_____ HPV-16 IHSMNSTILEDWNFGLQPPPGGTLEDTYRFVTSQAIACQKH.TP.PAPKEDPL.KKYTFWEVNLKEKFSADLDQFPLGRKFLLQAGLKAKPKFTLG..KRKAT.PTTSSTS.TT..AKRKKRK..L.. HPV-35 -----ps---------t---s--------y-----vt---p.sa.-k--d---.-n------d--------------------------r-n-r--..--a-p.as--kk-.s-..kr--.v-..s.. HPV-31 -----pa---------tt--s-s-------------t---t.a-.qk-----f.-d-v----------------------------yr-r---ka-..--..s.apsa--t.-p..-----t-..k.. HPV-33 --a--pd-----q---t---sas-q-----------t---t.v-.-ke-----g-.------d-----------------------------..-...--..a.ap--trt.ss..-----v-..k.. HPV-11 --t--psv--------s---n--------y-q----t---p.--.eke-q--y.-dms-----------se-------------s-yrgrtsart-i.--..p.a.v-kp-.-a..p---rt-t.k.k HPV-6 --t--psv--------s---n--------y-q----t---p.--.eke-p--y.-nls-----------se---y---------s-yrgrssirt-v.--..p.a.v-ka-.aa..p---ra-t.kr. HPV-18 ------s--------vp---tts-v------q-v--t---daa-.a.enk--yd-.lk--n-d------l----y-------v----rr--t..i-pr--.....sap-attsskp---vrvrark.. HPV-45 ------s---n----vp---tts-v------q-v-vt---dt--.-.e-q--yd-.lk--t-d------s----y-------v----rrr-t..i-pr--..paas--ta-tasrp---vrirskk.. HPV-39 --t---s--dn---ava---sas-v----ylq-a--t---d.a-a-.e-k--ydg.lk--n-d-r----le--------------rvrrr-t..i-pr--..paas---s-.a-k.h---rv.s.k.. CRPV l---hp--idn-qlsvsaq-s-----q--ylq-i-tk-pppep-..kent--y.-n-k----d-s--l-dq---y-------n-s--qrigt......--p-pa-vsivk-.....s---r-t..... BPV-1 lqglmpsv--n-ei-v---tssi------yie-p-tk-asnvi-...a----yag.fk--nid----l-l---------r--a-q-agcstv.....r--r....isqk--..skp--k--k......

Page 27: Basic notes and tutorials

PyMOL: Basic notes and tutorials

27

alter 1-10/, ss='l' alter 10-15/, ss='s' alter 16/, ss='l' alter 17-22/, ss='h' alter 23-33/, ss='s' alter 34-40/, ss='l' alter 41-50/, ss='s' alter 51-55/, ss='l' rebuild

4. Have a look at the secondary structure assignment. 5. Change color of the whole pdb file output to black and set the background white 6. color the secondary structure elements in different colours

color <colour>, ss <secondary structure identifier> 7. save the image (please get a beautiful view of protein) using the command

png <image name>.png NB: make sure you are in the right directory or at least know where the portable network graphics (png) file will be saved.

8. Ray trace the image using the command ray NB:please make use you do not more the image in the main canvas after ray tracing as you will loose the ray tracing.

9. Save the ray traced image and compare to the non ray traced image in terms of beauty/prettiness!

10. Colour chains a-e with one color and chain f with another 11. Render the object by surface 12. Select the following residues and color them differently

174-186 131-143 431-443 414-426 81-93 175 and 428

13. Orient the image such that it head first as shown below

14. ray trace and save image 15. get side and bottom views of the rendered protein using the rotate command as follows

rot x, 90 #rotates -90 degrees on the x axis ray trace images and save them FYI

Page 28: Basic notes and tutorials

PyMOL: Basic notes and tutorials

28

move x, 10 #moves the object along the x axis by 10 units move z, 10 #zooms out by 10 units move z, -10 #zooms in by 10 units

therefore these commands can be added into scripts to generate an output with specific orientation.

2.3.9 Scripts and log files

A PyMOL script is just a text file, such as a log file, containing typed PyMOL commands separated by carriage returns. When a script is loaded into PyMOL the commands it contains are executed. PyMOL expects scripts to have ".pml" file name extensions (this is not strictly required, but it is good practice).

You can use log files as scripts, and you can create scripts in a text editor such as emacs, jot, or notepad. It's often useful to keep a text editor open in a separate window while using PyMOL. Commands can then be cut and pasted between the two programs.

You can open a new log file by typing log_open log file name, or by clicking on "log" under the "File" menu and naming the log file in the dialog box. You can also append commands to an existing log file by choosing "append" or "resume" in the "File" menu. When you "resume" rather than "append," the existing log file is first loaded as a script, and then subsequent commands are written to it.

Once you have opened a log file in any of these ways, PyMOL will write and save all your commands, whether they are typed or given by clicking on the buttons in the GUI. However, to store the orientation of a molecule into a log file, you need to give the command get_view (type it or use the GUI button). You may find it convenient to get_view several times in a PyMOL session, and then edit the log file to select the most useful views.

Scripts can be executed in several ways. Under Windows, scripts can be run in a new PyMOL session by double clicking on the script's icon. Alternatively, you can run a script using the "File" menu's "Run" option. PyMOL also understands "@" as the typed command that loads a script:

pymol <script file name.pml>

or @<script file name.pml>

TUTORIAL 2

Write a script that will carry out the whole tutorial 1 for you and execute it to see if it works.

2.3.10 Hydrogen bonds

(From Gareth Stockwell)

TUTORIAL 3

Page 29: Basic notes and tutorials

PyMOL: Basic notes and tutorials

29

Load pdb file pdb1a30 # Load in a molecule (HIV protease complexed with a

tripeptide inhibitor)

hide everything # Hide everything

show cartoon # Show cartoons for the protein, colouring the two chains differently

color lime, chain A color pink, chain B

select inhib, chain C # Select the inhibitor show sticks, inhib color red, inhib

select bs, (byres inhib expand 4 & !inhib) # Select the binding site # The 'byres' keyword expands the proximity selection to consist of whole residues show lines, bs

show nb_spheres, bs # Render water molecules which are in the binding site

distance hb1, ///C/508/N, ///A/27/O # Add some dashed lines to represent the hydrogen bonds

distance hb2, ///A/29/N, ///C/506/O distance hb3, ///C/506/N, ///A/29/OD2 distance hb4, ///C/507/N, ///A/48/O

distance hb5, ///C/506/N, ////1076/O # The following h-bond is to a water molecule

hide labels # These commands clear the distance labels from the h-bonds

label (bs &n;ca), "%s-%s-%s" % (chain,resn,resi) # Label the residues in the binding site # The first argument specifies which atoms are to be labelled - here, we specify only C-alpha atoms, so that each residue gets just one label. # The second argument specifies the format of the label, in a pseudo-print format

2.3.11 Density Maps

(From Gareth Stockwell)

PyMOL provides support for loading and contouring density maps, in either CCP4 or X-PLOR format. In order to load in a map, simply use the 'load' command, e.g.:

1lza.ccp4 This one is from a crystallisation experiment on lysozyme (PDB ID 1lza). A contoured isosurface can then be generated using the 'isomesh' command, which takes three arguments:

Page 30: Basic notes and tutorials

PyMOL: Basic notes and tutorials

30

the name of the surface object to be generated

the name of the map object,

the contour level.

By default, maps are normalised when they are loaded, so the contour level is in 'sigmas' - i.e. number of standard deviations above the mean value.

isomesh mesh, 1lza.ccp4, 2

If we now load in the coordinate file which is deposited in the PDB, we can see how well it fits the density map

load pdb file pdb1lza hide lines show sticks, pdb1lza

TUTORIAL 4

load pdb file: pdb1lza # Load in a PDB file (lysozyme)

util.cbaw # Set normal CPK colours and render as sticks so we can see the coordinates through the mesh

show sticks, pdb1lza set normalize_ccp4_maps, 1 # Load in the electron density map (CCP4 format) load 1lza.ccp4 # This was obtained from the Uppsala Electron Density

server http://fsrv1.bmc.uu.se/eds/ # First we make sure that map normalisation is turned on - this means that we can contour at sigma levels (rather than absolute values)

isomesh mesh, 1lza.ccp4, 2.0 # Contour the map at 2.0 sigma across the whole cell color green, mesh

select res, ////87 # Select one residue - ASP 87

isosurface surf, 1lza, 1, res, carve=2 # Create an isosurface at 1.0 sigma, just in the vicinity of this residue # (only in a region with 2 angstrom of the selected residue)

set transparency, 0.5 # Make the isosurface semitransparent

move z, -20 # Zoom out a bit so we can see it better

2.3.12 Movies

(From Gareth Stockwell)

Page 31: Basic notes and tutorials

PyMOL: Basic notes and tutorials

31

PyMOL can be used to generate movies, using a few simple commands. The output of movie generation in PyMOL is a series of frames, written out in the PNG image format. In order to generate a movie from them, an external program is required to encode the series of frames into an appropriate format (e.g. MPEG or AVI).

Generating the frames themselves is fairly straightforward. Ready-made functions are provided for generating common sequences, such as rotation about one of the principle axes. There are three steps required to make a movie in PyMOL:

2.3.12.1 Reserve space for the frames

After loading in the molecule, execute the following command to reserve space for N frames:

mset 1 xN

2.3.12.2 Generate each frame in the sequence

In order to generate a full 360-degree rotation around the y-axis, over N frames, execute

util.mroll(1,N,1)

Alternatively, this step may be something more involved, such as reading in the results of a molecular dynamics trajectory or a docking simulation. Or, in order to create something more complex than a simple rotation, some Python code could be used here.

2.3.12.3 View the results

In order to play the movie in PyMOL, either click on the play button in the VCR-like controls in the main window, or use the mplay command. To output the movie frames as a series of PNG images, type

mpng filename_root

This will generate a series of files called filename_root0001.png, filename_root0002.png, etc.

TUTORIAL 5

Load the file 1L0T_sidechains mset 1 x120 # Reserve space for 120 frames set ray_trace_frames, 0 # Make sure that ray-tracing is turned off for movie

generation - otherwise, this would take a LONG time util.mroll(1,120,1) # Use a built in utility function to generate a full 360-

degree rotation round the y-axis, over 120 frames mplay # Play the movie

Page 32: Basic notes and tutorials

PyMOL: Basic notes and tutorials

32

Page 33: Basic notes and tutorials

This document was created with Win2PDF available at http://www.daneprairie.com.The unregistered version of Win2PDF is for evaluation or non-commercial use only.