Is there a standard way to clean a PDB file and re-number its residues?
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.