samirelanduk / atomium

Python macromolecular parsing (with .pdb/.cif/.mmtf parsing and production)
https://atomium.bio
MIT License
102 stars 19 forks source link

TER line doesn't comply to PDB TER records spec #25

Open Koesed96 opened 4 years ago

Koesed96 commented 4 years ago

Description of Feature

The current terminal line only contains

TER

and doesn't comply to the PDB TER records spec where the TER line is specified as

The TER record has the same residue name, chain identifier, sequence number and insertion code as the terminal residue. The serial number of the TER record is one number greater than the serial number of the ATOM/HETATM preceding the TER.

This leads to errors in programs using PDBs written by atomium. I found this problem trying to use MMligner with atomium written PDBs

samirelanduk commented 4 years ago

Hi, thanks for flagging this.

I think my most recent commit should fix this. If you clone branch 1.0.4, can you confirm this new version of atomium produces PDBs that work with MMligner now? If it does I'll publish the new version to PyPI and the new version will be pip installable.

Koesed96 commented 4 years ago

Hi, thanks for you fast reply.

I have tested your new version and the PDBs written by atomium now work with MMligner, but I think there is still one minor bug. The ID number of the TER line is the same as the ID of the previous atom and not incremented by one. E.g.:

ATOM   2389  NZ  LYS A 311       1.870 -53.264 -30.854  1.00 66.28           N  
TER    2389      LYS A 311 
ATOM   2391  N   ILE B  13     -34.830 -66.476  -8.942  1.00 91.54           N  
samirelanduk commented 4 years ago

Hmmm - you're right, but fixing this will require a bigger overhaul of how saving is done in atomium. I will leave this issue open but publish the current fix as is so at least it will work with MMligner.