From 29fcf15f95f19f92211283fefdd0a086da37d646 Mon Sep 17 00:00:00 2001 From: Peter Eastman Date: Mon, 6 Jan 2025 09:25:56 -0800 Subject: [PATCH] Fix exception with unknown residues (#322) --- pdbfixer/pdbfixer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pdbfixer/pdbfixer.py b/pdbfixer/pdbfixer.py index 749e000..720dd2d 100644 --- a/pdbfixer/pdbfixer.py +++ b/pdbfixer/pdbfixer.py @@ -150,10 +150,10 @@ def fromReader(cls, reader: PdbxReader) -> 'CCDResidueDefinition': residueName = block.getObj('chem_comp').getValue("id") - descriptorsData = block.getObj("pdbx_chem_comp_descriptor") - typeCol = descriptorsData.getAttributeIndex("type") - atomData = block.getObj('chem_comp_atom') + if atomData is None: + # The file doesn't contain any atoms, so report that no definition is available. + return None atomNameCol = atomData.getAttributeIndex('atom_id') symbolCol = atomData.getAttributeIndex('type_symbol') leavingCol = atomData.getAttributeIndex('pdbx_leaving_atom_flag')