Skip to content

Commit

Permalink
New parameter in getLigandInteractions
Browse files Browse the repository at this point in the history
  • Loading branch information
karolamik13 committed Oct 22, 2023
1 parent 57ad214 commit 9ba84b5
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3760,17 +3760,32 @@ def getLigandInteractions(self, **kwargs):
: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 """
:type filters: str
:arg include_frames: used with filters, it will leave selected keyword in orginal
lists, if False it will collect selected interactions in one list,
Use True to assign new selection using setLigandInteractions.
by default True
:type include_frames: True or False
"""

filters = kwargs.pop('filters', None)
include_frames = kwargs.pop('include_frames', True)
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]
if include_frames == False:
interactions = [element for group in self._interactions_traj for element in group]
filtered_lists = [item for item in interactions if filters in item]

return filtered_lists
if include_frames == True:
filtered_lists = []
for i in self._interactions_traj:
filtered_list = [item for item in i if filters in item]
filtered_lists.append(filtered_list)

return filtered_lists

else:
return self._interactions_traj

Expand Down

0 comments on commit 9ba84b5

Please sign in to comment.