From 65919f2688378c3972e96a502022fc3164045ea7 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 12 Apr 2024 13:54:22 +0200 Subject: [PATCH] fix consideredAtoms errors --- prody/proteins/waterbridges.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prody/proteins/waterbridges.py b/prody/proteins/waterbridges.py index e1f9e51e8..a13da5971 100644 --- a/prody/proteins/waterbridges.py +++ b/prody/proteins/waterbridges.py @@ -385,9 +385,17 @@ def calcWaterBridges(atoms, **kwargs): if outputType not in ['info', 'atomic', 'indices']: raise TypeError('Output can be info, atomic or indices.') + water = atoms.select('water') + if water is None: + raise ValueError('atoms has no water so cannot be analysed with WatFinder') + relations = RelationList(len(atoms)) - consideredAtoms = ~atoms.select( + tooFarAtoms = atoms.select( f'water and not within {distWR} of protein') + if tooFarAtoms is None: + consideredAtoms = atoms + else: + consideredAtoms = ~tooFarAtoms waterHydrogens = consideredAtoms.select('water and hydrogen') or [] waterOxygens = consideredAtoms.select('water and oxygen')