[Chimera-users] batch production of images
goddard at sonic.net
Mon Apr 22 18:49:54 PDT 2013
There are no variables in the Chimera command language. So how do you know what model numbers to use in a script? The first model open is #0, then the next one is #1. When you open a new model it assigns the lowest integer model number that is not being used. You can also tell it to use some other model number with the open command, for example, "open 3 1abc.pdb" opens the PDB as model #3. Assigning the model number with the open command doesn't happen to work with marker sets. That is a bug. In your case you have a marker file containing more than one marker set. If you don't know how many marker sets are in the file (or you want a script that works with files containing different numbers of marker sets) that can create a problem knowing what model id numbers to use in commands. If the marker set is the last model opened you can refer to all models beyond a specified model number, for example, "delete #5-" will delete model 5 and higher model numbers.
If you need something more complex then the above then you need a Python script. Then you can do everything. The equivalent of the Chimera command "open markers.cmm" is
from chimera import openModels
models = openModels.open('markers.cmm')
Then you have a variable with the list of models. To delete those models
The difficulty with using Python scripts is that we don't have documentation for the available functions. But as a start you can look at the Chimera Python scripts page for examples.
On Apr 22, 2013, at 6:00 AM, Benjamin SCHWARZ wrote:
> Hi Tom, and thanks a lot for the answer,
> With your suggestions I managed to do all I wanted, so everything is fine.
> Still, there are a few points I'd like to dig a bit deeper. When loading a markerSets file, I have a model created per MarkerSet object, and thus, several models to close prior to open the next file from which I want to shoot a picture. Is there a way to get the Model-Ids that were created from the last open call ? And by the way, is there a notion of 'variable' in chimera commands ?
>> You can use the Mac Chimera to run a batch job rendering images. Just start the normal graphical Chimera, open your batch script, iconify Chimera, and maybe your images are ready later in the day or the next day. Chimera needs to have a window on the display in order to render and save images using the OpenGL graphics.
>> So you can't log out before it is done. You would use the "headless" Linux Chimera when you need the processing to run when you are not logged in, or you need it to run on a server that has no display.
>> Yep, just use runCommand("copy ...") in your Python batch processing script to save the images.
>> To get the same view point for every image I would open the first model and by hand get the view point you want, then undisplay that model (using Model Panel, or command ~modeldisp #0). Save this session so you will be able to retrieve the exact view point used in the future if you need to create more images. Now load your Python batch processing script which should load a model, save an image, then close that one model, and iterate over all models. All the while, the original model you opened by hand is still open and undisplayed. The reason you keep it open and undisplayed is because as long as one model stays open Chimera keeps the current view point. If you close all models, then open one, it resets the view to show that one.
>> There is a basic primer on Chimera Python scripts in the Programmer's Guide that shows batch image saving
>> -------- Original Message --------
>> Subject: [Chimera-users] batch production of images
>> From: Benjamin SCHWARZ
>> To: UCSF Chimera Mailing List
>> Date: 4/19/13 7:52 AM
>>> Dear list,
>>> I am considering to use chimera to render (a tons of) pictures of models that I generated and issued in nice markerSet (.cmm) files.
>>> 1. If I understand well, the only way to do that is through the linux headless version, and there is no way to do that under MacOS X for the moment
>>> 2. I should then use the "copy" command. Something like : chimera --nogui --script "myscript.py"
>>> where myscript.py should contain something like "from chimera import runCommand; runCommand('copy file pipo.png')"
>>> 3. All my models were produced in a same cartesian, and I'd like to keep the orientation and "picture frame" similar for all pictures. What I mean here, is that I'd like to be able to set my camera somewhere, looking in a specified direction, which I would probably do under the chimera GUI; and then, shoot all my pictures from that point of view on a batch mode.
>>> How shall I do that (set a point of view for the camera and use it on a batchmode) ?
>>> Thanks a lot again for your great job, and your constant answers
>>> Chimera-users mailing list
>>> Chimera-users at cgl.ucsf.edu
> Benjamin SCHWARZ
> Email : schwarz at igbmc.fr
> Voice : +33 (0)3 68 85 47 30
> FAX : +33 (0)3 68 85 47 18
> Biocomputing group -- Integrated Structural Biology -- IGBMC
> 1 rue Laurent Fries, BP 10142
> F - 67404 Illkirch CEDEX
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
More information about the Chimera-users