douweschulte / pdbtbx

A library to open/edit/save (crystallographic) Protein Data Bank (PDB) and mmCIF files in Rust.
https://crates.io/crates/pdbtbx
MIT License
49 stars 12 forks source link

Compress error messages for SEQRES #90

Closed douweschulte closed 2 years ago

douweschulte commented 2 years ago

Currently if for some reason SEQRES residues are misaligned the library spews out a huge list of errors, this should be compressed into a smaller footprint to aid the user in seeing the problem and not be demotived by the sheer amount of errors on their screen.

Proposal: Create a single error message with all errors for a single chain. So if chain A has all residues one atom shifted this should produce:

LooseWarning: Multiple SEQRES residues not conforming

     |
425  | SEQRES   1 H    7  ACE ARG GLN ALC SOQ LEU ZCL   
     |                    ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ ^^^

Found residues: ARG GLN ALC SOQ LEU ZCL LYS
(Message how to resolve this issue)

The found residues should be presented in the same formatting (amount of residues per line) as SEQRES records. Potentially it could be tried to implement a way to check if there is a simple shift that would make all (or most) residues valid. (Like shift one by removing the ACE in the example.)