MovieSchool 4

From PyMOLWiki
Jump to: navigation, search

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 →