Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InSty - changes in calcStatisticsInteractions #1948

Merged
merged 31 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
66786ad
Energy optional in calcStatisticsInteractions() [InSty]
karolamik13 Sep 3, 2024
8ffaed3
Merge branch 'interactions' of github.com:karolamik13/ProDy into inte…
karolamik13 Sep 3, 2024
86714f4
HIS/HSD/HSP added to tabulated_energies.txt; bug fix in get_energy()
karolamik13 Sep 4, 2024
dfc9205
Merge branch 'prody:main' into interactions
karolamik13 Sep 4, 2024
3c7fde9
reference/energy added [InSty]
karolamik13 Sep 4, 2024
285ae4d
Merge branch 'interactions' of github.com:karolamik13/ProDy into inte…
karolamik13 Sep 4, 2024
1e16368
HSE/HSD/HSP removed from tabulated_energies.txt and get_energy() is m…
karolamik13 Sep 4, 2024
d5c64c2
new function - checkNonstandardResidues()
karolamik13 Sep 4, 2024
0263b04
check for checkNonstandardResidues()
karolamik13 Sep 4, 2024
e22ff3d
More info in docs about energies
karolamik13 Sep 5, 2024
75fbd58
more info in docs InSty
karolamik13 Sep 5, 2024
1e15ef9
improvement in the non-standard residues in get_energy
karolamik13 Sep 5, 2024
9f2484b
new function saveInteractionsAsDummyAtoms() is added
karolamik13 Sep 7, 2024
def37bb
saveInteractionsAsDummyAtoms fix with kwargs
karolamik13 Sep 8, 2024
6277f1d
improvements of checkNonstandardResidues()
karolamik13 Sep 9, 2024
286ceb8
getInteractions - replace option for trajectory
karolamik13 Sep 10, 2024
3a06083
getInteractions - replace for a single PDB interactions
karolamik13 Sep 10, 2024
d86f7b8
getTimeInteractions() improvement to include selection replacement
karolamik13 Sep 10, 2024
4b5d687
showFrequentInteractors() [InSty] improvement - return dict with resi…
karolamik13 Sep 10, 2024
d5de489
addMissingAtoms() [fixer.py] - keep_ids added
karolamik13 Sep 11, 2024
6c10c46
typo in addMissingAtoms
karolamik13 Sep 11, 2024
cf86d94
typo found by James
karolamik13 Sep 11, 2024
11738ad
InSty - typos and TypeError fixed [James comments]
karolamik13 Sep 11, 2024
95a9a0d
InSty [docs and checks improvements]
karolamik13 Sep 12, 2024
860c7b3
fix typos
jamesmkrieger Sep 12, 2024
0ffa953
fix replace type
jamesmkrieger Sep 12, 2024
e1f4c6f
fix pkg_resources for PY3K
jamesmkrieger Sep 12, 2024
370e561
fix checkNonstandardResidues
jamesmkrieger Sep 12, 2024
e0f4d10
rename putDUMatom
jamesmkrieger Sep 12, 2024
670db54
add and for readability
jamesmkrieger Sep 12, 2024
2db6ea9
another typo fix
jamesmkrieger Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,13 @@ def get_energy(pair, source):
try:
jamesmkrieger marked this conversation as resolved.
Show resolved Hide resolved
# Python 3
with pkg_resources.path('prody.proteins', 'tabulated_energies.txt') as file_path:
data = np.loadtxt(file_path, skiprows=1, dtype=str)
data = np.loadtxt(file_path, dtype=str)
except:
# Python 2.7
import pkg_resources
file_path = pkg_resources.resource_filename('prody.proteins', 'tabulated_energies.txt')
with open(file_path) as f:
data = np.loadtxt(f, skiprows=1, dtype=str)

data = np.loadtxt(f, dtype=str)

sources = ["IB_nosolv", "IB_solv", "CS"]
aa_pairs = []
Expand All @@ -180,21 +179,32 @@ def get_energy(pair, source):

lookup = pair[0]+pair[1]

return data[np.where(np.array(aa_pairs)==lookup)[0]][0][2:][np.where(np.array(sources)==source)][0]
try:
data_results = data[np.where(np.array(aa_pairs)==lookup)[0]][0][2:][np.where(np.array(sources)==source)][0]
except ImportError:
karolamik13 marked this conversation as resolved.
Show resolved Hide resolved
raise ImportError('Please replace non-standard names of residues with standard names.')

return data_results


def showPairEnergy(data, **kwargs):
"""Return energies when a list of interactions is given. Energies will be added to each pair of residues
at the last position in the list. Energy is based on the residue types and not on the distances.
The unit of energy is kcal/mol. The energies defined as 'IB_nosolv', 'IB_solv' are taken from XX and
'CS' from YY.
The unit of energy is kcal/mol. The energies defined as 'IB_nosolv', 'IB_solv' are taken from [OK98]_ and
'CS' from InSty paper.
jamesmkrieger marked this conversation as resolved.
Show resolved Hide resolved

:arg data: list with interactions from calcHydrogenBonds() or other types
:type data: list

:arg energy_list_type: name of the list with energies
default is 'IB_solv'
:type energy_list_type: 'IB_nosolv', 'IB_solv', 'CS'


.. [OK98] Keskin O., Bahar I., Badretdinov A.Y., Ptitsyn O.B., Jernigan R.L.,
Empirical solvet-mediated potentials hold for both intra-molecular and
inter-molecular inter-residues interactions,
*Protein Science* **1998** 7: 2578–2586.
"""

if not isinstance(data, list):
Expand Down Expand Up @@ -1988,12 +1998,20 @@ def calcStatisticsInteractions(data, **kwargs):
for element in elements:
if element not in stats:
values = [t[1] for t in interactions_list if t[0] == element]
stats[element] = {
"stddev": np.round(np.std(values),6),
"mean": np.round(np.mean(values),6),
"weight": np.round(float(len(values))/len(data), 6),
"energy": get_energy([element.split('-')[0][:3], element.split('-')[1][:3]], energy_list_type)
}

try:
stats[element] = {
"stddev": np.round(np.std(values),6),
"mean": np.round(np.mean(values),6),
"weight": np.round(float(len(values))/len(data), 6),
"energy": get_energy([element.split('-')[0][:3], element.split('-')[1][:3]], energy_list_type)
}
except:
karolamik13 marked this conversation as resolved.
Show resolved Hide resolved
stats[element] = {
"stddev": np.round(np.std(values),6),
"mean": np.round(np.mean(values),6),
"weight": np.round(float(len(values))/len(data), 6)
}

statistic = []
for key, value in stats.items():
Expand All @@ -2002,8 +2020,11 @@ def calcStatisticsInteractions(data, **kwargs):
LOGGER.info(" Average [Ang.]: {}".format(value['mean']))
LOGGER.info(" Standard deviation [Ang.]: {0}".format(value['stddev']))
LOGGER.info(" Weight: {0}".format(value['weight']))
LOGGER.info(" Energy [kcal/mol]: {0}".format(value['energy']))
statistic.append([key, value['weight'], value['mean'], value['stddev'], value['energy']])
try:
LOGGER.info(" Energy [kcal/mol]: {0}".format(value['energy']))
statistic.append([key, value['weight'], value['mean'], value['stddev'], value['energy']])
except:
statistic.append([key, value['weight'], value['mean'], value['stddev']])
else: pass

statistic.sort(key=lambda x: x[1], reverse=True)
Expand Down
117 changes: 117 additions & 0 deletions prody/proteins/tabulated_energies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,120 @@ PRO LYS 0.3 -0.5 0.0
PRO ARG -0.17 -2.43 0.0
PRO HIS 0.33 -1.8 0.0
PRO PRO -0.03 -0.83 0.0
GLY HSE 0.01 -2.47 0.0
karolamik13 marked this conversation as resolved.
Show resolved Hide resolved
ALA HSE 0.01 -3.29 0.0
VAL HSE -0.23 -4.14 -1.1
ILE HSE -0.02 -4.55 -1.1
LEU HSE 0.25 -4.85 -1.1
CYS HSE -0.64 -4.79 -0.8
MET HSE -0.17 -4.47 -0.5
PHE HSE 0.79 -3.82 -0.6
TYR HSE 0.34 -3.78 -1.1
TRP HSE -0.05 -4.5 -1.7
SER HSE -0.38 -3.12 -0.5
THR HSE -0.05 -2.73 -0.5
ASP HSE 0.0 -2.93 -0.4
ASN HSE -0.52 -3.05 -1.2
GLU HSE -0.1 -3.15 -0.4
GLN HSE -0.31 -4.2 -1.2
LYS HSE -0.01 -2.14 0.0
ARG HSE 0.35 -3.24 -0.4
HSE GLY 0.01 -2.47 0.0
HSE ALA 0.01 -3.29 0.0
HSE VAL -0.23 -4.14 -1.1
HSE ILE -0.02 -4.55 -1.1
HSE LEU 0.25 -4.85 -1.1
HSE CYS -0.64 -4.79 -0.8
HSE MET -0.17 -4.47 -0.5
HSE PHE 0.79 -3.82 -0.6
HSE TYR 0.34 -3.78 -1.1
HSE TRP -0.05 -4.5 -1.7
HSE SER -0.38 -3.12 -0.5
HSE THR -0.05 -2.73 -0.5
HSE ASP 0.0 -2.93 -0.4
HSE ASN -0.52 -3.05 -1.2
HSE GLU -0.1 -3.15 -0.4
HSE GLN -0.31 -4.2 -1.2
HSE LYS -0.01 -2.14 0.0
HSE ARG 0.35 -3.24 -0.4
HSE HSE 0.38 -3.08 -0.5
HSE PRO 0.33 -1.8 0.0
PRO HSE 0.33 -1.8 0.0
GLY HSD 0.01 -2.47 0.0
ALA HSD 0.01 -3.29 0.0
VAL HSD -0.23 -4.14 -1.1
ILE HSD -0.02 -4.55 -1.1
LEU HSD 0.25 -4.85 -1.1
CYS HSD -0.64 -4.79 -0.8
MET HSD -0.17 -4.47 -0.5
PHE HSD 0.79 -3.82 -0.6
TYR HSD 0.34 -3.78 -1.1
TRP HSD -0.05 -4.5 -1.7
SER HSD -0.38 -3.12 -0.5
THR HSD -0.05 -2.73 -0.5
ASP HSD 0.0 -2.93 -0.4
ASN HSD -0.52 -3.05 -1.2
GLU HSD -0.1 -3.15 -0.4
GLN HSD -0.31 -4.2 -1.2
LYS HSD -0.01 -2.14 0.0
ARG HSD 0.35 -3.24 -0.4
HSD GLY 0.01 -2.47 0.0
HSD ALA 0.01 -3.29 0.0
HSD VAL -0.23 -4.14 -1.1
HSD ILE -0.02 -4.55 -1.1
HSD LEU 0.25 -4.85 -1.1
HSD CYS -0.64 -4.79 -0.8
HSD MET -0.17 -4.47 -0.5
HSD PHE 0.79 -3.82 -0.6
HSD TYR 0.34 -3.78 -1.1
HSD TRP -0.05 -4.5 -1.7
HSD SER -0.38 -3.12 -0.5
HSD THR -0.05 -2.73 -0.5
HSD ASP 0.0 -2.93 -0.4
HSD ASN -0.52 -3.05 -1.2
HSD GLU -0.1 -3.15 -0.4
HSD GLN -0.31 -4.2 -1.2
HSD LYS -0.01 -2.14 0.0
HSD ARG 0.35 -3.24 -0.4
HSD HSD 0.38 -3.08 -0.5
HSD PRO 0.33 -1.8 0.0
PRO HSD 0.33 -1.8 0.0
GLY HSP 0.01 -2.47 0.0
ALA HSP 0.01 -3.29 0.0
VAL HSP -0.23 -4.14 -1.1
ILE HSP -0.02 -4.55 -1.1
LEU HSP 0.25 -4.85 -1.1
CYS HSP -0.64 -4.79 -0.8
MET HSP -0.17 -4.47 -0.5
PHE HSP 0.79 -3.82 -0.6
TYR HSP 0.34 -3.78 -1.1
TRP HSP -0.05 -4.5 -1.7
SER HSP -0.38 -3.12 -0.5
THR HSP -0.05 -2.73 -0.5
ASP HSP 0.0 -2.93 -0.4
ASN HSP -0.52 -3.05 -1.2
GLU HSP -0.1 -3.15 -0.4
GLN HSP -0.31 -4.2 -1.2
LYS HSP -0.01 -2.14 0.0
ARG HSP 0.35 -3.24 -0.4
HSP GLY 0.01 -2.47 0.0
HSP ALA 0.01 -3.29 0.0
HSP VAL -0.23 -4.14 -1.1
HSP ILE -0.02 -4.55 -1.1
HSP LEU 0.25 -4.85 -1.1
HSP CYS -0.64 -4.79 -0.8
HSP MET -0.17 -4.47 -0.5
HSP PHE 0.79 -3.82 -0.6
HSP TYR 0.34 -3.78 -1.1
HSP TRP -0.05 -4.5 -1.7
HSP SER -0.38 -3.12 -0.5
HSP THR -0.05 -2.73 -0.5
HSP ASP 0.0 -2.93 -0.4
HSP ASN -0.52 -3.05 -1.2
HSP GLU -0.1 -3.15 -0.4
HSP GLN -0.31 -4.2 -1.2
HSP LYS -0.01 -2.14 0.0
HSP ARG 0.35 -3.24 -0.4
HSP HSP 0.38 -3.08 -0.5
HSP PRO 0.33 -1.8 0.0
PRO HSP 0.33 -1.8 0.0
Loading