[Chimera-users] Using marker files to place oriented density maps inside a tomogram

Tom Goddard goddard at sonic.net
Thu Nov 15 16:24:17 PST 2012

Hi Daniel,

   Probably you can modify your script and make Chimera open the copies 
much faster.  The python script should also achieve that. The trick with 
your command script is that between each command Chimera draws a frame 
and may update the volume dialog histograms.  One way to avoid this is 
put all the commands on one line separated by semicolons.  Maybe another 
better method is have one open command and one transform setting command

     open template.em template.em template.em ... (repeat for as many 
copies as you need)
     matrixset transforms.txt

I believe the matrixset command can have the positions for as many 
models as you want with the model id number specified before the 
transform.  See the Chimera manual or try matrixget to write an example 
file with several models being displayed to see the precise format when 
you have multiple transforms.

   A Python script could be faster still because it wouldn't need to 
open the same map file over and over.  It could create all the map 
copies from the first.  As an example making 100 translated copies of an 
open 100**3 volume took 3 seconds with the following Python

from VolumeViewer import active_volume
v = active_volume()
from chimera import Xform
for i in range(100):
   c = v.copy()


> Hi Tom,
> Yes, both methods that you describe work nicely. In particular, I was 
> not aware of the possibility of changing the level of a set of models 
> with a single command line operation: that does help a lot.
> The only actual annoyance that remains in my implementation for the 
> manipulation of sets of volumes is the loading of the volumes?. I 
> suspect the way I do it is too rudimentary, as I just open Chimera 
> passing as argument a .cmd command file that loads the same file again 
> and again, placing it each time in a different location, i.e:
> open 0 template.em
> matrixset transform_0.cmd
> open 1 template.em
> matrixset transform_1.cmd
> ? and so on for hundreds of models, so that the user basically sees 
> the Volume Viewer  getting updated with a new model and then a new one 
> for several minutes. I guess with the .py script that you send me  I 
> will be able to load the volumes in a less messy manner than this one.
> Thanks for all the info!
> Daniel
>> Hi Daniel,
>>   I see.  You'd like to control the contour level, color, 
>> surface/mesh style, step size... of all the copies as if they were 
>> one model instead of 100 different models, each a copy of the same 
>> map.  For making hundreds of copies of an atomic model, the 
>> multiscale dialog in Chimera does this using a single model.  But 
>> that doesn't currently work with maps.  One disadvantage of having a 
>> single model for all the copies of a map is that the maps will all 
>> have to have the same color, same step size, same contour level 
>> because all those properties are stored with the model. Maybe that 
>> restriction is fine for your use.  I would like to make that possible 
>> by allowing Chimera to place identical copies of any type of model by 
>> just specifying the list of positioning matrices.  The model would 
>> just remember the list of matrices for the different placements.
>>   For now using a hundred different models of the same map is 
>> workable.  You can't adjust all of them at the same time with the 
>> volume dialog.  But you can adjust one to figure out the contour 
>> level you like and then use one volume command to set the level for 
>> all the copies, for example, "volume #1-100 level 1.24 color yellow 
>> step 2".
>>   Another approach is to make a single map by adding your hundred 
>> placed copies on a single grid (e.g. the tomogram grid).  Then you 
>> open that one map and all the copies appear. The drawback is that you 
>> may want finer grid spacing on the individual copies then you have 
>> with the tomogram, and that would make the map to large and slow to 
>> work with (and mostly empty).  If you are interested in trying this 
>> approach though you can use a command like "vop add #1-100 onGrid #0" 
>> to produce such a map after placing the hundred separate models with 
>> your current script.  Then save that new map and use it in the future 
>> instead of the 100 copies.
>>     Tom
>> -------- Original Message --------
>> Subject: Re: [Chimera-users] Using marker files to place oriented 
>> density maps inside a tomogram
>> From: Daniel Castano Diez
>> To: Tom Goddard
>> Date: 11/15/12 7:12 AM
>>> Hi Tom,
>>> thanks for the helpful explanation. The extension that you mention 
>>> you've been working on  seems interesting. I guess that will allow 
>>> the user to change the isosurface level in one single model to 
>>> change it in all the models simultaneously, am I right? This would 
>>> solve another problem I'm having with my scripts, as they fed each 
>>> copy of the map into Chimera as a different model. So, I'm looking 
>>> forwards to trying it when it becomes available.
>>> best,
>>> Daniel
>>>> Hi Daniel,
>>>>  You can use a Chimera marker file but that only knows how to place 
>>>> spheres.  If you wanted to make use of the "map" and "matrix" 
>>>> attributes you added to the markers then that would require some 
>>>> extra Python script.  That could be done -- it is just a different 
>>>> format of input from the script I sent you.
>>>>  If you can't display hundreds of copies of the map due to slow 
>>>> graphics then it doesn't matter how you input the data.  Having 
>>>> hundreds of copies of the same map open doesn't load the map data 
>>>> more than once.  So you shouldn't run out of memory.  But the 
>>>> surface for each map might have a million triangles and it does 
>>>> make a separate surface copy for each copy you place in your 
>>>> tomogram.  Of course you won't see the detail in a tiny map put 
>>>> into a tomogram so the solution would be to display a very coarse 
>>>> image of the map that is being placed many times in the tomogram.  
>>>>  I've worked recently on making Chimera display multiple copies of 
>>>> identical objects without making copies of the surface in memory -- 
>>>> just reuse the same surface.  But it is not in Chimera yet.  And 
>>>> your graphics speed will still become unusable if you try to 
>>>> display too many copies with too much detail.  So the main need is 
>>>> to show an appropriate low level of detail for all or most of your 
>>>> hundreds of copies.
>>>>    Tom
>>>> -------- Original Message --------
>>>> Subject: Re: [Chimera-users] Using marker files to place oriented 
>>>> density maps inside a tomogram
>>>> From: Daniel Castano Diez
>>>> To: Tom Goddard
>>>> Date: 11/14/12 1:28 PM
>>>>> Hi Tom,
>>>>> thanks for the answer. Actually I already wrote some scripts for 
>>>>> placing each different copy of the density map as an individual 
>>>>> model, but this is not practical for placing hundreds of copies 
>>>>> (as it's the case with tomograms).  I will try your python script.
>>>>> I was under the impression that a .cmm markerfile was a better 
>>>>> approach, as I though that one could define a marker with more 
>>>>> attributes as in the example:
>>>>> <marker id="1" x="-6.1267" y="17.44" z="-3.1338" radius="0.35217"/>
>>>>> I mean, something like:
>>>>> <marker id="1" x="-6.1267" y="17.44" z="-3.1338"  map 
>>>>> ="my_map.em"  matrix = "my_matrix.txt" />
>>>>> or similar with quaternions or euler angles... but I guess that 
>>>>> was wrong? That'll be a pitty,  as I am interfacing Chimera with 
>>>>> the subtomogram averaging package Dynamo and the most stable way 
>>>>> seemes to be having Dynamo converting its "table" files (lists of 
>>>>> positions and angles) into .cmm files that could then be directly 
>>>>> fed into Chimera.
>>>>> Thanks!
>>>>> Daniel
>>>>>> Hi Daniel,
>>>>>> Take a look at the placem.py script which can place copies of 
>>>>>> maps or molecules at specified positions.
>>>>>>   http://plato.cgl.ucsf.edu/trac/chimera/wiki/Scripts
>>>>>> It specifies the rotation as a quaternion which is close to a 
>>>>>> rotation axis and angle description.  I could show you how to 
>>>>>> adapt it to use Euler angles or a 3x3 rotation matrix if you like.
>>>>>>   Tom
>>>>>>> Hi,
>>>>>>> I'd like to use a Chimera marker file to place multiple copies 
>>>>>>> of a density map in different spatial positions inside a 
>>>>>>> tomogram. My input is thus a single map file a set of 3d 
>>>>>>> locations, each attached to an euler triplet (or a rotation matrix)
>>>>>>> With the documentation I could find
>>>>>>> http://www.cgl.ucsf.edu/chimera/1.2065/docs/ContributedSoftware/volumepathtracer/volumepathtracer.html 
>>>>>>> it is explained how to place spheres without orientation in a 
>>>>>>> volume, but I was not able to figure out how to place a density 
>>>>>>> map at those locations, and also how to impart a different 
>>>>>>> orientation to the density map located at each position.
>>>>>>> My question is: where could I find a description of the marker 
>>>>>>> file syntax that describes this functionality?
>>>>>>> thanks,
>>>>>>> Daniel
>>>>>>> ----------------------------------------------------------------
>>>>>>> This message was sent using IMP, the Internet Messaging Program.
>>>>>>> _______________________________________________
>>>>>>> Chimera-users mailing list
>>>>>>> Chimera-users at cgl.ucsf.edu
>>>>>>> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users
>>>>> ----------------------------------------------------------------
>>>>> This message was sent using IMP, the Internet Messaging Program.
>>> ----------------------------------------------------------------
>>> This message was sent using IMP, the Internet Messaging Program.
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.

More information about the Chimera-users mailing list