[Chimera-users] python and MD

Eric Pettersen pett at cgl.ucsf.edu
Mon Aug 8 13:41:19 PDT 2011


Oops, missed these questions in my first reply...

On Aug 7, 2011, at 11:14 AM, Daniel Gurnon wrote:

> runCommand("copy file C:\Users\Dan\Desktop" + "\\" +start + ".png" +  
> " width 2000 width 2000 supersample 3")

> And while I'm at it,
> How can I generically specify the desktop in a windows environment  
> (so that I could give this to a student and they wouldn't have to  
> change "Dan" in c:\users\Dan\Desktp")
> How can I change the filename for the image to reflect framenumber?

In Chimera commands, tilde ('~') can be used in place of the user's  
home directory. Also, you probably want to prefix the string with 'r'  
so that the backslashes aren't handled specially by Python.  Lastly,  
you probably want to zero-pad the PNG file names to make them sort  
correctly in listings and be easier to handle in scripts.  Therefore,  
the above command becomes:

runCommand(r"copy file ~\Desktop\%06d.png width 2000 width 2000  
supersample 3" % frameNumber)

The "%06d" will be replaced by a 6-digit version of frameNumber,  
padded with zeroes as needed.

--Eric

                         Eric Pettersen
                         UCSF Computer Graphics Lab
                         http://www.cgl.ucsf.edu


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20110808/963b441c/attachment.html>


More information about the Chimera-users mailing list