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