Skip to content

Commit

Permalink
InSty [docs and checks improvements]
Browse files Browse the repository at this point in the history
  • Loading branch information
karolamik13 committed Sep 12, 2024
1 parent 11738ad commit 95a9a0d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,8 @@ def calcStatisticsInteractions(data, **kwargs):
from [OK98]_ ('IB_solv'). To use non-solvent-mediated entries ('IB_nosolv') from [OK98]_ or
solvent-mediated values obtained for InSty paper ('CS', under preparation) change
`energy_list_type` parameter.
If energy information is not available, please check whether the pair of residues is listed in
the "tabulated_energies.txt" file, which is localized in the ProDy directory.
:arg data: list with interactions from calcHydrogenBondsTrajectory() or other types
:type data: list
Expand Down Expand Up @@ -3445,17 +3447,20 @@ def saveInteractionsPDB(self, **kwargs):
:arg energy: sum of the energy between residues
default is False
:type energy: True, False
:type energy: bool
"""

energy = kwargs.pop('energy', False)

if not hasattr(self, '_interactions_matrix') or self._interactions_matrix is None:
raise ValueError('Please calculate interactions matrix first.')

if not isinstance(energy, bool):
raise TypeError('energy should be True or False')

import numpy as np
from collections import Counter

energy = kwargs.pop('energy', False)

atoms = self._atoms
interaction_matrix = self._interactions_matrix
interaction_matrix_en = self._interactions_matrix_en
Expand Down Expand Up @@ -3629,7 +3634,7 @@ def showCumulativeInteractionTypes(self, **kwargs):
:arg energy: sum of the energy between residues
default is False
:type energy: True, False
:type energy: bool
"""

import numpy as np
Expand All @@ -3644,13 +3649,15 @@ def showCumulativeInteractionTypes(self, **kwargs):

atoms = self._atoms
energy = kwargs.pop('energy', False)


if not isinstance(energy, bool):
raise TypeError('energy should be True or False')

ResNumb = atoms.select('protein and name CA').getResnums()
ResName = atoms.select('protein and name CA').getResnames()
ResChid = atoms.select('protein and name CA').getChids()
ResList = [ i[0]+str(i[1])+i[2] for i in list(zip([ aa_dic[i] for i in ResName ], ResNumb, ResChid)) ]


if energy == True:
matrix_en = self._interactions_matrix_en
matrix_en_sum = np.sum(matrix_en, axis=0)
Expand All @@ -3668,7 +3675,6 @@ def showCumulativeInteractionTypes(self, **kwargs):
plt.show()

return matrix_en_sum


else:
replace_matrix = kwargs.get('replace_matrix', False)
Expand Down

0 comments on commit 95a9a0d

Please sign in to comment.