[chimera-dev] changing position for a residue using python

Eric Pettersen pett at cgl.ucsf.edu
Wed Mar 27 11:07:48 PDT 2013


On Mar 27, 2013, at 10:44 AM, Jean-Didier Maréchal wrote:

> Hi all,
> 
> I have a problem with a prot and it seems that renumbering could help. I'd like to automatically add 230 to the residue number of the aa of my second chain. As I feared, when looping other residue to change res.id.position, my script fails as position can not be modified. How could I do this? Should I delete position and re-create it?

Though you can't modify res.id.position, you can overwrite res.id entirely.  So something like:

from chimera import MolResId
for r in residues:
	r.id = MolResId(r.id.chainId, r.id.position+230, r.id.insertionCode)

--Eric


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20130327/a056be75/attachment.html>


More information about the Chimera-dev mailing list