This is a read-only mirror of pymolwiki.org
Difference between revisions of "Biochemistry student intro"
m (2 revisions) |
|||
(62 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== Biochemistry course == | == Biochemistry course == | ||
− | This tutorial was written directly for biochemistry students at Copenhagen University, 2012.<br> | + | This tutorial was written directly for biochemistry students at Copenhagen University, 2012/2013.<br> |
This is the very first introduction to the powerful molecular visualizer PyMOL.<br> | This is the very first introduction to the powerful molecular visualizer PyMOL.<br> | ||
Line 7: | Line 7: | ||
If you want to read about PyMOL, then try this introduction [[Practical_Pymol_for_Beginners]] | 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. <br> | You first want to install PyMOL. <br> | ||
− | Do this, by following this guide [http://www.pymolwiki.org/index.php/Windows_Install#Pre-compiled_PyMOL Pre-compiled_PyMOL] <br> | + | Do this, by following this guide.<br> |
− | + | === Windows === | |
+ | [http://www.pymolwiki.org/index.php/Windows_Install#Pre-compiled_PyMOL Windows Pre-compiled_PyMOL]. Consider this little nice texteditor: [http://notepad-plus-plus.org/download/ Notepad++] <br> | ||
+ | === mac === | ||
+ | [http://erlendsson.dk/PSA/ pymol for mac]. Download and install MacPyMOL-v1.3r1-edu.tar.bz2 | ||
− | === Find a suitable protein data file | + | === 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.<br> | ||
+ | |||
+ | == 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.<br> | We need to find a Protein Databank File (PDB), which describe the x,y,z coordinates of your enzyme.<br> | ||
These are stored at the homepage: http://www.rcsb.org <br> | These are stored at the homepage: http://www.rcsb.org <br> | ||
Find a suitable file by searching for: '''porcine kidney fructose 1,6-bisphosphatase''' <br> | Find a suitable file by searching for: '''porcine kidney fructose 1,6-bisphosphatase''' <br> | ||
− | The PDB file | + | The PDB file '''1LEV''', seems suitable. |
=== Read more about your protein === | === Read more about your protein === | ||
Line 25: | Line 31: | ||
http://pdbwiki.org/wiki/1lev | http://pdbwiki.org/wiki/1lev | ||
− | === Start your PyMOL | + | == Background == |
+ | This tutorial is designed to give you a basic working knowledge of making pretty and informative pictures of protein structures using PyMOL. <br> | ||
+ | This tutorial does not cover all the functions of PyMol, but tries to focus on the most important ones. <br> | ||
+ | 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.<br> | ||
+ | |||
+ | When you open PyMOL you will see two windows opening.<br> | ||
+ | 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. <br> | ||
+ | Each of these two windows contain a command line, where we can enter commands into the program. <br> | ||
+ | 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]]<br> | ||
+ | There are several ways to open this file:<br> | ||
+ | Either we can download the file from PDB and save it to our computer.<br> | ||
+ | We can then open the PDB file (if you have it on the harddisk) using the menu '''File > Open'''.<br> | ||
+ | or we can write: '''fetch''' followed by the PDB id in either of the two command lines. Ex: '''fetch 1LEV''' <br> | ||
+ | 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:<br> | ||
+ | '''all''' and the four character name of the PDB file, ex. '''1lev'''.<br> | ||
+ | Later on we will make new selections that will appear in this menu.<br> | ||
+ | Each of the two lines have 5 buttons labeled '''A''' (Actions), '''S''' (Show), '''H''' (Hide), '''L''' (Label), '''C''' (Color).<br> | ||
+ | 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.<br> | ||
+ | '''Visualize the molecule in the cartoon representation''' by selecting '''S > cartoon'''.<br> | ||
+ | Try also to show the molecule as ribbon, sticks or surface to get a feeling for the different representations.<br> | ||
+ | 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.<br> | ||
+ | Color everything white selecting '''C > grey > white'''. | ||
+ | |||
+ | Ok, now we are going to try to move the molecule around. | ||
+ | <br>Try to move the mouse around while pressing the left mouse button. This will rotate the molecule.<br> | ||
+ | Try to move it around holding the middle button (moves the view) or the right button (zooms in and out).<br> | ||
+ | If you have a one or two button mouse you can change the mode in the '''Mouse''' menu in the Tcl/Tk GUI window. <br> | ||
+ | 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"<br> | Start your shortcut to PyMOL "C:\Python27\PyMOL\PyMOL.exe"<br> | ||
Now click and do the following: | Now click and do the following: | ||
− | # | + | # Write in command line: '''fetch 1lev''' |
# Right Menu: -> 1lev -> "A" -> preset -> Publication | # Right Menu: -> 1lev -> "A" -> preset -> Publication | ||
# Top Menu: Display -> Sequence | # Top Menu: Display -> Sequence | ||
# Top Menu: Display -> Sequence Mode -> Chains | # Top Menu: Display -> Sequence Mode -> Chains | ||
# In Sequence, select so all "F" is marked. | # In Sequence, select so all "F" is marked. | ||
− | # Right Menu: -> (sele) -> "A" -> remove atoms | + | # Right Menu: -> (sele) -> "A" -> remove atoms. (1LEV is crystallized in dimer formation. So we only need to view 1 chain) |
# Top Menu: Display -> Sequence Mode -> Residue Codes | # Top Menu: Display -> Sequence Mode -> Residue Codes | ||
# In Sequence, select so only substrate (F6P) is marked (A/338) | # In Sequence, select so only substrate (F6P) is marked (A/338) | ||
Line 47: | Line 89: | ||
# Right Menu: -> (act_site) -> "S" -> sticks | # Right Menu: -> (act_site) -> "S" -> sticks | ||
# Right Menu: -> (act_site) -> "L" -> residues | # Right Menu: -> (act_site) -> "L" -> residues | ||
+ | # Top Menu: Display -> Background -> White | ||
# Find a good view, and push "Ray" in the top right of the grey command console. | # Find a good view, and push "Ray" in the top right of the grey command console. | ||
# Top Menu: File -> Save Image As -> PNG | # Top Menu: File -> Save Image As -> PNG | ||
# Put it into your student article | # Put it into your student article | ||
− | + | == The "Faster" way == | |
The real power of PyMOL, comes into power, when your write a PyMOL command file.<br> | The real power of PyMOL, comes into power, when your write a PyMOL command file.<br> | ||
Here you write which commands pymol should execute, and so it only take 1 second to get the same.<br> | Here you write which commands pymol should execute, and so it only take 1 second to get the same.<br> | ||
Line 61: | Line 104: | ||
# Best to restart PyMOL every time from fresh | # Best to restart PyMOL every time from fresh | ||
reinitialize | reinitialize | ||
+ | cd C:\Users\DIG\pymol | ||
fetch 1lev, async=0 | fetch 1lev, async=0 | ||
Line 66: | Line 110: | ||
remove chain F | remove chain F | ||
select substrates, organic | select substrates, organic | ||
− | select f6p, | + | select f6p, resn F6P |
zoom f6p | zoom f6p | ||
util.cbac('f6p') | util.cbac('f6p') | ||
select act_site, byres f6p around 3.5 | select act_site, byres f6p around 3.5 | ||
+ | show sticks, act_site | ||
+ | |||
distance pol_cont, f6p, act_site, mode=2 | distance pol_cont, f6p, act_site, mode=2 | ||
− | select cli, /1lev//A/CLI | + | select cli, /1lev//A/CLI # OR: select cli, resn CLI |
− | select mn, name MN | + | select mn, name MN # OR: select mn, symbol Mn # OR: select mn, inorganic |
show spheres, mn | show spheres, mn | ||
− | |||
label act_site and name CB, resn+resi | label act_site and name CB, resn+resi | ||
zoom pol_cont | zoom pol_cont | ||
viewport 1024,768 | viewport 1024,768 | ||
+ | bg_color white | ||
ray | ray | ||
png 1lev.png | png 1lev.png | ||
Line 88: | Line 134: | ||
# "#" Line starting with hashes is not read by PyMOL. Use a comment field. | # "#" Line starting with hashes is not read by PyMOL. Use a comment field. | ||
# Best to restart PyMOL every time from fresh | # Best to restart PyMOL every time from fresh | ||
+ | # Go to your working directory | ||
# Get the pdb file from the RCSB server. async=0 makes sure it waits for completion of download before continuing. | # Get the pdb file from the RCSB server. async=0 makes sure it waits for completion of download before continuing. | ||
Line 93: | Line 140: | ||
Or start PyMOL, and write in command: '''@1lev.pml''' <br> | Or start PyMOL, and write in command: '''@1lev.pml''' <br> | ||
Or start PyMOL, top menu -> File -> Run... -> C:\Users\YOU\pymol\1lev.pml | Or start PyMOL, top menu -> File -> Run... -> C:\Users\YOU\pymol\1lev.pml | ||
+ | |||
+ | === Movie of 1LEV === | ||
+ | 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"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Movie of Epidermal Growth Factor == | ||
+ | Lets make a movie of the Molecule of the month on RCSB.org.<br> | ||
+ | Let's take a membrane protein, [http://www.rcsb.org/pdb/explore/explore.do?structureId=1nql 1nql@rcsb], [http://pdbwiki.org/wiki/1nql pdbwiki], | ||
+ | [http://www.proteopedia.org/wiki/index.php/1nql proteopedia]<br> | ||
+ | [http://www.rcsb.org/pdb/101/motm.do?momID=126 June 2010 Molecule of the Month by David Goodsell] | ||
+ | |||
+ | Open Notepad, and then: '''File->Save as->All files-> C:\Users\YOU\pymol\1nql.pml''' | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | === GUI - Scene loop === | ||
+ | # Click '''Movie'''->'''Program'''->'''Scene Loop'''->'''Steady'''->'''Program'''->'''4 seconds each''' | ||
+ | # Click the '''Play button''' at the lover right corner. Or write '''mplay'''. | ||
+ | # Click '''Movie'''->'''Reset''' | ||
+ | # Try also the other '''Scene Loop''' method. | ||
+ | |||
+ | === GUI - Camera loop === | ||
+ | # Click '''Mouse'''->'''# Button Motions'''. In the selection menu, under '''all''', you now have a '''M''' button!. | ||
+ | # '''Movie'''->'''Reset''' | ||
+ | # Click '''F1''' | ||
+ | ## sel. menu '''all-[M]'''->'''Store with scene F1''' | ||
+ | ## '''Movie'''->'''Program'''->'''Camera Loop'''->'''Y-Roll'''->'''4 seconds''' | ||
+ | ## '''Movie'''->'''Append'''->'''2 seconds''' | ||
+ | ## Click lower right '''Full forward button''' '''->''' | ||
+ | # Click '''F2''' | ||
+ | ## sel. menu '''all-[M]'''->'''Store with scene F2''' | ||
+ | ## '''Movie'''->'''Program'''->'''Camera Loop'''->'''X-Rock'''->'''60. deg. over 4 sec.''' | ||
+ | ## '''Movie'''->'''Append'''->'''2 seconds''' | ||
+ | ## Click lower right '''Full forward button''' '''->''' | ||
+ | # Click '''F3''' | ||
+ | ## sel. menu '''all-[M]'''->'''Store with scene F3''' | ||
+ | ## '''Movie'''->'''Program'''->'''Camera Loop'''->'''X-Roll'''->'''4 seconds''' | ||
+ | ## '''Movie'''->'''Append'''->'''2 seconds''' | ||
+ | ## Click lower right '''Full forward button''' | ||
+ | # Click '''F4''' | ||
+ | ## sel. menu '''all-[M]'''->'''Store with scene F4''' | ||
+ | ## '''Movie'''->'''Append'''->'''1 seconds''' | ||
+ | ## Click lower right '''Full forward button''' | ||
+ | ## sel. menu '''all-[M]'''->'''Store with scene F4''' | ||
+ | ## '''Movie'''->'''Program'''->'''Camera Loop'''->'''Nutate'''->'''30. deg. over 8 sec.''' | ||
+ | ## '''Movie'''->'''Append'''->'''4 seconds''' | ||
+ | ## 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''' | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | Write in pymol: '''@movie.pml''' | ||
+ | == Movie of Potassium Channel KcsA-Fab complex in high concentration of K+ == | ||
+ | Let's take another membrane protein, [http://www.rcsb.org/pdb/explore/explore.do?structureId=1k4c 1k4c@rcsb], [http://pdbwiki.org/wiki/1k4c pdbwiki], | ||
+ | [http://www.proteopedia.org/wiki/index.php/1k4c proteopedia]<br> | ||
+ | |||
+ | Open Notepad, and then: '''File->Save as->All files-> C:\Users\YOU\pymol\1k4c.pml''' | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Export movies == | ||
+ | Write in command | ||
+ | frame 1 | ||
+ | Then go to File->Save Movie As -> MPEG <br> | ||
+ | It takes a little time, 5 min. Be patient. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | You can also export it like PNG images, and then collect them. <br> | ||
+ | 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 [http://windows.microsoft.com/da-dk/windows7/products/features/movie-maker Windows Live Movie Maker] | ||
+ | # Add all images from folder | ||
+ | # Ctrl+a to select all images | ||
+ | # Click in tab "Edit", set Duration to: 0,03 | ||
+ | # Click in tab "Home", "Save movie", "Windows Phone (large)" | ||
+ | You are done | ||
+ | |||
+ | == See Also == | ||
+ | * [[3d_pdf | 3d protein image in pdf]] | ||
+ | * [[Movie_pdf | Movies in pdf]] | ||
+ | * [http://youtu.be/r6o35ZRsdqw Example pymol movie] | ||
+ | |||
+ | [[Category:Tutorials]] |
Latest revision as of 19:16, 20 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:
- Write in command line: fetch 1lev
- Right Menu: -> 1lev -> "A" -> preset -> Publication
- Top Menu: Display -> Sequence
- Top Menu: Display -> Sequence Mode -> Chains
- In Sequence, select so all "F" is marked.
- Right Menu: -> (sele) -> "A" -> remove atoms. (1LEV is crystallized in dimer formation. So we only need to view 1 chain)
- Top Menu: Display -> Sequence Mode -> Residue Codes
- In Sequence, select so only substrate (F6P) is marked (A/338)
- Right Menu: -> (sele) -> "A" -> zoom
- Right Menu: -> (sele) -> "A" -> rename selection -> f6p
- Right Menu: -> (f6p) -> "C" -> by element -> Select to Carbon is not green
- Right Menu: -> (f6p) -> "A" -> find polar contacts -> to others excluding solvent
- In Sequence, select so only MN is marked (A/340)
- Right Menu: -> (sele) -> "A" -> rename selection -> mn
- Right Menu: -> (mn) -> "S" -> spheres
- Write in console: select act_site, byres f6p around 3.5
- Right Menu: -> (act_site) -> "S" -> sticks
- Right Menu: -> (act_site) -> "L" -> residues
- Top Menu: Display -> Background -> White
- Find a good view, and push "Ray" in the top right of the grey command console.
- Top Menu: File -> Save Image As -> PNG
- 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
- "#" Line starting with hashes is not read by PyMOL. Use a comment field.
- Best to restart PyMOL every time from fresh
- Go to your working directory
- 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
- Click Movie->Program->Scene Loop->Steady->Program->4 seconds each
- Click the Play button at the lover right corner. Or write mplay.
- Click Movie->Reset
- Try also the other Scene Loop method.
GUI - Camera loop
- Click Mouse-># Button Motions. In the selection menu, under all, you now have a M button!.
- Movie->Reset
- Click F1
- sel. menu all-[M]->Store with scene F1
- Movie->Program->Camera Loop->Y-Roll->4 seconds
- Movie->Append->2 seconds
- Click lower right Full forward button ->
- Click F2
- sel. menu all-[M]->Store with scene F2
- Movie->Program->Camera Loop->X-Rock->60. deg. over 4 sec.
- Movie->Append->2 seconds
- Click lower right Full forward button ->
- Click F3
- sel. menu all-[M]->Store with scene F3
- Movie->Program->Camera Loop->X-Roll->4 seconds
- Movie->Append->2 seconds
- Click lower right Full forward button
- Click F4
- sel. menu all-[M]->Store with scene F4
- Movie->Append->1 seconds
- Click lower right Full forward button
- sel. menu all-[M]->Store with scene F4
- Movie->Program->Camera Loop->Nutate->30. deg. over 8 sec.
- Movie->Append->4 seconds
- 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
- Add all images from folder
- Ctrl+a to select all images
- Click in tab "Edit", set Duration to: 0,03
- Click in tab "Home", "Save movie", "Windows Phone (large)"
You are done