Repository navigation
Load chemical component (ligand) CIF files lacking atom_site records - #1437
Merged
Merged
Conversation
parmed.load_file crashed with AttributeError on ligand CIF files, which carry atom records under _chem_comp_atom and bonds under _chem_comp_bond instead of _atom_site. Parse those categories into the Structure when atom_site is absent, and return an empty Structure for CIF files with no atom records instead of crashing in distance-based bond assignment. Fixes ParmEd#1431
|
That's great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1431.
parmed.load_fileraisedAttributeError: 'NoneType' object has no attribute 'getAttributeIndex'on chemical component CIF files because they have noatom_sitecategory. Their atom records live under_chem_comp_atomand bonds under_chem_comp_bond.When
atom_siteis absent,CIFFile.parsenow reads_chem_comp_atominto theStructure: atom names, elements, formal charges, one residue per distinctcomp_id, and coordinates frommodel_Cartn_*withpdbx_model_Cartn_*_idealas a fallback._chem_comp_bondrows becomestruct.bondsentries withQualitativeBondTypeorders, the same mapping_process_struct_connuses. Structures with bonds from_chem_comp_bondskipassign_bonds, so file-declared connectivity is not re-derived by template or distance heuristics. A CIF with no atom records returns an emptyStructureinstead of crashing inassign_bonds' voxel partitioning.A new regression test covers a 4-atom ligand fixture and an atom-less CIF.
pytest test/test_parmed_formats.pypasses locally on Python 3.9. With this branch,parmed.load_fileon the realATP.cifchemical component file returns aStructureholding all 47 atoms with deposited model coordinates.