Skip to content

Commit

Permalink
fix filter filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Jun 7, 2024
1 parent ec001c7 commit 7010ce5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions prody/proteins/waterbridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -1194,23 +1194,24 @@ def filterStructuresWithoutWater(structures, min_water=0, filenames=None):
have_filenames = len(filenames)>0

new_structures = []
numStructures = len(structures)
for i, struct in enumerate(reversed(structures)):
title = struct.getTitle()
waters = struct.select('water and name O')

if waters == None:
LOGGER.warn(title+" doesn't contain water molecules")
if have_filenames:
filenames.pop(-i)
filenames.pop(numStructures-i-1)
continue

numWaters = waters.numAtoms()
if numWaters < min_water:
LOGGER.warn(title+" doesn't contain enough water molecules ({0})".format(numWaters))
if have_filenames:
filenames.pop(-i)
filenames.pop(numStructures-i-1)
continue

new_structures.append(struct)

return new_structures
return list(reversed(new_structures))

0 comments on commit 7010ce5

Please sign in to comment.