[chimera-dev] saving custom molecular attributes

Eric Pettersen pett at cgl.ucsf.edu
Mon Jan 14 16:53:27 PST 2008


If you are writing any code that adds non-standard attributes to  
Atoms/Molecules/Residues/Bonds and you want those attributes  
preserved in sessions, you can now use the registerAttribute()  
function to do this.  I've appended more info below.

--Eric


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

Custom Molecular Attributes

If you add non-standard attributes to Molecules/Residues/Bonds/Atoms  
that you want preserved in restored sessions, use SimpleSession's  
restoreAttribute() function, e.g,:
   import chimera
   from SimpleSession import registerAttribute
   registerAttribute(chimera.Molecule, "qsarVal")
Note that the Define Attribute tool automatically does this  
registration, so it's only attributes that you add directly from your  
own Python code that need to be registered as above. Also, only  
attributes whose values are recoverable from their repr() can be  
saved by this mechanism, so values that are C++ types (Atoms,  
MaterialColors, etc.) could not be preserved this way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20080114/989ba15c/attachment.html>


More information about the Chimera-dev mailing list