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 3 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
86 changes: 84 additions & 2 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'calcHydrogenBondsTrajectory', 'calcHydrophobicOverlapingAreas',
'Interactions', 'InteractionsTrajectory', 'LigandInteractionsTrajectory',
'calcSminaBindingAffinity', 'calcSminaPerAtomInteractions', 'calcSminaTermValues',
'showSminaTermValues', 'showPairEnergy']
'showSminaTermValues', 'showPairEnergy', 'checkNonstandardResidues']


def cleanNumbers(listContacts):
Expand Down Expand Up @@ -160,6 +160,53 @@ def get_energy(pair, source):
import numpy as np
import importlib.resources as pkg_resources
jamesmkrieger marked this conversation as resolved.
Show resolved Hide resolved

aa_correction = {
# Histidine (His)
'HSD': 'HIS', # Protonated at ND1 (HID in AMBER)
'HSE': 'HIS', # Protonated at NE2 (HIE in AMBER)
'HSP': 'HIS', # Doubly protonated (HIP in AMBER)
'HID': 'HIS', # AMBER name, protonated at ND1
'HIE': 'HIS', # AMBER name, protonated at NE2
'HIP': 'HIS', # AMBER name, doubly protonated
'HISD': 'HIS', # GROMACS: protonated at ND1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can get these with long_resname=True:

In [6]: ag = parsePDB('nvt1_nojump_end.pdb', long_resname=True)

In [8]: np.unique(ag.getResnames())
Out[8]: 
array(['ALA', 'ARG', 'ASN', 'ASP', 'CLA', 'CU2P', 'CYS', 'GLN', 'GLU',
       'GLY', 'HISD', 'HISE', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO',
       'SER', 'SOD', 'THR', 'TRP', 'TYR', 'VAL'], dtype='<U6')

'HISE': 'HIS', # GROMACS: protonated at NE2
'HISP': 'HIS', # GROMACS: doubly protonated

# Cysteine (Cys)
'CYX': 'CYS', # Cystine (disulfide bridge)
'CYM': 'CYS', # Deprotonated cysteine, anion (GROMACS)

# Aspartic acid (Asp)
'ASH': 'ASP', # Deprotonated Asp (GROMACS: ASH, AMBER: AS4)
karolamik13 marked this conversation as resolved.
Show resolved Hide resolved

# Glutamic acid (Glu)
'GLH': 'GLU', # Deprotonated Glu (GROMACS: GLH, AMBER: GL4)

# Lysine (Lys)
'LYN': 'LYS', # Deprotonated lysine (GROMACS: LYN, AMBER: LYP)

# Arginine (Arg)
'ARN': 'ARG', # Deprotonated arginine (rare, GROMACS)

# Tyrosine (Tyr)
'TYM': 'TYR', # Deprotonated tyrosine (GROMACS: TYM)

# Serine (Ser)
'SEP': 'SER', # Phosphorylated serine (GROMACS/AMBER)

# Threonine (Thr)
'TPO': 'THR', # Phosphorylated threonine (GROMACS/AMBER)

# Tyrosine (Tyr)
'PTR': 'TYR', # Phosphorylated tyrosine (GROMACS/AMBER)

# Non-standard names for aspartic and glutamic acids in low pH environments
'ASH': 'ASP', # Protonated Asp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also confirm that I've seen one of these recently too

'GLH': 'GLU', # Protonated Glu
}

pair = [aa_correction.get(aa, aa) for aa in pair]

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:
Expand Down Expand Up @@ -187,11 +234,45 @@ def get_energy(pair, source):
return data_results


def checkNonstandardResidues(atoms):
jamesmkrieger marked this conversation as resolved.
Show resolved Hide resolved
"""Check whether the atomic structure contain non-standard residues and inform to replace the name
to the standard one to be that non-standard residues are treated in a correct way while computing
interactions.

:arg atoms: an Atomic object from which residues are selected
:type atoms: :class:`.Atomic`
"""

try:
coords = (atoms._getCoords() if hasattr(atoms, '_getCoords') else
atoms.getCoords())
except AttributeError:
try:
checkCoords(coords)
except TypeError:
raise TypeError('coords must be an object '
'with `getCoords` method')

amino_acids = ["ALA", "ARG", "ASN", "ASP", "CYS", "GLU", "GLN", "GLY", "HIS", "ILE",
"LEU", "LYS", "MET", "PHE", "PRO", "SER", "THR", "TRP", "TYR", "VAL"]

aa_list = atoms.select('name CA').getResnames()
nonstandard = []

for i in aa_list:
if i not in amino_acids:
nonstandard.append(i)

LOGGER.info('There are several non-standard residues in the structure.')
LOGGER.info('Replace the non-standard name in the PDB file with the equivalent name from the standard one if you want to include them in the interactions.')
LOGGER.info("Residues: {0}.".format(' '.join(nonstandard)))


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 [OK98]_ and
'CS' from InSty paper.
'CS' from InSty paper (under preparation).

:arg data: list with interactions from calcHydrogenBonds() or other types
:type data: list
Expand Down Expand Up @@ -2007,6 +2088,7 @@ def calcStatisticsInteractions(data, **kwargs):
"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
LOGGER.warn('energy information is not available for ', element.split('-')[0][:3], element.split('-')[1][:3])
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),
Expand Down
117 changes: 0 additions & 117 deletions prody/proteins/tabulated_energies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,120 +398,3 @@ 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
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