Is there a pre-existing tool which will tidy up the numbering of a PDB file?

Firstly, I would like to re-number the residues on inserts to make the icode an actual residue in the chain (by that I mean it's own number, shifting everything after it, so 45A becomes 46).

Secondly, I would also like to re-number so that each residue is one after another, as there are skips in the numbering, in spite of the two residues being physically next to each other.

I could do this in-house with a python script, but I thought I would ask specifically if there is a library or pre-existing tool?

Worst case scenario I have found this Perl script that does similar.


  • 1
    $\begingroup$ "make the icode an actual residue in the chain" -- something is confused here. Insertion code is part of the residue id, together with the sequence number. $\endgroup$
    – marcin
    Feb 1, 2018 at 17:26
  • $\begingroup$ @marcin Yes sorry you're right it is, but for example when using the biopython PDB to FASTA parser it is not recognized and the chain is truncated from beyond there. So either I would need to ignore it (as I am at the moment) or change it from 1, 2, 3, 3A, 4 to 1, 2, 3, 4, 5. $\endgroup$
    – TW93
    Feb 1, 2018 at 17:54
  • $\begingroup$ @TW93 You almost certainly want to either ignore them, or deal with them separately. They usually represent different wildtypes/isoforms. E.g. the same protein within different species which contains some minor sequence alternations! If you include the same residue twice or more, obviously, that will cause steric clashes and mess up any calculations that you run! $\endgroup$
    – Aalawlx
    Mar 5, 2018 at 5:58
  • $\begingroup$ I think there is a confusion here between insertion code and alternative location ID. Insertion codes allow for unified numbering between proteins of slightly different sequences, but everything with a unique residue ID (residue number and insertion code) is a separate residue in the chain and cannot be ignored. The question asked by the OP is hence valid. You wouldn't want to have multiple residues with the same residue ID but different alternative location IDs renumbered, but that wasn't the question. $\endgroup$
    – jgreener
    Sep 17, 2019 at 11:24

2 Answers 2


Several years ago we have written a tool for this: http://kodomo.fbb.msu.ru/~avkitex/projects/pdbparser.html https://github.com/avkitex/pdbparserTools

The description is only in Russian but you can contact the author.

  • 1
    $\begingroup$ Could you explain how this program solves the question? Adding an example will be helpful to all users $\endgroup$
    – llrs
    Dec 14, 2018 at 10:52

The pdb-tools suite has pdb_delinsertion and pdb_reres for this task. Something like:

pdb_delinsertion 1CTF.pdb | pdb_reres > out.pdb

should work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.