Skip to content

Commit

Permalink
Filter in getLigandInteractions()
Browse files Browse the repository at this point in the history
  • Loading branch information
karolamik13 committed Oct 19, 2023
1 parent 814b151 commit 1732257
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3655,6 +3655,7 @@ def __init__(self, name='Unknown'):
self._interactions_traj = None
self._freq_interactors = None


def calcLigandInteractionsTrajectory(self, atoms, trajectory=None, filename=None, **kwargs):
"""Compute protein-ligand interactions for DCD trajectory or multi-model PDB
using PLIP library.
Expand Down Expand Up @@ -3753,12 +3754,26 @@ def calcLigandInteractionsTrajectory(self, atoms, trajectory=None, filename=None

return interactions_all


def getLigandInteractions(self, **kwargs):
"""Return the list of protein-ligand interactions."""

return self._interactions_traj

"""Return the list of protein-ligand interactions.
:arg filters: selection string of ligand with chain ID or interaction type
e.g. 'SBs' (HBs, SBs, HPh, PiStack, PiCat, HPh, watBridge)
:type filters: str """

filters = kwargs.pop('filters', None)
filtered_lists = []
interactions = [element for group in self._interactions_traj for element in group]

if filters != None:
filtered_lists = [item for item in interactions if filters in item]

return filtered_lists

else:
return self._interactions_traj


def getAtoms(self):
"""Returns associated atoms."""
Expand Down Expand Up @@ -3793,7 +3808,8 @@ def getFrequentInteractors(self, **kwargs):
"""Provide a dictonary with residues involved in the interaction with ligand
and their number of counts.
:arg selection: selection string of ligand with chain id
:arg selection: selection string of ligand with chain ID
e.g. MESA where MES is ligand resname and A is chain ID.
:type selection: str
:arg contacts_min: Minimal number of contacts which residue may form with ligand.
Expand Down

0 comments on commit 1732257

Please sign in to comment.