[Chimera-users] using CalcAttr from a Python script

Elaine Meng meng at cgl.ucsf.edu
Mon Feb 27 16:21:50 PST 2012


Hi Roger,
I must leave the programmer questions to others, but as for that error message:

It is probably because you need to create attribute for "molecules" (see the menu on the upper right area of the Attribute Calculator dialog) when trying to get the sum of residue values.

Your formula is fine.  Currently "sum" and "average" function calls are supported:<http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/calculator/calculator.html>

Best,
Elaine
----------
Elaine C. Meng, Ph.D. 
UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab
Department of Pharmaceutical Chemistry
University of California, San Francisco

On Feb 26, 2012, at 7:50 PM, Roger L. Chang wrote:

> Hi,
> 1) I need to get residue.areaSES for two separate selections (all polar
> amino acids and all nonpolar amino acids).  I have successfully generated
> a list of residue.areaSES using the GUI simply by selecting the residues
> of interest and then using the attribute calculator typing
> "residue.areaSES" in the formula box of the Attribute Calculator, which
> outputs the list to the Reply Log.  This is the data that I need, but I
> need to get it for >2000 PDB structures and would like to automate this
> analysis through a Python script.  I am somewhat new to Python and Chimera
> and don't yet know all the ins and outs yet.  I dug through the code and
> found a method "getResidueAttr" in the "ResidueDataWrapper" class from
> "CalcAttr".  This seems to be what I need, but I don't know the proper
> syntax to call it from my Python script.  Could someone please provide an
> example?
> 
> 2) I would like to sum the residue.areaSES values once I have them.  I
> tried "sum(residue.areaSES)" in the formula box of the Attribute
> Calculator in the GUI, but this returns the error "Formula evaluation
> error: expecting vector argument in function".  I'm not sure again on the
> proper syntax to use "sum()" in the Attribute Calculator.  If I knew how
> to generate/save the residue.areaSES data from the command line, I could
> just parse the saved file and sum the values in Python.  How can Attribute
> Calculator formulas be used from the command line, and if they can't, how
> can I save the residue.areaSES data to file from a Python script?
> 
> Thanks in advance,
> Roger





More information about the Chimera-users mailing list