[Chimera-users] Using the modeldisp command

Forbes J. Burkowski fjburkow at plg.uwaterloo.ca
Tue Feb 7 13:07:51 PST 2012


Hi:

Thanks for the advice.  I'll have to determine some reasonable way to
communicate this to my class.  I do have another problem though!


I have a rather long script that involves some VRML and it is also
misbehaving.  The script to follow has the same behaviour and is much
simpler:


import chimera
from chimera import runCommand
import CGLutil
from CGLutil import vrml
def vr_plot():
    wrl = vrml.Transform()
    for ii in range(10):
        for jj in range(10):
            translateBaseCube = vrml.Transform(translation = tuple([jj,
ii, 0]))
            base = vrml.Box(size = (.1, .1, .1), color = (1.,1.,.5))
            translateBaseCube.addChild(base)
            wrl.addChild(translateBaseCube)
    return vrml.vrml(wrl)
vvrr = vr_plot()
vrlmModel = chimera.openModels.open(vvrr, type = 'VRML')[0]
chimera.viewer.viewAll()


This VRML snippet gives me an array of 100 little cubes. Here's the catch:

On last year's version of Chimera (1.5.3) the script generates the scene
almost instantaneously. With the current version of Chimera (the January
release or the Feb. 04 release) the execution is extremely slow.  I am
running Windows 7 on a machine with 12 GB of RAM and an Intel i7 CPU
3.2GHz so I am not lacking for computing power.  One of my students also
tried this script and reports a similar slow down.  I am also noticing
that the latest version seems to launch more slowly and takes more time to
display BIG scenes (consider PDB ID = 1FFK).

Is there some way to improve this situation or do I have to give up on
using VRML?

Cheers,
Forbes




On Tue, 7 Feb 2012, Eric Pettersen wrote:

> Hi Forbes,
> 	The trick is that, unlike a Chimera command file, there is no
> implicit "wait 1" (i.e. show a new frame) at the end of commands
> executed with the Python runCommand call.  Therefore with this
> sequence of runCommands:
>
> 	runCommand("color red")
> 	runCommand("color green")
> 	runCommand("color blue")
>
> the display will never show the models colored red or green, just
> blue.  So, with the print command removed from your
> script the modeldisp/~modeldisp commands are executed "back to back"
> and you never see anything.  Though due to the arcane minutiae of how
> the print command works, you do wind up getting a frame redraw after a
> print which is why it works with the print in there.
> 	Also, Chimera does not execute at all (including frame redraws)
> during your time.sleep(0.1).  To get the script to work the way you
> want your options are:
>
> 	1) add "; wait 1" to the end of the modeldisp commands
> 	2) change time.sleep(0.1) to runCommand("wait 3") [3 frames at 30
> frames/second]
> 	3) both
>
> Sorry for the inscrutableness of all this.
>
> --Eric
>
> On Feb 6, 2012, at 7:10 PM, Forbes J. Burkowski wrote:
>
> > Hi:
> >
> > I have given my students a little problem that involves producing an
> > "animation" with each step in the animation being a PDB model within
> > an
> > NMR generated file.  The solution to the problem is more complicated
> > than
> > what is shown in the script below involving as it does the
> > calculation of
> > RMSDs to get smoother transitions between successive displays of the
> > models.
> >
> > My answer script is not working as expected due to an issue that I
> > have
> > recreated in a shorter script that follows next:
> >
> >
> > import chimera
> > from chimera import runCommand
> > import time
> >
> > numCycles = 10
> >
> > # ID's to try: 1BMR, 1DW5, 1QDP, 1D1H, 1N4N, 1IJC, 1PFD, 2LI3, 1AH1
> > prot_L = chimera.openModels.open("1AH1", type="PDB")
> > numModels = len(prot_L)
> >
> > runCommand("~modeldisp")
> >
> > for ic in range(numCycles):
> >    for aix in range(numModels):
> >        subIDstr = str(prot_L[aix].subid)
> >        command = "modeldisp #0" + "." + subIDstr
> >        runCommand(command)
> >        time.sleep(0.1)
> >        command = "~modeldisp #0" + "." + subIDstr
> >        # The following print command seems to be necessary to get
> >        # the animation!
> >        print command
> >        runCommand(command)
> >
> >
> >
> > This script runs just fine and does exactly what I wanted it to do.
> > Here
> > is the problem: If I remove the print statement, initially there for
> > debugging, the script does not work!  It seems weird that printing the
> > argument for the runCommand would have any effect on the execution
> > of the
> > runCommand statement.  Am I missing some vital point here????
> >
> > I am running the latest version of Chimera: (version 1.6 build 35398)
> > under Windows 7 Professional.  Prior to each run I have being doing
> >
> > File... Close Session
> >
> > to eliminate any models that were brought in on a previous run.
> >
> > Cheers,
> > Forbes Burkowski
> >
> > _______________________________________________
> > Chimera-users mailing list
> > Chimera-users at cgl.ucsf.edu
> > http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>



More information about the Chimera-users mailing list