[Chimera-users] Attribute Calculator by command line?
pett at cgl.ucsf.edu
Mon Dec 16 14:50:33 PST 2013
The command line is not a programming language. It has no conditional tests/execution, no math operators, no variables. You have to resort to Chimera's Python interface to do such things. That said, the script to compute and assign the attribute you want is pretty simple. If you put the lines below in a file that ends in ".py" and open that file with "open whatever.py" the attribute would be assigned and could be used in subsequent commands…
from Chimera import openModels, Molecule
for m in openModels.list(modelTypes=[Molecule]):
for a in m.atoms:
if a.areaSES == 0.0:
a.convexity = a.areasSAS / a.areaSES
In Python indentation is significant, so make sure it is preserved in the file you create.
UCSF Computer Graphics Lab
On Dec 16, 2013, at 1:33 PM, "Hurt, Darrell (NIH/NIAID) [E]" wrote:
> Too bad! If someone has a solution, I'd be happy to hear it, but if not, that's OK, too.
> Thanks Elaine!
> Darrell Hurt, Ph.D.
> Section Head, Computational Biology
> Bioinformatics and Computational Biosciences Branch (BCBB)
> 31 Center Drive, Room 3B62B, MSC 2135
> Bethesda, MD 20892-2135
> Office: 301-402-0095
> Mobile: 301-758-3559
> Web: BCBB Home Page<http://www.niaid.nih.gov/about/organization/odoffices/omo/ocicb/Pages/bcbb.aspx#niaid_inlineNav_Anchor>
> Twitter: @niaidbioit<https://twitter.com/niaidbioit>
> Disclaimer: The information in this e-mail and any of its attachments is confidential and may contain sensitive information. It should not be used by anyone who is not the original intended recipient. If you have received this e-mail in error please inform the sender and delete it from your mailbox or any other storage devices. National Institute of Allergy and Infectious Diseases shall not accept liability for any statements made that are sender's own and not expressly made on behalf of the NIAID by one of its representatives.
> From: Elaine Meng <meng at cgl.ucsf.edu<mailto:meng at cgl.ucsf.edu>>
> Reply-To: "chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu> List" <chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu>>
> Date: Monday, December 16, 2013 4:26 PM
> To: Darrell Hurt <darrellh at niaid.nih.gov<mailto:darrellh at niaid.nih.gov>>
> Cc: "chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu> List" <chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu>>
> Subject: Re: [Chimera-users] Attribute Calculator by command line?
> Hi Darrell,
> As you found, there isn't a command version of Attribute Calculator, sorry! Maybe one of the others can suggest a python solution?
> Elaine C. Meng, Ph.D.
> UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
> On Dec 16, 2013, at 11:59 AM, "Hurt, Darrell (NIH/NIAID) [E]" wrote:
> Hi Chimera friends,
> I'm trying to calculate convexity as demonstrated in the Attributes tutorial:
> I can do it with the graphical tools without a problem, but when I try to do it via the command line, I run into trouble. I cannot find any documentation on running the Attributes Calculator on the command line. I've tried using "setattr":
> setattr a convexity atom.areaSAS/atom.areaSES
> This command generates a new atom attribute called "convexity" for every atom, but the value of this attribute for every atom is literally "atom.areaSAS/atom.areaSES" instead of the calculated value.
> Is there a way to calculate a new attribute value on the command line within Chimera? Sorry to be so demanding…
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
More information about the Chimera-users