[Chimera-users] Chemical groups

Eric Pettersen pett at cgl.ucsf.edu
Tue Feb 23 11:31:42 PST 2010


On Feb 23, 2010, at 4:16 AM, Mauro Truglio wrote:

> Hi,
> I'm a newbie, and I'd like to use Chimera to recognize functional  
> groups on a structure or a ligand, and I need it to write a file  
> with the atoms involved. Now, if I do Select>Chemistry>functional  
> group , search for one, and export the results through "write list",  
> it exports a raw list of atoms without any specification of which  
> atom is involved in which f.g..
> It could be useful to add some sort of identifier, like:
>
> FG1:
> atom
> atom
> atom
>
> FG2:
> atom
> atom
> atom
>
> How can I do that? Already tried to modify __init__.py in  
> ChemGroups, but all I obtain is a list of physical addresses of  
> atoms, e.g.:
>
> Group number 1 :
> [<_chimera.Atom object at 0xa455db8>, <_chimera.Atom object at  
> 0xa455dd0>, <_chimera.Atom object at 0xa455de8>, <_chimera.Atom  
> object at 0xa455e00>, <_chimera.Atom object at 0xa455e18>]
>
> Group number 2 :
> [<_chimera.Atom object at 0xa455e30>, <_chimera.Atom object at  
> 0xa455e48>, <_chimera.Atom object at 0xa455e60>, <_chimera.Atom  
> object at 0xa455e78>, <_chimera.Atom object at 0xa455e90>]

Oooh, you were so close!  It's seems you're Python savvy, so here's  
what you need to know:  printing a list of Atoms prints their repr()s  
-- you need to print their str()s.  Assuming that your list of Atoms  
was in a variable called 'grp', then either:

for a in grp:
	print a,
print

or:

print [str(a) for a in grp]

The latter will have surrounding brackets whereas the former won't.   
Let me know if you need more info than this.

--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/20100223/c9e58485/attachment.html>


More information about the Chimera-users mailing list