Difference between revisions of "MovieSchool 4"

From PyMOLWiki
Jump to navigation Jump to search
(Created page with '== Movie Making & the PyMOL GUI == These screenshots are all current as of PyMOL 1.2b8. === Basic TK GUI === [[Image:tkgui1.png|center|frame|The basic TK GUI. Menu options ...')
 
(→‎BB Inspector: the frame command must preceed the zoom and store commands in the example in order to achieve the desired effect - I have just went through that example)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Movie Making & the PyMOL GUI ==
+
== Simple Movie Examples ==
These screenshots are all current as of PyMOL 1.2b8.
+
We now the ability to make some pretty simple, but cool movies. So, let's try a few.
  
=== Basic TK GUI ===
+
=== Multiple Zooming ===
[[Image:tkgui1.png|center|frame|The basic TK GUIMenu options are File, Edit, Build, etc.]]
+
Let's try making a movie where we zoom into each ligand that's not waterIn order to make this movie, I had to find a protein with suitable ligands, so you can do the same for your own protein.  Just replace the hard-coded residue numbers.
  
==== Movie Menu ====
+
'''Goal:''' Make a movie that zoom into the three ligands, stays on that ligand for 2 seconds, then moves to the next.  I also want smooth zoom out at the end.  Don't let the length of this movie script throw you off, you've seen all of the movie commands and the initial commands are just loading the and making it look good.
This image shows the movie menu in PyMOL.
+
<source lang="python">
[[Image:tkgui2.png|center|frame|The movie menu in PyMOL]]
+
# setup PyMOL for the movie
* '''Append''' just adds X seconds to the end of your movieThis is the equivalent of '''[[madd]] 1 x(FPS*time)'''. So, you can very easily add anywhere from 1/4s to 60 seconds to your video.  You can use this multiple times.
+
reinitialize
[[Image:tkgui3.png|center|frame|The Movie->Append submenu]].
+
set matrix_mode, 1
 +
set movie_panel, 1
  
* '''Frame Rate''' submenu that controls the frame rate of your movie in frames per second. It also controls whether or not the frame openGL screen frame rate is shown.
+
# load the PDB, make selections for the ligands and
[[Image:tkgui4.png|center|frame|"Frame Rate" submenu]]
+
# make the protein look snazzy.
 +
#load /spc/pdb/2jep.pdb
 +
fetch 2jep, async=0
 +
remove resn HOH
 +
orient
 +
select l1, c. A and i. 1397
 +
select l2, c. A and i. 1396
 +
select l3, c. B and i. 1396
 +
as cartoon
 +
color grey
 +
show sticks, het
 +
color magnesium, het
  
==== Scene Menu ====
+
# At 30 FPS this is then a 16 second movie.
For storing our scenes, we can issue the ''[[scene]] store'' command or '''[[mview]] store scene=sceneName''' command.  You can also use the mouse and store/recall/clear scenes.
+
# We look at the structure for 2 seconds, zoom in to each ligand
[[Image:tkgui5.png|center|frame|Scene Menu]]
+
# and look at it for another 2 seconds, then, zoom out and look again
 +
# at everything for another 2 seconds.
  
===== Scene's Recall Submenu =====
+
# initialize the 480 frame movie
This menu shows the first 12 scenes stored by F-key that you can recall (if they were stored).  Please take note of the '''[[Scene_buttons|Buttons]]''' menu.  This make a small menu of scenes in the lower left hand corner of your openGL screen.  Very handy for roving through, moving around and switching to scenes.
+
mset 1 x480
[[Image:tkgui6.png|frame|center|Scene->Recall submenu]]
 
  
==== Mouse Menu ====
+
# zoom all ('scene #1')
There is a new mouse mode called [[Three_Button_Motions]].  So we now have View->Edit-Motions as mouse modes.  See [[Config_Mouse]]. 
+
frame 1
[[Image:tkgui7.png|frame|center|Mouse Menu]]
+
mview store
 +
# stay here for 2 seconds
 +
frame 60
 +
mview store
  
=== openGL GUI ===
+
# zoom on ligand 1  ('scene #2')
 +
frame 120
 +
zoom l1
 +
mview store
 +
# stay here for 2 seconds
 +
frame 180
 +
mview store
  
=== Mouse Modes ===
+
# zoom on ligand 2  ('scene #3')
If you've chosen '''Mouse->3 Button All''' Modes from the Tk GUI you can now access the new mouse modes by clicking on the mouse info panel in the lower righ of the openGL window.  Click until the modes cycle through Edit->View->Motions->Edit->...
+
frame 240
<center>
+
zoom l2
<gallery widths="200px" heights="300px">
+
mview store
Image:glgui1.png|Editing mode pay careful attention to the button on top.
+
# stay for 2 seconds
Image:glgui2.png|Viewing mode pay careful attention to the button on top.
+
frame 300
Image:glgui3.png|Motions mode pay careful attention to the button on top.
+
mview store
</gallery>
 
</center>
 
  
==== Motions Mode ====
+
# zoom to ligand 3  ('scene #4')
In motions mode, if you click on '''all->M''' you get options for storing, clearing, smoothing, interpolating, etc ''the camera'' motions and positions.
+
frame 360
 +
zoom l3
 +
mview store
 +
# stay for 2 seconds
 +
frame 420
 +
mview store
  
<center>
+
# zoom out  ('back to scene #1')
<gallery widths="400px" heights="300px" perrow=2>
+
frame 480
Image:glgui4.png|All->Motions shows a menu for Camera Motion/Position options
+
zoom
Image:glgui5.png|All->Motions->Store with Scene allows you to assign the chosen scene with the current frame.
+
mview store
Image:glgui6.png|All->Motions->Store with State allows you to assign a chosen state to this scene.
+
 
Image:glgui7.png|All->Motions->Smooth helps with smoothing interpolation between scenes
+
# interpolate the frames
Image:glgui8.png|''ALA''->Motions menu shows our options, similar to the camera, but this time for the ''ALA'' fragment.
+
mview reinterpolate
</gallery>
+
 
</center>
+
# play the awesome movie!
 +
mplay
 +
 
 +
# stop when you want
 +
# mstop
 +
</source>
 +
 
 +
 
 +
 
 +
=== Animating an Alignment ===
 +
<source lang="python">
 +
# setup PyMOL for the movie
 +
reinitialize
 +
set matrix_mode, 1
 +
set movie_panel, 1
 +
 
 +
# load the PDBs
 +
fetch 1cll 1ggz, async=0
 +
 
 +
# orient the scene
 +
as cartoon
 +
orient
 +
 
 +
# make 100-frame movie
 +
mset 1 x100
 +
# goto frame 1
 +
frame 1
 +
 
 +
# store the camera position and object
 +
# positions in frame 1
 +
mview store
 +
mview store, object=1cll
 +
mview store, object=1ggz
 +
 
 +
# goto frame 90
 +
frame 90
 +
# align the two proteins
 +
super 1cll, 1ggz
 +
# we rezoom to center the camera on the
 +
# two aligned proteins
 +
zoom
 +
# store the camera positions
 +
mview store
 +
# store the new object position(s)
 +
mview store, object=1cll
 +
mview store, object=1ggz
 +
 
 +
# have PyMOL stitch together the scenes.
 +
mview reinterpolate
 +
mview reinterpolate, object=1cll
 +
mview reinterpolate, object=1ggz
 +
 
 +
# rewind
 +
frame 1
 +
# get some popcorn!  :-)
 +
mplay
 +
</source>
 +
 
 +
=== BB Inspector ===
 +
This movie will walk down the alpha carbons inspecting each one for 1/3 of a second.  :-)  What would be cool would be to calculate the difference vector from i. n+1 to i. n and then walk that path. Anyhow, here you go:
 +
 
 +
<source lang="python">
 +
# usual setup
 +
reinitialize
 +
set matrix_mode, 1
 +
set movie_panel, 1
 +
 
 +
# fetch 1CLL to work on; this will only work on 1cll
 +
# or any other protein with 144 AAs starting at resi 4.
 +
fetch 1cll, async=0
 +
as lines, n. C+O+N+CA
 +
color marine
 +
zoom i. 4+5
 +
 
 +
# 10 frames per AA
 +
mset 1 x1440
 +
mview store
 +
 
 +
# this code maps the zooming of
 +
# one AA and it's neighbor to 10 frames
 +
python
 +
for x in range(0,144):
 +
  cmd.frame((10*x)+1)
 +
  cmd.zoom( "n. CA and i. " + str(x) + "+" + str(x+1))
 +
  cmd.mview("store")
 +
python end
 +
 
 +
# goto the end and interpolate all the frames
 +
frame 288
 +
mview store
 +
mview reinterpolate
 +
 
 +
# I know, it's not smooth & cool like the other ones
 +
mplay
 +
</source>
 +
 
 +
[[MovieSchool_3| &larr; Previous Lesson]] [[MovieSchool_5| Next Lesson &rarr;]]
  
 
[[Category:Movies]]
 
[[Category:Movies]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Latest revision as of 10:44, 1 February 2010

Simple Movie Examples

We now the ability to make some pretty simple, but cool movies. So, let's try a few.

Multiple Zooming

Let's try making a movie where we zoom into each ligand that's not water. In order to make this movie, I had to find a protein with suitable ligands, so you can do the same for your own protein. Just replace the hard-coded residue numbers.

Goal: Make a movie that zoom into the three ligands, stays on that ligand for 2 seconds, then moves to the next. I also want smooth zoom out at the end. Don't let the length of this movie script throw you off, you've seen all of the movie commands and the initial commands are just loading the and making it look good.

# setup PyMOL for the movie
reinitialize
set matrix_mode, 1
set movie_panel, 1

# load the PDB, make selections for the ligands and
# make the protein look snazzy.
#load /spc/pdb/2jep.pdb
fetch 2jep, async=0
remove resn HOH
orient
select l1, c. A and i. 1397
select l2, c. A and i. 1396
select l3, c. B and i. 1396
as cartoon
color grey
show sticks, het
color magnesium, het

# At 30 FPS this is then a 16 second movie.
# We look at the structure for 2 seconds, zoom in to each ligand
# and look at it for another 2 seconds, then, zoom out and look again
# at everything for another 2 seconds.

# initialize the 480 frame movie
mset 1 x480

# zoom all ('scene #1')
frame 1
mview store
# stay here for 2 seconds
frame 60
mview store

# zoom on ligand 1  ('scene #2')
frame 120
zoom l1
mview store
# stay here for 2 seconds
frame 180
mview store

# zoom on ligand 2  ('scene #3')
frame 240
zoom l2
mview store
# stay for 2 seconds
frame 300
mview store

# zoom to ligand 3  ('scene #4')
frame 360
zoom l3
mview store
# stay for 2 seconds
frame 420
mview store

# zoom out  ('back to scene #1')
frame 480
zoom
mview store

# interpolate the frames
mview reinterpolate

# play the awesome movie!
mplay

# stop when you want
# mstop


Animating an Alignment

# setup PyMOL for the movie
reinitialize
set matrix_mode, 1
set movie_panel, 1

# load the PDBs
fetch 1cll 1ggz, async=0

# orient the scene
as cartoon
orient

# make 100-frame movie
mset 1 x100
# goto frame 1
frame 1

# store the camera position and object
# positions in frame 1
mview store
mview store, object=1cll
mview store, object=1ggz

# goto frame 90
frame 90
# align the two proteins
super 1cll, 1ggz
# we rezoom to center the camera on the 
# two aligned proteins
zoom
# store the camera positions
mview store
# store the new object position(s)
mview store, object=1cll
mview store, object=1ggz

# have PyMOL stitch together the scenes.
mview reinterpolate
mview reinterpolate, object=1cll
mview reinterpolate, object=1ggz

# rewind
frame 1
# get some popcorn!  :-)
mplay

BB Inspector

This movie will walk down the alpha carbons inspecting each one for 1/3 of a second. :-) What would be cool would be to calculate the difference vector from i. n+1 to i. n and then walk that path. Anyhow, here you go:

# usual setup
reinitialize
set matrix_mode, 1
set movie_panel, 1

# fetch 1CLL to work on; this will only work on 1cll
# or any other protein with 144 AAs starting at resi 4.
fetch 1cll, async=0
as lines, n. C+O+N+CA
color marine
zoom i. 4+5

# 10 frames per AA
mset 1 x1440
mview store

# this code maps the zooming of
# one AA and it's neighbor to 10 frames
python
for x in range(0,144):
  cmd.frame((10*x)+1)
  cmd.zoom( "n. CA and i. " + str(x) + "+" + str(x+1))
  cmd.mview("store")
python end

# goto the end and interpolate all the frames
frame 288
mview store
mview reinterpolate

# I know, it's not smooth & cool like the other ones
mplay

← Previous Lesson Next Lesson →