biopython/biopython — pull request #207 by lennax (2013-08-08 19:50:50+00:00)
Title: PDB PERMISSIVE parsing: set missing occupancy to 1

I've been dealing with lots of software-produced malformed PDB files lately. In my specific use case, I want to remove atoms that have occupancy 0.0 in an Xtal-produced file from the PDB, but I want to keep all atoms predicted by software.

Occupancy and b-factors etc. are only meaningful for actual X-ray produced files. Many software packages simply skip writing them. Having the default occupancy be 0 means those atoms would be treated as missing. I think it's reasonable to treat missing occupancy as 1 in permissive mode - note that the original code comment is unsure whether to default to 1 or 0.

An alternative would be to add another keyword argument to the constructor (e.g. allow_blank_occupancy). This has the advantage of not changing the behavior but the disadvantage of another argument...

I could also make my own workaround and leave the behavior as is, but keep the unit test! :)