changing position for a residue using python

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? Best JD

Hi JD, I can't say anything about python, but maybe you could just use the Chimera command "resrenumber" (GUI is Tools... Structure Editing... Renumber Residues) instead? For example: resrenumber 231 :.b to renumber chain B starting at 231. I guess you could run the command via python if necessary. Elaine ----- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco 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?
Best JD

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

Thanks a lot, Eric, I was close. Elaine, I had no idea!!! Thank you very much! Cheers, JD **************************** Dr. Jean-Didier Maréchal Lecturer The Computational Biotechnological Chemistry Team Unitat de Química Física Departament de Química Universitat Autònoma de Barcelona Edifici C.n. 08193 Cerdanyola (Barcelona) Tel: +34.935814936 e-mail: JeanDidier.Marechal@uab.es www: http://g <http://asklipio.qf.uab.es>ent.uab.cat/jdidier<http://ent.uab.es/jdidier> 2013/3/27 Eric Pettersen <pett@cgl.ucsf.edu>
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.identirely. 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
participants (4)
-
Elaine Meng
-
Eric Pettersen
-
Jean-Didier Maréchal
-
Jean-Didier Maréchal