
Hi Miguel, Glad you found bild -- it can make nice arrowheads which the volume tracer approach you tried first (voodoo) can't do that. Bild graphics are rendered with VRML and that is immutable in Chimera -- you can not change shape or colors or move VRML/BILD objects. You can move the arrows as you found by putting each in its own model and using the "active" buttons in model panel. There aren't good solutions to these problems. You could go back to the volume tracer approach and get movable, stretchable, recolorable rods but without arrowheads. In the future we wish to make BILD objects independently movable, deletable, colorable, and possibly resizable. I suspect this is at least a year away. By the way, you can avoid using a temporary file with BILD by using a StringIO object. Here's an example: http://www.cgl.ucsf.edu/pipermail/chimera-users/2008-March/002447.html Tom Miguel Ortiz Lombardia wrote:
Dear Tom,
Don't bother, I found how to do that with bild objects:
8<----------------------------- def needle(center,item):
f = open( "/tmp/tmp" + str(item) + ".bild", 'w' ) f.write( ".color green\n" ) f.write( ".sphere %6.2f %6.2f %6.2f 1\n" % (center[0]+15,center[1]+15,center[2]+15) ); f.write( ".arrow %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f .5 1.5 0.6\n" % ( center[0]+15,center[1]+15,center[2]+15, center[0],center[1],center[2]) ) f.close()
from chimera import selection, UserError from Midas.midas_text import makeCommand
atoms = [a for a in selection.currentAtoms()] if not atoms: raise UserError("No atoms selected")
item = 0 for a in atoms: item += 1 needle(a.coord(),item) makeCommand( 'open /tmp/tmp' + str(item) + '.bild' ) ----------------------------->8
However, it would be nice, for this purpose, that bild objects were 'stretchable' and that they would have a defined center of rotation, so they can be moved around. For the second thing, I can simply select the corf manually for each arrow, which is suboptimal, but not bad if you don't have many 'needles'. For the first problem, 'stretchability' I have to re-write the script for every particular 'needle' or rather
------------------------------------------------------------------------
find a compromise length... Perhaps there is a more elegant way of doing all these manipulations already implemented in chimera?
I'm attaching a figure to show what I am looking for :-)
Best regards,
Miguel
Début du message réexpédié :
De : Miguel Ortiz Lombardia <miguel.ortiz-lombardia@afmb.univ-mrs.fr> Date : 14 décembre 2008 15:09:20 HNEC À : Thomas Goddard <goddard@cgl.ucsf.edu> Objet : voodoo?
Dear Tom,
I'm naively trying to modify your molecular voodoo script to have needles pointing to selected residues (specifically to their CA atoms) I would really appreciate if you can help me with two probably simple questions. Firstly, this is my current code
8<----------------------------- def needle(center):
xyz_in = center xyz_out = center[0]+5,center[1]+5,center[2]+5
from chimera import selection selection.clearCurrent() from VolumePath import place_marker place_marker(xyz_in) place_marker(xyz_out)
from chimera import selection, UserError atoms = [a for a in selection.currentAtoms() if a.name == 'CA'] if not atoms: raise UserError("No CA atoms selected")
for a in atoms: needle(a.coord()) ------------------------------>8
And these are the questions:
1. Why the positions of the m1 markers don't correspond to those of the CA atoms? 2. How could I modify the code to make every marker go to a different set, so I can then rotate them one by one appropriately so the figure shows the 'needles' in different directions, so that I can label them later on without overlap?
I hope it isn't too silly...
Cheers,
-- Miguel Ortiz Lombardía !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! NEW ADDRESS !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Architecture et Fonction des Macromolécules Biologiques UMR6098, CNRS, Université Aix-Marseille I & II Case 932 163 Avenue de Luminy 13288 Marseille cedex 9 France Tel : +33(0) 491 82 55 93 Fax: +33(0) 491 26 67 20 e-mail: miguel.ortiz-lombardia@afmb.univ-mrs.fr Web: http://www.pangea.org/mol/spip.php?rubrique2
-- Miguel Ortiz Lombardía !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! NEW ADDRESS !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Architecture et Fonction des Macromolécules Biologiques UMR6098, CNRS, Université Aix-Marseille I & II Case 932 163 Avenue de Luminy 13288 Marseille cedex 9 France Tel : +33(0) 491 82 55 93 Fax: +33(0) 491 26 67 20 e-mail: miguel.ortiz-lombardia@afmb.univ-mrs.fr Web: http://www.pangea.org/mol/spip.php?rubrique2