Biochemistry student intro: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(Added movie for 1lev)
 
Line 142: Line 142:


=== Movie of 1LEV ===
=== Movie of 1LEV ===
File: '''1lev_movie.pml'''
File: '''1lev_movie.pml'''<br>
Note, you need the '''movie.pml''' file in same directory, see [[Biochemistry_student_intro#By_a_movie_file]].
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
fetch 1lev, async=0
fetch 1lev, async=0

Latest revision as of 07:02, 17 May 2014

Biochemistry course

This tutorial was written directly for biochemistry students at Copenhagen University, 2012/2013.

This is the very first introduction to the powerful molecular visualizer PyMOL.
We will only cover the very basic steps to get a image of your enzyme and put in your written student article.

If you want to read about PyMOL, then try this introduction Practical_Pymol_for_Beginners

Install PyMOL to your computer

You first want to install PyMOL.
Do this, by following this guide.

Windows

Windows Pre-compiled_PyMOL. Consider this little nice texteditor: Notepad++

mac

pymol for mac. Download and install MacPyMOL-v1.3r1-edu.tar.bz2

Extending pymol

You don't have to follow the steps of extending PyMOL, but if you are a little technical, and want to become friends with PyMOL over time, then consider it.

Find a suitable protein data file

We need to find a Protein Databank File (PDB), which describe the x,y,z coordinates of your enzyme.
These are stored at the homepage: http://www.rcsb.org
Find a suitable file by searching for: porcine kidney fructose 1,6-bisphosphatase
The PDB file 1LEV, seems suitable.

Read more about your protein

There exist homepages, to get more info about your protein.
These homepages collect material from several sources, and present them in easy format.

http://www.proteopedia.org/wiki/index.php/1lev
http://pdbwiki.org/wiki/1lev

Background

This tutorial is designed to give you a basic working knowledge of making pretty and informative pictures of protein structures using PyMOL.
This tutorial does not cover all the functions of PyMol, but tries to focus on the most important ones.
A great resource for more advanced use is this wiki and the large number of good tutorials found online, which can be accessed via google.

When you open PyMOL you will see two windows opening.
The upper window entitled PyMOL Tcl/Tk GUI controls the general settings and functionalities of the program while the lower one entitled PyMOL viewer, contains the settings that are related to the current display of the molecule.
Each of these two windows contain a command line, where we can enter commands into the program.
One can, however, get really far without ever having to worry about writing any commands.

First, we will need to load a structure file into the program. Protein structures are deposited at www.pdb.org
There are several ways to open this file:
Either we can download the file from PDB and save it to our computer.
We can then open the PDB file (if you have it on the harddisk) using the menu File > Open.
or we can write: fetch followed by the PDB id in either of the two command lines. Ex: fetch 1LEV
The Viewer window should now contain the PDB file displayed with lines.

In the right hand side of the viewer window there is a selection menu that currently contains two lines:
all and the four character name of the PDB file, ex. 1lev.
Later on we will make new selections that will appear in this menu.
Each of the two lines have 5 buttons labeled A (Actions), S (Show), H (Hide), L (Label), C (Color).
Press these buttons to see the options available in each menu.

Hide the line representation. Press H > everything in the all line. This will remove the line representation of the molecule.
Visualize the molecule in the cartoon representation by selecting S > cartoon.
Try also to show the molecule as ribbon, sticks or surface to get a feeling for the different representations.
The cartoon option gives us the best overview of the overall structure, so hide the other representations and show the protein only in cartoon mode.
Color everything white selecting C > grey > white.

Ok, now we are going to try to move the molecule around.
Try to move the mouse around while pressing the left mouse button. This will rotate the molecule.
Try to move it around holding the middle button (moves the view) or the right button (zooms in and out).
If you have a one or two button mouse you can change the mode in the Mouse menu in the Tcl/Tk GUI window.
The box in the lower right corner will show how to move and rotate the molecule in this case.

Start your PyMOL

Start your shortcut to PyMOL "C:\Python27\PyMOL\PyMOL.exe"

Now click and do the following:

  1. Write in command line: fetch 1lev
  2. Right Menu: -> 1lev -> "A" -> preset -> Publication
  3. Top Menu: Display -> Sequence
  4. Top Menu: Display -> Sequence Mode -> Chains
  5. In Sequence, select so all "F" is marked.
  6. Right Menu: -> (sele) -> "A" -> remove atoms. (1LEV is crystallized in dimer formation. So we only need to view 1 chain)
  7. Top Menu: Display -> Sequence Mode -> Residue Codes
  8. In Sequence, select so only substrate (F6P) is marked (A/338)
  9. Right Menu: -> (sele) -> "A" -> zoom
  10. Right Menu: -> (sele) -> "A" -> rename selection -> f6p
  11. Right Menu: -> (f6p) -> "C" -> by element -> Select to Carbon is not green
  12. Right Menu: -> (f6p) -> "A" -> find polar contacts -> to others excluding solvent
  13. In Sequence, select so only MN is marked (A/340)
  14. Right Menu: -> (sele) -> "A" -> rename selection -> mn
  15. Right Menu: -> (mn) -> "S" -> spheres
  16. Write in console: select act_site, byres f6p around 3.5
  17. Right Menu: -> (act_site) -> "S" -> sticks
  18. Right Menu: -> (act_site) -> "L" -> residues
  19. Top Menu: Display -> Background -> White
  20. Find a good view, and push "Ray" in the top right of the grey command console.
  21. Top Menu: File -> Save Image As -> PNG
  22. Put it into your student article

The "Faster" way

The real power of PyMOL, comes into power, when your write a PyMOL command file.
Here you write which commands pymol should execute, and so it only take 1 second to get the same.
The commands are stored in a ".pml" file.

Open Notepad, and then: File->Save as->All files-> C:\Users\YOU\pymol\1lev.pml

# Best to restart PyMOL every time from fresh
reinitialize
cd C:\Users\DIG\pymol

fetch 1lev, async=0
preset.publication(selection='all')
remove chain F
select substrates, organic
select f6p, resn F6P
zoom f6p
util.cbac('f6p')

select act_site, byres f6p around 3.5
show sticks, act_site

distance pol_cont, f6p, act_site, mode=2

select cli, /1lev//A/CLI # OR: select cli, resn CLI
select mn, name MN # OR: select mn, symbol Mn # OR: select mn, inorganic
show spheres, mn

label act_site and name CB, resn+resi

zoom pol_cont
viewport 1024,768
bg_color white
ray
png 1lev.png
  1. "#" Line starting with hashes is not read by PyMOL. Use a comment field.
  2. Best to restart PyMOL every time from fresh
  3. Go to your working directory
  4. Get the pdb file from the RCSB server. async=0 makes sure it waits for completion of download before continuing.

Then you just open the .pml file with PyMOL.
Or start PyMOL, and write in command: @1lev.pml
Or start PyMOL, top menu -> File -> Run... -> C:\Users\YOU\pymol\1lev.pml

Movie of 1LEV

File: 1lev_movie.pml
Note, you need the movie.pml file in same directory, see Biochemistry_student_intro#By_a_movie_file.

fetch 1lev, async=0
preset.publication(selection='all')
remove chain F
select substrates, organic
select f6p, resn F6P
zoom f6p
util.cbac('f6p')
 
select act_site, byres f6p around 3.5
show sticks, act_site
 
distance pol_cont, f6p, act_site, mode=2
 
select cli, /1lev//A/CLI # OR: select cli, resn CLI
select mn, name MN 
# OR: select mn, symbol Mn # OR: select mn, inorganic
show spheres, mn
 
label act_site and name CB, resn+resi
 
zoom pol_cont
viewport 1024,768
bg_color white

###### Movie
# Reset
hide sticks, act_site
disable pol_cont
disable cli
hide spheres, mn
disable mn

zoom 1lev
scene F1, store, Publication

zoom substrates
scene F2, store, substrates
 
zoom f6p
scene F3, store, f6p
 
show sticks, act_site
enable pol_cont
show spheres, mn

zoom pol_cont
scene F4, store, polar contacts

@movie.pml
#ray
#png 1lev.png

Movie of Epidermal Growth Factor

Lets make a movie of the Molecule of the month on RCSB.org.
Let's take a membrane protein, 1nql@rcsb, pdbwiki, proteopedia
June 2010 Molecule of the Month by David Goodsell

Open Notepad, and then: File->Save as->All files-> C:\Users\YOU\pymol\1nql.pml

reinitialize

fetch 1nql, type=pdb1, multiplex=1,async=0

# So we get buttons for scenes
set scene_buttons, 1
viewport 1280,800
bg_color white
set fog_start, 0.60

#### Scene 1, publication ####
show_as cartoon, all
preset.publication(selection='all')

# See http://pymolwiki.org/index.php/Single-word_Selectors
extract substrates, organic
util.cbac('substrates')
select others, inorganic
select water, solvent
# See http://pymolwiki.org/index.php/Selection_Macros
# Select organic molecules
select nag, ////NAG
select bma, ////BMA
disable bma
# Hide organic
hide everything, substrates

# Save scene 1

zoom 1nql
scene F1, store, Publication

#### Scene 2, show cysteines ####
# Select sulfurs, since they play a role
select sulf_cys, resn cys and not (name O or name N or name C)
disable sulf_cys
show sticks, sulf_cys
color sulfur, sulf_cys and elem S
set_view (\
     0.351475894,    0.052040517,    0.934747040,\
    -0.784766018,   -0.528064251,    0.324480295,\
     0.510492086,   -0.847605526,   -0.144762829,\
     0.000000000,    0.000000000, -258.137542725,\
    47.065788269,  -10.656063080,    0.561561584,\
   217.718627930,  298.556427002,  -20.000000000 )
scene F2, store, Cysteines

#### Scene 3, show organis ####
show sticks, substrates
set_view (\
    -0.350075662,   -0.229279995,   -0.908223689,\
     0.627038240,    0.662946343,   -0.409051389,\
     0.695891201,   -0.712693632,   -0.088314489,\
    -0.000047103,    0.000066929, -180.624176025,\
    29.827386856,   19.096229553,   14.554395676,\
   144.383483887,  216.888458252,  -20.000000000 )
scene F3, store, substrates

#### Scene 4, polar contacts ####
select prot_cont, byres substrates around 3.5
distance subs_bond, substrates, prot_cont, mode=2
show sticks, prot_cont
set_view (\
    -0.564916074,    0.749067366,    0.346062332,\
     0.049069319,   -0.388159811,    0.920283496,\
     0.823683023,    0.536867142,    0.182521686,\
     0.000190482,   -0.000248071,  -91.693801880,\
    25.880264282,   29.162174225,   10.565655708,\
    55.450801849,  127.955612183,  -20.000000000 )
scene F4, store, polar contacts

#@movie.pml

GUI - Scene loop

  1. Click Movie->Program->Scene Loop->Steady->Program->4 seconds each
  2. Click the Play button at the lover right corner. Or write mplay.
  3. Click Movie->Reset
  4. Try also the other Scene Loop method.

GUI - Camera loop

  1. Click Mouse-># Button Motions. In the selection menu, under all, you now have a M button!.
  2. Movie->Reset
  3. Click F1
    1. sel. menu all-[M]->Store with scene F1
    2. Movie->Program->Camera Loop->Y-Roll->4 seconds
    3. Movie->Append->2 seconds
    4. Click lower right Full forward button ->
  4. Click F2
    1. sel. menu all-[M]->Store with scene F2
    2. Movie->Program->Camera Loop->X-Rock->60. deg. over 4 sec.
    3. Movie->Append->2 seconds
    4. Click lower right Full forward button ->
  5. Click F3
    1. sel. menu all-[M]->Store with scene F3
    2. Movie->Program->Camera Loop->X-Roll->4 seconds
    3. Movie->Append->2 seconds
    4. Click lower right Full forward button
  6. Click F4
    1. sel. menu all-[M]->Store with scene F4
    2. Movie->Append->1 seconds
    3. Click lower right Full forward button
    4. sel. menu all-[M]->Store with scene F4
    5. Movie->Program->Camera Loop->Nutate->30. deg. over 8 sec.
    6. Movie->Append->4 seconds
    7. Click lower right Full backward button

Play

By a movie file

Open Notepad, and then: File->Save as->All files-> C:\Users\YOU\pymol\movie.pml

set movie_panel, 1
mset 1 x1000

scene F1
python

f=1
cmd.frame(f)
cmd.mview("store",scene="F1")
f=f+99; print f
cmd.frame(f)
cmd.mview("store",scene="F1")

f=f+49; print f
cmd.frame(f)
cmd.mview("store",scene="F2")
f=f+99; print f
cmd.frame(f)
cmd.mview("store",scene="F2")

f=f+49; print f
cmd.frame(f)
cmd.mview("store",scene="F3")
f=f+99; print f
cmd.frame(f)
cmd.mview("store",scene="F3")

f=f+49; print f
cmd.frame(f)
cmd.mview("store",scene="F4")
f=f+99; print f
cmd.frame(f)
cmd.mview("store",scene="F4")

f=f+49; print f
cmd.frame(f)
cmd.turn('y',50)
cmd.mview("store")

f=f+99; print f
cmd.frame(f)
cmd.turn('y',-100)
cmd.mview("store")

f=f+49; print f
cmd.frame(f)
cmd.turn('y',50)
cmd.mview("store")

f=f+49; print f
cmd.frame(f)
cmd.mview("store",scene="F4")

python end

frame 1
mplay

Write in pymol: @movie.pml

Movie of Potassium Channel KcsA-Fab complex in high concentration of K+

Let's take another membrane protein, 1k4c@rcsb, pdbwiki, proteopedia

Open Notepad, and then: File->Save as->All files-> C:\Users\YOU\pymol\1k4c.pml

reinitialize

fetch 1k4c, type=pdb1, multiplex=1,async=0

# So we get buttons for scenes
set scene_buttons, 1
#viewport 320,200
bg_color white
set fog_start, 0.60

#### Scene 1, publication ####
group 1k4c, 1k4c_* 
preset.publication(selection='1k4c')

# See http://pymolwiki.org/index.php/Single-word_Selectors
extract substrates, organic
util.cbac('substrates')
extract ions, inorganic
show spheres, ions
disable ions

extract water, solvent
show nonbonded, water
color grey, water
disable water
# See http://pymolwiki.org/index.php/Selection_Macros
# Select organic molecules
# Hide organic
hide everything, substrates

# Save scene 1
zoom 1k4c
scene F1, store, Publication

#### Scene 2, show cysteines ####
# Select sulfurs, since they play a role
util.cbag('1k4c_0001')
util.cbao('1k4c_0002')
util.cbas('1k4c_0003')
util.cbaw('1k4c_0004')

select sulf_cys, resn cys and not (name O or name N or name C)
disable sulf_cys
show sticks, sulf_cys
color sulfur, sulf_cys and elem S
color red, sulf_cys and not elem S
set_view (\
     0.443872631,   -0.125126541,    0.887310863,\
     0.892753899,   -0.023616746,   -0.449926227,\
     0.077252157,    0.991857469,    0.101223812,\
     0.000020482,   -0.000164529, -253.516693115,\
   164.839996338,  190.414398193,   -7.539838314,\
   168.313964844,  338.728668213,  -20.000000000 )
scene F2, store, Cysteines

#### Scene 3, show organis ####
show sticks, substrates
set_view (\
    -0.975404024,    0.029795930,   -0.218399704,\
    -0.214692041,    0.096028417,    0.971945703,\
     0.049933217,    0.994929075,   -0.087270327,\
     0.000279146,   -0.000071049, -226.327316284,\
   160.358612061,  152.090927124,  -33.061843872,\
   141.134780884,  311.549621582,  -20.000000000 )
scene F3, store, substrates

#### Scene 4, polar contacts ####
select prot_cont, byres 1k4c_* within 3.5 of (substrates or ions)
util.cbay('prot_cont') 
distance subs_bond, substrates, prot_cont, mode=2
show sticks, prot_cont
enable ions
set_view (\
    -0.961359501,   -0.272781283,   -0.037127689,\
    -0.273679018,    0.961574137,    0.021663748,\
     0.029792555,    0.030986462,   -0.999071598,\
     0.000279146,   -0.000071049, -226.327316284,\
   160.358612061,  152.090927124,  -33.061843872,\
   141.134780884,  311.549621582,  -20.000000000 )
scene F4, store, polar contacts

#@movie.pml

Export movies

Write in command

frame 1

Then go to File->Save Movie As -> MPEG
It takes a little time, 5 min. Be patient.


You can also export it like PNG images, and then collect them.
Then go to File->Save Movie As -> PNG Images

If you wan't to have a really nice movie, you want to have all images ray-traced. Then do

set ray_trace_frames, 1

But note, this takes a looong time, so wait until you are SURE that you have the final movie. Try first to make and collect a video without.

Collect images and create movie in "Windows Live Movie Maker"

Start or install Windows Live Movie Maker

  1. Add all images from folder
  2. Ctrl+a to select all images
  3. Click in tab "Edit", set Duration to: 0,03
  4. Click in tab "Home", "Save movie", "Windows Phone (large)"

You are done

See Also