Added PERMISSIVE argument to MMCIFParser as in PDBParser.#5134
Added PERMISSIVE argument to MMCIFParser as in PDBParser.#5134piecole wants to merge 2 commits intobiopython:masterfrom
Conversation
…oblems in PDB file with e.g. duplicate atoms in a residue. Kept PERMISSIVE as default False to keep behaviour consistent with previous versions.
|
I am not the main Bio.PDB person, but anyway I would suggest to use lowercase for argument names to be consistent with Python conventions. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5134 +/- ##
==========================================
+ Coverage 85.52% 86.38% +0.86%
==========================================
Files 282 282
Lines 59497 59506 +9
==========================================
+ Hits 50882 51404 +522
+ Misses 8615 8102 -513 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Error still happens with clean Biopython install. Likely due to new NumPy version since this does not occur with NumPy <2.4, although there are relevant depreciation warnings. As far as I understand the error is unrelated to my PR. Opened an issue at #5135. NumPy 2.4: Numpy 1.26.4 (also works in 2.3.5): |
Included as uppercase PERMISSIVE to be consistent with the PERMISSIVE arg in Bio.PDB.PDBParser. Can change if requested. |
I hereby agree to dual licence this and any previous contributions under both
the Biopython License Agreement AND the BSD 3-Clause License.
I have read the
CONTRIBUTING.rstfile, have runpre-commitlocally, and understand that continuous integration checks will be used to
confirm the Biopython unit tests and style checks pass with these changes.
I have added my name to the alphabetical contributors listings in the files
NEWS.rstandCONTRIB.rstas part of this pull request, am listedalready, or do not wish to be listed. (This acknowledgement is optional.)
Added PERMISSIVE argument to MMCIFParser as this is already present (and default True) in PDBParser. To allow problematic MMCIF files that include duplicate atoms in a residue. Kept PERMISSIVE as default False in MMCIFParser to keep behaviour consistent with previous versions unless specified.
Also added _handle_PDB_exception similarly to PDBParser to handle this by wrapping the already imported PDBConstructionException and PDBConstructionWarning.
Previously could not open .cif version of structure 9JXF due to the below error, but can now with PERMISSIVE = True.
"Bio.PDB.PDBExceptions.PDBConstructionException: Atom N defined twice in residue <Residue GLN het= resseq=21 icode= >"
Did not make this argument as permissive as it is in PDBParser, currently just allowing duplicate atoms, but happy to if there are example .cif structures that need it to be more permissive.