Hi,
I need to renumber residues after building a model using a list that maps residue indexes (0,1,2...) to residue numbers (1390,1391,1392...).
The residue numbers list is not continuous, for example: [..., 1400, 1401, 1450, 1451,...] thus I cannot use rename_segments() method, which takes only the number of first residue.
I tried with:
class MyModel(automodel): num_map = None
def fix_numbering(self): for old_resi, new_resi in zip(self.residues, self.num_map): old_resi.num = str(new_resi)
def user_after_single_model(self): self.fix_numbering()
where num_map is assigned to [..., 1400, 1401, 1450, 1451,...]: m = MyModel(...) m.num_map = [..., 1400, 1401, 1450, 1451,...]
and it would be fine, but I get the residue numbers in wrong columns of the PDB:
ATOM 1 N SER A 1390 37.882 25.941 -19.658 1.00 8.49 N ATOM 2 CA SER A 1390 36.454 26.059 -20.028 1.00 8.49 C ATOM 3 CB SER A 1390 35.958 24.759 -20.682 1.00 8.49 C ATOM 4 OG SER A 1390 36.013 23.692 -19.747 1.00 8.49 O ATOM 5 C SER A 1390 35.622 26.326 -18.821 1.00 8.49 C ATOM 6 O SER A 1390 36.138 26.652 -17.753 1.00 8.49 O
instead of:
ATOM 1 N SER C1390 37.882 25.941 -19.658 1.00 8.49 N ATOM 2 CA SER C1390 36.454 26.059 -20.028 1.00 8.49 C ATOM 3 CB SER C1390 35.958 24.759 -20.682 1.00 8.49 C ATOM 4 OG SER C1390 36.013 23.692 -19.747 1.00 8.49 O ATOM 5 C SER C1390 35.622 26.326 -18.821 1.00 8.49 C ATOM 6 O SER C1390 36.138 26.652 -17.753 1.00 8.49 O
If, for test, I use rename_segments() with renumber_residues=[1390], the position if the residue numbers is fine.
The problem happens only if the my residue numbers have four digits.
I use modeller version 14.
Thanks in advance for your help, Jan Kosinski
On 9/4/14, 9:33 AM, Jan Kosinski wrote: > class MyModel(automodel): > num_map = None > > def fix_numbering(self): > for old_resi, new_resi in zip(self.residues, self.num_map): > old_resi.num = str(new_resi) > > def user_after_single_model(self): > self.fix_numbering() ... > and it would be fine, but I get the residue numbers in wrong columns of > the PDB:
Modeller residue numbers are actually 5-character strings (they include the 1-character PDB insertion code at the end). When you assign to .num there's some logic to pad the numbers so they look right when they get written out to PDB, but there's a small bug in Modeller here specifically for 4-digit residue numbers. I've just fixed this, so it'll be in the next Modeller release. For now you can work around it by explicitly padding yourself (with a blank insertion code), e.g. by replacing old_resi.num = str(new_resi) with old_resi.num = "%4d " % new_resi
Ben Webb, Modeller Caretaker
Perfect, this works!
Thanks! Jan
On 09/04/2014 08:24 PM, Modeller Caretaker wrote: > On 9/4/14, 9:33 AM, Jan Kosinski wrote: >> class MyModel(automodel): >> num_map = None >> >> def fix_numbering(self): >> for old_resi, new_resi in zip(self.residues, self.num_map): >> old_resi.num = str(new_resi) >> >> def user_after_single_model(self): >> self.fix_numbering() > ... >> and it would be fine, but I get the residue numbers in wrong columns of >> the PDB: > > Modeller residue numbers are actually 5-character strings (they > include the 1-character PDB insertion code at the end). When you > assign to .num there's some logic to pad the numbers so they look > right when they get written out to PDB, but there's a small bug in > Modeller here specifically for 4-digit residue numbers. I've just > fixed this, so it'll be in the next Modeller release. For now you can > work around it by explicitly padding yourself (with a blank insertion > code), e.g. by replacing > old_resi.num = str(new_resi) > with > old_resi.num = "%4d " % new_resi > > Ben Webb, Modeller Caretaker
participants (2)
-
Jan Kosinski
-
Modeller Caretaker