douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.

Home Page:https://crates.io/crates/pdbtbx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atom serial numbers wrap at 9999

DocKDE opened this issue · comments

Okay, last one for today:
I noticed the atom serial number in the PDB struct wraps around at 9999 even if that's not the case in the input PDB file. Is this standard behavior? Because I seem to recall that 5 columns are reserved for this value so it could contain larger numbers, no?
Is that something that could be changed with a separate method or an argument?
Sorry for pestering you lately.
Have a great weekend!

According to the wwPDB v3.30 definition of PDB files atom serial numbers cannot exceed 99999, so you are totally correct. I probably misread the definition (something about ranges including or excluding the last number and 0 based or 1 based indexing), so the both the validation and parsing of PDB files were erroneous. The problem is fixed now and I will release a patch on crates.io to make it easy for you to work with your files.

I am really grateful you 'pester' me lately, it is great to see your own code be used by other people, and you really helped me find some lingering bug! This bug is pretty interesting because I thought the atom serial number was capped at 9999 which is the reason I switched to mmCIF files in my project, and the only reason there is support for mmCIF files in this library. So were some good effects of making this error in the first place. Have a great weekend!