# [Chimera-users] Iterative Attribute Calculator Functions + regular expressions? Challenging Question!

Tom Goddard goddard at sonic.net
Wed Apr 20 11:45:13 PDT 2016

```Hi Drew,

A Chimera command to average atom or residue properties within a distance range of each specified residue would not be hard — it would be written in Python where you have access to all Chimera capabilities, probably 30 lines of Python code.  It would be good to think about exactly what you want.  With your charge example I guess you look at every atom within 5 Angstroms of a residue and average the charge for each of those atoms.  Would it include the charges on the atoms of the given residue?  You would weight all the charges equally, independent of distance from the residue?  In the kdHydrophobicity example, that is a residue property, not an atom property.  Would you average the kdHydrophobicity for all residues that have an atom within 5 Angstroms of some atom of the given residue?  Would the values for each nearby residue get equal weight, or is it weighted by the number of atoms in the residue, or number of atoms within the 5A range?  So there are lots of details and maybe you want to try different calculation rules.

If you are interested in fiddling with such Python code we can probably give you some starting code, but it would be good to know what you want to calculate in detail.

Tom

> On Apr 20, 2016, at 10:46 AM, Andrew Waight wrote:
>
> Hi All,
>
> Here's a question (probably) for the python capable.
>
> I have been recently using the Attribute Calculator quite a bit. We are looking at individual residue local environments by averaging things like kdhydrophobicity or charge within a ~5A distance of a selected residue.
>
> Would there be a way to automatically perform such a calculation on each residue (for a given distance) and assign it an attribute like averageHydrophobiticy or averageCharge? I am a little surprised that no one has already asked this question as it could be very useful. Such an average local value (albeit simplified) is probably very important to residue properties themselves. Thanks!
>
>
>                                    Drew Waight
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

```