Skip to content

Commit

Permalink
Merge branch 'main' of github.com:prody/ProDy into deformAtoms_atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 8, 2024
2 parents e772280 + c49a2b2 commit 87c5de6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions prody/proteins/waterbridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def auto(it=count()):

from prody import LOGGER, SETTINGS
from prody.atomic import Atom, Atomic, AtomGroup
from prody.atomic.flags import DEFAULTS
from prody.ensemble import Ensemble
from prody.measure import calcAngle, calcDistance
from prody.measure.contacts import findNeighbors
Expand Down Expand Up @@ -1297,7 +1298,7 @@ def findClusterCenters(file_pattern, **kwargs):
:type file_pattern: str
:arg selection: selection string
by default water and name OH2 is used
by default 'water and name "O.*"' is used
:type selection: str
:arg distC: distance to other molecules
Expand All @@ -1317,7 +1318,7 @@ def findClusterCenters(file_pattern, **kwargs):
import glob
import numpy as np

selection = kwargs.pop('selection', 'water and name OH2')
selection = kwargs.pop('selection', 'water and name "O.*"')
distC = kwargs.pop('distC', 0.3)
numC = kwargs.pop('numC', 3)
filename = kwargs.pop('filename', None)
Expand All @@ -1333,8 +1334,13 @@ def findClusterCenters(file_pattern, **kwargs):
removeResid = []
removeCoords = []
for ii in range(len(coords_all)):
sel = coords_all.select('water within '+str(distC)+' of center',
center=coords_all.getCoords()[ii])
if 'water' in selection.split() or np.any([water in selection.split() for water in DEFAULTS['water']]):
sel = coords_all.select('water within '+str(distC)+' of center',
center=coords_all.getCoords()[ii])
else:
sel = coords_all.select(str(selection)+' within '+str(distC)+' of center',
center=coords_all.getCoords()[ii])

if sel is not None and len(sel) <= int(numC):
removeResid.append(coords_all.getResnums()[ii])
removeCoords.append(list(coords_all.getCoords()[ii]))
Expand Down

0 comments on commit 87c5de6

Please sign in to comment.