[Chimera-users] batch writing of attributes
Eric Pettersen
pett at cgl.ucsf.edu
Tue Jan 14 11:50:47 PST 2014
Hi Jay,
We thought as much really. Well, you are going to have to use a Python script. The good news is that it's a really simple Python script. Put the following in a file whose name ends in ".py":
from chimera import openModels, Molecule
for m in openModels.list(modelTypes=[Molecule]):
from OpenSave import osOpen
f = osOpen("~/surfData/%s.data" % m.name, "w")
for a in m.atoms:
print>>f, a, getattr(a, "areaSES", 0.0)
f.close()
The indentation matters, so make sure to preserve it.
Then once you open your model and surface it, you can run the above script simply by opening it with the "open" command. It will create a file with a list of atoms and corresponding surface areas. The file will be named <model name>.data and it will be in the "surfData" folder in your home directory, so make sure that folder exists beforehand or modify the script to have it go to another location.
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu
On Jan 14, 2014, at 5:56 AM, "Eifler, Jay Q. (UMKC-Student)" wrote:
> Actually I'm doing ab-initio quantum mechanical calculations and need
> to analyze on a atom and residue basis. I've already been able to
> save the atom and residue results but can't figure out how to automate
> it since you have got to click buttons in the render/select attribute. The
> Chimera notes seem to imply it should be possible to save attributes to
> file. However, areaSAS is supposed to be an attribute but doesn't seem
> to belong to the model attributes.
> From: Eric Pettersen
> Sent: Monday, January 13, 2014 4:05 PM
> To: Eifler, Jay Q. (UMKC-Student)
> Cc: <Chimera-users at cgl.ucsf.edu> List
> Subject: Re: [Chimera-users] batch writing of attributes
>
> On Jan 11, 2014, at 1:58 PM, Jay Eifler wrote:
>
>>
>> I'm trying to automate saving the areaSAS for a bunch
>> of models. I've got no problem loading the models, etc.
>> The problem is simply how do I use command line
>> arguments to save the areaSAS. I've tried writesel. This
>> works all fine in Render/Select by attribute simply
>> because it has a feature to save the areaSAS to a file.
>> Thanks.
>
> Hi Jay,
> Do you really need the values on a per-atom basis? If you just need the grand total, it's reported in the reply log so you could just open and surface your structures one by one via a script (one by one to avoid possibly running out of memory) and then afterward save the reply log contents to a file manually (there's a "Save" button on the reply log).
>
> --Eric
>
> Eric Pettersen
> UCSF Computer Graphics Lab
> http://www.cgl.ucsf.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140114/aaad2365/attachment.html>
More information about the Chimera-users
mailing list