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
54 stars 17 forks source link

Fall back strategy for headerless PDB files. #122

Closed OWissett closed 6 months ago

OWissett commented 7 months ago

I have been working with a bunch of PDB files without a header, and found that the identifier isn't parsed since that comes from the HEADER records.

A work around I have is to fallback to using the file name. I think this should be added to the library, since it makes sense to load the identifier from the file name, as you may have multiple different versions of a pdb file with the same HEADER record too.

We can add this to the ReadOptions struct.

douweschulte commented 7 months ago

Sounds like a good plan. To be sure I understand you correctly is it the goal to make the fallback, if there is no header use the file name, default behaviour and make renaming to the file name an option for ReadOptions? That sounds perfect to me. Although a bit of CA should be given to the raw parse methods, because they maybe do not need this fallback support to prevent breaking any existing code where a filename is not obviously available.

OWissett commented 6 months ago

123 I think this issue is essentially a more extreme version of this issue.