[Chimera-users] programmatic representation

Eric Pettersen pett at cgl.ucsf.edu
Mon Feb 12 13:39:09 PST 2007


Hi Randy,
	The second argument to Midas.represent() is polymorphic, and if it  
is a list then is is expected to be a list of atoms.  You're giving  
it a list of models, which results in the 'drawMode' attribute of  
those models being set (to no effect).  Perhaps the polymorphism of  
the second argument could be improved to handle lists of models (or  
residues), but right now it doesn't. My suggestion is to use a  
Selection object based on your list of models, which Midas.represent 
() can handle, perhaps like so:

       self.model = ReadSDF.readSDF(tmpfile.name)
       chimera.openModels.add(self.model)

       from chimera.selection import ItemizedSelection
       sel = ItemizedSelection()
       sel.add(self.model)
       Midas.represent('cpk', sel)

--Eric

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


On Feb 12, 2007, at 12:28 PM, Randy Heiland wrote:

> I'd like to be able to set the representation (wire, stick, bs,  
> cpk) of
> a model programmatically, in this case, from a plugin.  I was  
> trying the
> following, but the newly displayed model would always be displayed in
> wire:
>
>       self.model = ReadSDF.readSDF(tmpfile.name)
>       chimera.openModels.add(self.model)
>
>       #Midas.represent('stick', self.model)
>       Midas.represent('cpk', self.model)
>
> Suggestions?
> thanks, Randy
>
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

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


More information about the Chimera-users mailing list