From 8d64b0037ce2f36ab9fadc256378a208a7dac9b9 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 15 Nov 2024 14:28:23 +0100 Subject: [PATCH] bug fix chainsHB no ligand --- prody/proteins/interactions.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 1dba0a7c1..88e796c56 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -710,9 +710,11 @@ def calcChHydrogenBonds(atoms, **kwargs): ChainsHBs = [ i for i in HBS_calculations if str(i[2]) != str(i[5]) ] if not ChainsHBs: - ligand_name = list(set(atoms.select('all not protein and not ion').getResnames()))[0] - ChainsHBs = [ ii for ii in HBS_calculations if ii[0][:3] == ligand_name or ii[3][:3] == ligand_name ] - + ligand_sel = atoms.select('all not protein and not ion') + if ligand_sel: + ligand_name = list(set(ligand_sel.getResnames()))[0] + ChainsHBs = [ ii for ii in HBS_calculations if ii[0][:3] == ligand_name or ii[3][:3] == ligand_name ] + return ChainsHBs