prodigy-prot 2.3.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prodigy_prot/__init__.py +3 -0
- prodigy_prot/cli.py +127 -0
- prodigy_prot/data/naccess.config +256 -0
- prodigy_prot/modules/__init__.py +0 -0
- prodigy_prot/modules/aa_properties.py +122 -0
- prodigy_prot/modules/freesasa_tools.py +65 -0
- prodigy_prot/modules/models.py +41 -0
- prodigy_prot/modules/parsers.py +166 -0
- prodigy_prot/modules/prodigy.py +298 -0
- prodigy_prot/modules/utils.py +25 -0
- prodigy_prot-2.3.0.dist-info/METADATA +192 -0
- prodigy_prot-2.3.0.dist-info/RECORD +15 -0
- prodigy_prot-2.3.0.dist-info/WHEEL +5 -0
- prodigy_prot-2.3.0.dist-info/entry_points.txt +2 -0
- prodigy_prot-2.3.0.dist-info/licenses/LICENSE +190 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Functions to read PDB/mmCIF files
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import sys
|
|
7
|
+
import warnings
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Optional, Union
|
|
10
|
+
|
|
11
|
+
from Bio.PDB.Chain import Chain
|
|
12
|
+
from Bio.PDB.MMCIFParser import MMCIFParser
|
|
13
|
+
from Bio.PDB.PDBExceptions import PDBConstructionWarning
|
|
14
|
+
from Bio.PDB.PDBParser import PDBParser
|
|
15
|
+
from Bio.PDB.Polypeptide import PPBuilder, is_aa
|
|
16
|
+
from Bio.PDB.Structure import Structure
|
|
17
|
+
|
|
18
|
+
warnings.filterwarnings("ignore", category=PDBConstructionWarning)
|
|
19
|
+
log = logging.getLogger("Prodigy")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_parser(input_f: Path) -> Union[PDBParser, MMCIFParser]:
|
|
23
|
+
if input_f.suffix == ".cif":
|
|
24
|
+
return MMCIFParser()
|
|
25
|
+
else:
|
|
26
|
+
return PDBParser()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def validate_structure(
|
|
30
|
+
s: Structure, selection: Optional[list[str]] = None, clean: bool = True
|
|
31
|
+
) -> Structure:
|
|
32
|
+
|
|
33
|
+
# setup logging
|
|
34
|
+
logger = logging.getLogger("Prodigy")
|
|
35
|
+
|
|
36
|
+
# Keep first model only
|
|
37
|
+
if len(s) > 1:
|
|
38
|
+
logger.warning(
|
|
39
|
+
(
|
|
40
|
+
"[!] Structure contains more than one model."
|
|
41
|
+
" Only the first one will be kept"
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
model_one = s[0].id
|
|
45
|
+
for m in s.child_list[:]:
|
|
46
|
+
if m.id != model_one:
|
|
47
|
+
s.detach_child(m.id)
|
|
48
|
+
|
|
49
|
+
# process selected chains
|
|
50
|
+
chains: list[Chain] = list(s.get_chains())
|
|
51
|
+
chain_ids = set([c.id for c in chains])
|
|
52
|
+
|
|
53
|
+
if selection:
|
|
54
|
+
sel_chains = []
|
|
55
|
+
# Match selected chain with structure
|
|
56
|
+
for sel in selection:
|
|
57
|
+
for c_str in sel.split(","):
|
|
58
|
+
sel_chains.append(c_str)
|
|
59
|
+
if c_str not in chain_ids:
|
|
60
|
+
raise ValueError(
|
|
61
|
+
f"Selected chain not present in provided structure: {c_str}"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Remove unselected chains
|
|
65
|
+
def _ignore_helper(x) -> bool:
|
|
66
|
+
return x.id not in sel_chains
|
|
67
|
+
|
|
68
|
+
for c in chains:
|
|
69
|
+
if _ignore_helper(c):
|
|
70
|
+
if c.parent is not None:
|
|
71
|
+
c.parent.detach_child(c.id)
|
|
72
|
+
|
|
73
|
+
# Double occupancy check
|
|
74
|
+
for atom in list(s.get_atoms()):
|
|
75
|
+
if atom.is_disordered():
|
|
76
|
+
residue = atom.parent
|
|
77
|
+
sel_at = atom.selected_child
|
|
78
|
+
sel_at.altloc = " "
|
|
79
|
+
sel_at.disordered_flag = 0
|
|
80
|
+
residue.detach_child(atom.id)
|
|
81
|
+
residue.add(sel_at)
|
|
82
|
+
|
|
83
|
+
# Insertion code check
|
|
84
|
+
for c in chains:
|
|
85
|
+
for residue in c.get_residues():
|
|
86
|
+
if residue.get_id()[2] != " ":
|
|
87
|
+
c.detach_child(residue.id)
|
|
88
|
+
|
|
89
|
+
if clean:
|
|
90
|
+
# Remove HETATMs and solvent
|
|
91
|
+
res_list = list(s.get_residues())
|
|
92
|
+
|
|
93
|
+
def _ignore(r):
|
|
94
|
+
return r.id[0][0] == "W" or r.id[0][0] == "H"
|
|
95
|
+
|
|
96
|
+
for res in res_list:
|
|
97
|
+
if _ignore(res):
|
|
98
|
+
chain = res.parent
|
|
99
|
+
chain.detach_child(res.id)
|
|
100
|
+
elif not is_aa(res, standard=True):
|
|
101
|
+
raise ValueError(
|
|
102
|
+
"Unsupported non-standard amino acid found: {0}".format(res.resname)
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# Remove Hydrogens
|
|
106
|
+
atom_list = list(s.get_atoms())
|
|
107
|
+
|
|
108
|
+
def _ignore(x):
|
|
109
|
+
return x.element == "H"
|
|
110
|
+
|
|
111
|
+
for atom in atom_list:
|
|
112
|
+
if _ignore(atom):
|
|
113
|
+
residue = atom.parent
|
|
114
|
+
residue.detach_child(atom.name)
|
|
115
|
+
|
|
116
|
+
# Detect gaps and compare with no. of chains
|
|
117
|
+
pep_builder = PPBuilder()
|
|
118
|
+
peptides = pep_builder.build_peptides(s)
|
|
119
|
+
n_peptides = len(peptides)
|
|
120
|
+
|
|
121
|
+
if n_peptides != len(chain_ids):
|
|
122
|
+
message = "[!] Structure contains gaps:\n"
|
|
123
|
+
for i_pp, pp in enumerate(peptides):
|
|
124
|
+
message += (
|
|
125
|
+
"\t{1.parent.id} {1.resname}{1.id[1]} < Fragment {0} > "
|
|
126
|
+
"{2.parent.id} {2.resname}{2.id[1]}\n".format(i_pp, pp[0], pp[-1])
|
|
127
|
+
)
|
|
128
|
+
logger.warning(message)
|
|
129
|
+
# raise Exception(message)
|
|
130
|
+
|
|
131
|
+
return s
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def parse_structure(path: str) -> tuple[Structure, int, int]:
|
|
135
|
+
"""Return a validated `Structure`, number of chains and number of residues"""
|
|
136
|
+
|
|
137
|
+
extension = Path(path).suffix
|
|
138
|
+
supported_extensions = [".pdb", ".cif", ".ent"]
|
|
139
|
+
if extension not in supported_extensions:
|
|
140
|
+
log.error(
|
|
141
|
+
f"[!] Structure format '{extension}' is "
|
|
142
|
+
"not supported. Use '.pdb' or '.cif'."
|
|
143
|
+
)
|
|
144
|
+
sys.exit(1)
|
|
145
|
+
|
|
146
|
+
parser = get_parser(Path(path))
|
|
147
|
+
structure_name = Path(path).stem
|
|
148
|
+
structure_path = Path(path)
|
|
149
|
+
try:
|
|
150
|
+
original_structure = parser.get_structure(structure_name, structure_path)
|
|
151
|
+
except Exception as e:
|
|
152
|
+
log.exception(e)
|
|
153
|
+
sys.exit(1)
|
|
154
|
+
|
|
155
|
+
assert isinstance(original_structure, Structure)
|
|
156
|
+
|
|
157
|
+
structure = validate_structure(original_structure)
|
|
158
|
+
|
|
159
|
+
# Get number of chains
|
|
160
|
+
number_of_chains = len(set([c.id for c in structure.get_chains()]))
|
|
161
|
+
|
|
162
|
+
# Get number of residues
|
|
163
|
+
number_of_residues = len(list(structure.get_residues()))
|
|
164
|
+
|
|
165
|
+
# structure, n_chains, n_res = parse_structure(path=str(struct_path))
|
|
166
|
+
return (structure, number_of_chains, number_of_residues)
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from io import TextIOWrapper
|
|
3
|
+
from typing import Optional, TextIO, Union
|
|
4
|
+
|
|
5
|
+
from Bio.PDB.NeighborSearch import NeighborSearch
|
|
6
|
+
from Bio.PDB.Structure import Structure
|
|
7
|
+
|
|
8
|
+
from prodigy_prot.modules import aa_properties
|
|
9
|
+
from prodigy_prot.modules.freesasa_tools import execute_freesasa_api
|
|
10
|
+
from prodigy_prot.modules.models import IC_NIS
|
|
11
|
+
from prodigy_prot.modules.utils import dg_to_kd
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def calculate_ic(
|
|
15
|
+
struct: Structure, d_cutoff: float = 5.5, selection: Optional[dict[str, int]] = None
|
|
16
|
+
) -> list:
|
|
17
|
+
"""
|
|
18
|
+
Calculates intermolecular contacts in a parsed struct object.
|
|
19
|
+
"""
|
|
20
|
+
atom_list = list(struct.get_atoms())
|
|
21
|
+
ns = NeighborSearch(atom_list)
|
|
22
|
+
all_list = ns.search_all(radius=d_cutoff, level="R")
|
|
23
|
+
|
|
24
|
+
assert all_list is not None
|
|
25
|
+
|
|
26
|
+
if selection:
|
|
27
|
+
_sd = selection
|
|
28
|
+
|
|
29
|
+
def _chain(x):
|
|
30
|
+
return x.parent.id
|
|
31
|
+
|
|
32
|
+
ic_list = [
|
|
33
|
+
c
|
|
34
|
+
for c in all_list
|
|
35
|
+
if (_chain(c[0]) in _sd and _chain(c[1]) in _sd)
|
|
36
|
+
and (_sd[_chain(c[0])] != _sd[_chain(c[1])])
|
|
37
|
+
]
|
|
38
|
+
else:
|
|
39
|
+
ic_list = [c for c in all_list if c[0].parent.id != c[1].parent.id]
|
|
40
|
+
|
|
41
|
+
if not ic_list:
|
|
42
|
+
raise ValueError("No contacts found for selection")
|
|
43
|
+
|
|
44
|
+
ic_list.sort()
|
|
45
|
+
return ic_list
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def analyse_contacts(contact_list: list) -> dict[str, float]:
|
|
49
|
+
"""
|
|
50
|
+
Enumerates and classifies contacts based on the chemical characteristics
|
|
51
|
+
of the participating amino acids.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
bins = {
|
|
55
|
+
"AA": 0.0,
|
|
56
|
+
"PP": 0.0,
|
|
57
|
+
"CC": 0.0,
|
|
58
|
+
"AP": 0.0,
|
|
59
|
+
"CP": 0.0,
|
|
60
|
+
"AC": 0.0,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
_data = aa_properties.aa_character_ic
|
|
64
|
+
for res_i, res_j in contact_list:
|
|
65
|
+
i = _data.get(res_i.resname)
|
|
66
|
+
j = _data.get(res_j.resname)
|
|
67
|
+
if i is not None and j is not None:
|
|
68
|
+
contact_type = "".join(sorted((i, j)))
|
|
69
|
+
bins[contact_type] += 1
|
|
70
|
+
|
|
71
|
+
return bins
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def analyse_nis(sasa_dict: dict, acc_threshold: float = 0.05) -> list[float]:
|
|
75
|
+
"""
|
|
76
|
+
Returns the percentages of apolar, polar, and charged
|
|
77
|
+
residues at the interface, according to an accessibility
|
|
78
|
+
criterion.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
_data = aa_properties.aa_character_protorp
|
|
82
|
+
|
|
83
|
+
def _char_to_index(x):
|
|
84
|
+
return {"A": 0, "C": 1, "P": 2}.get(x)
|
|
85
|
+
|
|
86
|
+
count = [0, 0, 0]
|
|
87
|
+
|
|
88
|
+
for res, rsa in sasa_dict.items():
|
|
89
|
+
_, resn, _ = res
|
|
90
|
+
if rsa >= acc_threshold:
|
|
91
|
+
aa_character = _data[resn]
|
|
92
|
+
aa_index = _char_to_index(aa_character)
|
|
93
|
+
assert aa_index is not None
|
|
94
|
+
count[aa_index] += 1
|
|
95
|
+
|
|
96
|
+
percentages = [100.0 * x / sum(count) for x in count]
|
|
97
|
+
# print('[+] No. of buried interface residues: {0}'.format(sum(count)))
|
|
98
|
+
return percentages
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class Prodigy:
|
|
102
|
+
# init parameters
|
|
103
|
+
def __init__(
|
|
104
|
+
self,
|
|
105
|
+
struct_obj: Structure,
|
|
106
|
+
selection: Optional[list[str]] = None,
|
|
107
|
+
temp: float = 25.0,
|
|
108
|
+
):
|
|
109
|
+
self.temp = float(temp)
|
|
110
|
+
if selection is None:
|
|
111
|
+
self.selection = [chain.id for chain in struct_obj.get_chains()]
|
|
112
|
+
else:
|
|
113
|
+
self.selection = selection
|
|
114
|
+
self.structure = struct_obj
|
|
115
|
+
self.ic_network: list = []
|
|
116
|
+
self.bins: dict[str, float] = {
|
|
117
|
+
"CC": 0.0,
|
|
118
|
+
"CP": 0.0,
|
|
119
|
+
"AC": 0.0,
|
|
120
|
+
"PP": 0.0,
|
|
121
|
+
"AP": 0.0,
|
|
122
|
+
"AA": 0.0,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
self.nis_a = 0.0
|
|
126
|
+
self.nis_c = 0.0
|
|
127
|
+
self.ba_val = 0.0
|
|
128
|
+
self.kd_val = 0.0
|
|
129
|
+
|
|
130
|
+
def predict(
|
|
131
|
+
self,
|
|
132
|
+
temp: Optional[float] = None,
|
|
133
|
+
distance_cutoff: float = 5.5,
|
|
134
|
+
acc_threshold: float = 0.05,
|
|
135
|
+
):
|
|
136
|
+
if temp is not None:
|
|
137
|
+
self.temp = temp
|
|
138
|
+
# Make selection dict from user option or PDB chains
|
|
139
|
+
selection_dict: dict[str, int] = {}
|
|
140
|
+
for igroup, group in enumerate(self.selection):
|
|
141
|
+
chains = group.split(",")
|
|
142
|
+
for chain in chains:
|
|
143
|
+
if chain in selection_dict:
|
|
144
|
+
errmsg = "Selections must be disjoint sets: " f"{chain} is repeated"
|
|
145
|
+
raise ValueError(errmsg)
|
|
146
|
+
selection_dict[chain] = igroup
|
|
147
|
+
|
|
148
|
+
# Contacts
|
|
149
|
+
self.ic_network = calculate_ic(
|
|
150
|
+
self.structure, d_cutoff=distance_cutoff, selection=selection_dict
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
self.bins = analyse_contacts(self.ic_network)
|
|
154
|
+
|
|
155
|
+
# SASA
|
|
156
|
+
_, cmplx_sasa = execute_freesasa_api(self.structure)
|
|
157
|
+
self.nis_a, self.nis_c, _ = analyse_nis(cmplx_sasa, acc_threshold=acc_threshold)
|
|
158
|
+
|
|
159
|
+
# Affinity Calculation
|
|
160
|
+
self.ba_val = IC_NIS(
|
|
161
|
+
self.bins["CC"],
|
|
162
|
+
self.bins["AC"],
|
|
163
|
+
self.bins["PP"],
|
|
164
|
+
self.bins["AP"],
|
|
165
|
+
self.nis_a,
|
|
166
|
+
self.nis_c,
|
|
167
|
+
)
|
|
168
|
+
self.kd_val = dg_to_kd(self.ba_val, self.temp)
|
|
169
|
+
|
|
170
|
+
def as_dict(self) -> dict:
|
|
171
|
+
return_dict = {
|
|
172
|
+
"structure": self.structure.id,
|
|
173
|
+
"selection": self.selection,
|
|
174
|
+
"temp": self.temp,
|
|
175
|
+
"ICs": len(self.ic_network),
|
|
176
|
+
"nis_a": self.nis_a,
|
|
177
|
+
"nis_c": self.nis_c,
|
|
178
|
+
"ba_val": self.ba_val,
|
|
179
|
+
"kd_val": self.kd_val,
|
|
180
|
+
}
|
|
181
|
+
return_dict.update(self.bins)
|
|
182
|
+
return return_dict
|
|
183
|
+
|
|
184
|
+
def print_prediction(self, outfile: str = "", quiet: bool = False) -> None:
|
|
185
|
+
handle: Union[TextIOWrapper, TextIO]
|
|
186
|
+
if outfile:
|
|
187
|
+
handle = open(outfile, "w")
|
|
188
|
+
else:
|
|
189
|
+
handle = sys.stdout
|
|
190
|
+
|
|
191
|
+
if quiet:
|
|
192
|
+
handle.write("{0}\t{1:8.3f}\n".format(self.structure.id, self.ba_val))
|
|
193
|
+
else:
|
|
194
|
+
handle.write(
|
|
195
|
+
"[+] No. of intermolecular contacts: {0}\n".format(len(self.ic_network))
|
|
196
|
+
)
|
|
197
|
+
handle.write(
|
|
198
|
+
"[+] No. of charged-charged contacts: {0}\n".format(self.bins["CC"])
|
|
199
|
+
)
|
|
200
|
+
handle.write(
|
|
201
|
+
"[+] No. of charged-polar contacts: {0}\n".format(self.bins["CP"])
|
|
202
|
+
)
|
|
203
|
+
handle.write(
|
|
204
|
+
"[+] No. of charged-apolar contacts: {0}\n".format(self.bins["AC"])
|
|
205
|
+
)
|
|
206
|
+
handle.write(
|
|
207
|
+
"[+] No. of polar-polar contacts: {0}\n".format(self.bins["PP"])
|
|
208
|
+
)
|
|
209
|
+
handle.write(
|
|
210
|
+
"[+] No. of apolar-polar contacts: {0}\n".format(self.bins["AP"])
|
|
211
|
+
)
|
|
212
|
+
handle.write(
|
|
213
|
+
"[+] No. of apolar-apolar contacts: {0}\n".format(self.bins["AA"])
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
handle.write(
|
|
217
|
+
"[+] Percentage of apolar NIS residues: {0:3.2f}\n".format(self.nis_a)
|
|
218
|
+
)
|
|
219
|
+
handle.write(
|
|
220
|
+
"[+] Percentage of charged NIS residues: {0:3.2f}\n".format(self.nis_c)
|
|
221
|
+
)
|
|
222
|
+
handle.write(
|
|
223
|
+
"[++] Predicted binding "
|
|
224
|
+
"affinity (kcal.mol-1): {0:8.1f}\n".format(self.ba_val)
|
|
225
|
+
)
|
|
226
|
+
handle.write(
|
|
227
|
+
"[++] Predicted dissociation constant (M) at {:.1f}˚C:"
|
|
228
|
+
" {:8.1e}\n".format(self.temp, self.kd_val)
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
if handle is not sys.stdout:
|
|
232
|
+
handle.close()
|
|
233
|
+
|
|
234
|
+
def print_contacts(self, outfile: str = "") -> None:
|
|
235
|
+
handle: Union[TextIOWrapper, TextIO]
|
|
236
|
+
if outfile:
|
|
237
|
+
handle = open(outfile, "w")
|
|
238
|
+
else:
|
|
239
|
+
handle = sys.stdout
|
|
240
|
+
|
|
241
|
+
for res1, res2 in self.ic_network:
|
|
242
|
+
_fmt_str = (
|
|
243
|
+
"{0.resname:>5s} {0.id[1]:5} {0.parent.id:>3s} {1.resname:>5s}"
|
|
244
|
+
" {1.id[1]:5} {1.parent.id:>3s}\n"
|
|
245
|
+
)
|
|
246
|
+
if res1.parent.id not in self.selection[0]:
|
|
247
|
+
res1, res2 = res2, res1
|
|
248
|
+
handle.write(_fmt_str.format(res1, res2))
|
|
249
|
+
|
|
250
|
+
if handle is not sys.stdout:
|
|
251
|
+
handle.close()
|
|
252
|
+
|
|
253
|
+
def print_pymol_script(self, outfile: str = "") -> None:
|
|
254
|
+
# Writing output PYMOL: pml script
|
|
255
|
+
# initialize array with chains and save chain selection string
|
|
256
|
+
selection_strings = []
|
|
257
|
+
chains: dict[str, set] = {}
|
|
258
|
+
for s in self.selection:
|
|
259
|
+
selection_strings.append(s.replace(",", "+"))
|
|
260
|
+
for c in s.split(","):
|
|
261
|
+
chains[c] = set()
|
|
262
|
+
|
|
263
|
+
# loop over pairs and add interface residues to respective chains
|
|
264
|
+
for pair in self.ic_network:
|
|
265
|
+
for r in pair:
|
|
266
|
+
chains[r.parent.id].add(str(r.id[1]))
|
|
267
|
+
|
|
268
|
+
# set output stream
|
|
269
|
+
handle = open(outfile, "w") if outfile else sys.stdout
|
|
270
|
+
|
|
271
|
+
# write default setup strings
|
|
272
|
+
handle.writelines(
|
|
273
|
+
[
|
|
274
|
+
"color silver\n",
|
|
275
|
+
"as cartoon\n",
|
|
276
|
+
"bg_color white\n",
|
|
277
|
+
"center\n",
|
|
278
|
+
"color lightblue, chain {}\n".format(selection_strings[0]),
|
|
279
|
+
"color lightpink, chain {}\n".format(selection_strings[1]),
|
|
280
|
+
]
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
# loop over interfaces construct selection strings
|
|
284
|
+
# and write interface related commands
|
|
285
|
+
for color, iface in [("blue", 1), ("hotpink", 2)]:
|
|
286
|
+
p_sel_string = " or ".join(
|
|
287
|
+
[
|
|
288
|
+
"chain {} and resi {}".format(c, "+".join(chains[c]))
|
|
289
|
+
for c in selection_strings[iface - 1].split("+")
|
|
290
|
+
]
|
|
291
|
+
)
|
|
292
|
+
handle.write("select iface{}, {}\n".format(iface, p_sel_string))
|
|
293
|
+
handle.write("color {}, iface{}\n".format(color, iface))
|
|
294
|
+
handle.write("show sticks, iface{}\n".format(iface))
|
|
295
|
+
|
|
296
|
+
# close file handle if applicable
|
|
297
|
+
if handle is not sys.stdout:
|
|
298
|
+
handle.close()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Assorted utility functions.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def check_path(path: str) -> str:
|
|
10
|
+
"""
|
|
11
|
+
Checks if a file is readable.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
full_path = os.path.abspath(path)
|
|
15
|
+
if not os.path.isfile(full_path):
|
|
16
|
+
raise IOError("Could not read file: {0}".format(path))
|
|
17
|
+
return full_path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def dg_to_kd(dg: float, temperature: float = 25.0) -> float:
|
|
21
|
+
"""Coversion of DG into the dissociation constant kd"""
|
|
22
|
+
|
|
23
|
+
temp_in_k = temperature + 273.15
|
|
24
|
+
rt = 0.0019858775 * temp_in_k
|
|
25
|
+
return math.exp(dg / rt)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prodigy-prot
|
|
3
|
+
Version: 2.3.0
|
|
4
|
+
Summary: PROtein binDIng enerGY prediction
|
|
5
|
+
Author: Anna Vangone, Joao Rodrigues, Joerg Schaarschmidt
|
|
6
|
+
Maintainer-email: BonvinLab <bonvinlab.support@uu.nl>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Chemistry
|
|
17
|
+
Requires-Dist: biopython>=1.80
|
|
18
|
+
Requires-Dist: freesasa>=2.2.1
|
|
19
|
+
Requires-Dist: numpy>=2
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: coverage; extra == 'dev'
|
|
22
|
+
Requires-Dist: hypothesis; extra == 'dev'
|
|
23
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# PRODIGY / Binding Affinity Prediction
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+

|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
[](https://github.com/haddocking/prodigy/actions/workflows/ci.yml)
|
|
35
|
+
[](https://www.codacy.com/gh/haddocking/prodigy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=haddocking/prodigy&utm_campaign=Badge_Grade)
|
|
36
|
+
[](https://www.codacy.com/gh/haddocking/prodigy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=haddocking/prodigy&utm_campaign=Badge_Coverage)
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
[](https://fair-software.eu)
|
|
40
|
+
[](https://api.eu.badgr.io/public/assertions/w8HcpcH4Svi3-UZ93LHHMA "SQAaaS gold badge achieved")
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
PRODIGY is also available as a web service @ [wenmr.science.uu.nl/prodigy](https://wenmr.science.uu.nl/prodigy/)
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
pip install prodigy-prot
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If you want to develop PRODIGY, check [DEVELOPMENT](DEVELOPMENT.md) for more details.
|
|
53
|
+
|
|
54
|
+
## Usage
|
|
55
|
+
|
|
56
|
+
You can run `prodigy` either on a single structure:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
prodigy <structure_file>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or in a directory containing multiple molecules:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
prodigy <directory_with_molecules>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
To get a list of all the possible options.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
|
|
72
|
+
$ prodigy -h
|
|
73
|
+
usage: prodigy [-h] [--distance-cutoff DISTANCE_CUTOFF] [--acc-threshold ACC_THRESHOLD]
|
|
74
|
+
[--temperature TEMPERATURE] [--contact_list] [--pymol_selection] [-q]
|
|
75
|
+
[--selection A B [A,B C ...]]
|
|
76
|
+
input_path
|
|
77
|
+
|
|
78
|
+
Binding affinity predictor based on Intermolecular Contacts (ICs).
|
|
79
|
+
|
|
80
|
+
positional arguments:
|
|
81
|
+
input_path Path to either:
|
|
82
|
+
- Structure in PDB or mmCIF format
|
|
83
|
+
- Directory containing structure files
|
|
84
|
+
|
|
85
|
+
options:
|
|
86
|
+
-h, --help show this help message and exit
|
|
87
|
+
--distance-cutoff DISTANCE_CUTOFF
|
|
88
|
+
Distance cutoff to calculate ICs
|
|
89
|
+
--acc-threshold ACC_THRESHOLD
|
|
90
|
+
Accessibility threshold for BSA analysis
|
|
91
|
+
--temperature TEMPERATURE
|
|
92
|
+
Temperature (C) for Kd prediction
|
|
93
|
+
--contact_list Output a list of contacts
|
|
94
|
+
--pymol_selection Output a script to highlight the interface (pymol)
|
|
95
|
+
-q, --quiet Outputs only the predicted affinity value
|
|
96
|
+
|
|
97
|
+
Selection Options:
|
|
98
|
+
|
|
99
|
+
By default, all intermolecular contacts are taken into consideration,
|
|
100
|
+
a molecule being defined as an isolated group of amino acids sharing
|
|
101
|
+
a common chain identifier. In specific cases, for example
|
|
102
|
+
antibody-antigen complexes, some chains should be considered as a
|
|
103
|
+
single molecule.
|
|
104
|
+
|
|
105
|
+
Use the --selection option to provide collections of chains that should
|
|
106
|
+
be considered for the calculation. Separate by a space the chains that
|
|
107
|
+
are to be considered _different_ molecules. Use commas to include multiple
|
|
108
|
+
chains as part of a single group:
|
|
109
|
+
|
|
110
|
+
--selection A B => Contacts calculated (only) between chains A and B.
|
|
111
|
+
--selection A,B C => Contacts calculated (only) between chains A and C; and B and C.
|
|
112
|
+
--selection A B C => Contacts calculated (only) between chains A and B; B and C; and A and C.
|
|
113
|
+
|
|
114
|
+
--selection A B [A,B C ...]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Example single structure
|
|
118
|
+
|
|
119
|
+
Download the PDB [3BZD](https://www.rcsb.org/structure/3bzd) and run PRODIGY on it.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
$ curl -o 3bzd.pdb https://files.rcsb.org/download/3BZD.pdb
|
|
123
|
+
$ prodigy 3bzd.pdb
|
|
124
|
+
[+] Reading structure file: /Users/rvhonorato/dbg/3bzd.pdb
|
|
125
|
+
[+] Parsed structure file 3bzd (2 chains, 343 residues)
|
|
126
|
+
[+] No. of intermolecular contacts: 51
|
|
127
|
+
[+] No. of charged-charged contacts: 4
|
|
128
|
+
[+] No. of charged-polar contacts: 7
|
|
129
|
+
[+] No. of charged-apolar contacts: 6
|
|
130
|
+
[+] No. of polar-polar contacts: 7
|
|
131
|
+
[+] No. of apolar-polar contacts: 15
|
|
132
|
+
[+] No. of apolar-apolar contacts: 12
|
|
133
|
+
[+] Percentage of apolar NIS residues: 29.48
|
|
134
|
+
[+] Percentage of charged NIS residues: 29.48
|
|
135
|
+
[++] Predicted binding affinity (kcal.mol-1): -9.4
|
|
136
|
+
[++] Predicted dissociation constant (M) at 25.0˚C: 1.3e-07
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Details of the binding affinity predictor implemented in PRODIGY can be found at [10.7554/elife.07454](https://doi.org/10.7554/elife.07454)
|
|
140
|
+
|
|
141
|
+
## Example multiple structures
|
|
142
|
+
|
|
143
|
+
Create a directory that will hold your input molecules
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
mkdir input
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Download some molecules (or copy them into this directory):
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
curl -o input/3bzd.pdb https://files.rcsb.org/download/3BZD.pdb
|
|
153
|
+
curl -o input/2oob.pdb https://files.rcsb.org/download/2OOB.pdb
|
|
154
|
+
curl -o input/1ppe.pdb https://files.rcsb.org/download/1PPE.pdb
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Run `prodigy` with the `quiet` option, so it is easier to parse the output later:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
$ prodigy -q input/
|
|
161
|
+
3bzd -9.373
|
|
162
|
+
2oob -6.230
|
|
163
|
+
1ppe -14.727
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Citing us
|
|
167
|
+
|
|
168
|
+
If our tool is useful to you, please cite PRODIGY in your publications:
|
|
169
|
+
|
|
170
|
+
- **Xue L, Rodrigues J, Kastritis P, Bonvin A.M.J.J, Vangone A.**: PRODIGY: a web server for predicting the binding affinity of protein-protein complexes. _Bioinformatics_ (2016) ([10.1093/bioinformatics/btw514](https://doi.org/10.1093/bioinformatics/btw514))
|
|
171
|
+
|
|
172
|
+
- **Anna Vangone and Alexandre M.J.J. Bonvin**: Contacts-based prediction of binding affinity in protein-protein complexes. _eLife_, e07454 (2015) ([10.7554/eLife.07454](https://doi.org/10.7554/elife.07454))
|
|
173
|
+
|
|
174
|
+
- **Panagiotis L. Kastritis , João P.G.L.M. Rodrigues, Gert E. Folkers, Rolf Boelens, Alexandre M.J.J. Bonvin**: Proteins Feel More Than They See: Fine-Tuning of Binding Affinity by Properties of the Non-Interacting Surface. _Journal of Molecular Biology_, 14, 2632–2652 (2014). ([10.1016/j.jmb.2014.04.017](https://doi.org/10.1016/j.jmb.2014.04.017))
|
|
175
|
+
|
|
176
|
+
## Contact
|
|
177
|
+
|
|
178
|
+
For questions about PRODIGY usage, please reach out the team at [ask.bioexcel.eu](https://ask.bioexcel.eu/)
|
|
179
|
+
|
|
180
|
+
## Information about dependencies
|
|
181
|
+
|
|
182
|
+
The scripts rely on [Biopython](www.biopython.org) to validate the PDB structures and calculate
|
|
183
|
+
interatomic distances. [freesasa](https://github.com/mittinatten/freesasa), with the parameter
|
|
184
|
+
set used in NACCESS ([Chothia, 1976](http://www.ncbi.nlm.nih.gov/pubmed/994183)), is also
|
|
185
|
+
required for calculating the buried surface area.
|
|
186
|
+
|
|
187
|
+
**DISCLAIMER**: given the different software to calculate solvent accessiblity, predicted
|
|
188
|
+
values might differ (very slightly) from those published in the reference implementations.
|
|
189
|
+
The correlation of the actual atomic accessibilities is over 0.99, so we expect these
|
|
190
|
+
differences to be very minor.
|
|
191
|
+
|
|
192
|
+
---
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
prodigy_prot/__init__.py,sha256=mDTyspHukTFHZ9ss72gw_WpDflh2VxS_cboYwbQmmgg,98
|
|
2
|
+
prodigy_prot/cli.py,sha256=mYwJQaalhBPxUjYQXOsHUmnFVpBLRINVFdo8VMO5iPE,3954
|
|
3
|
+
prodigy_prot/data/naccess.config,sha256=1Bi_MdDVF56EC58DlQOlto2mHdux8np7NDgB5nzvITA,2772
|
|
4
|
+
prodigy_prot/modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
prodigy_prot/modules/aa_properties.py,sha256=AKiixibbtpCrdhnMt47JOut5Y3SYae8g_NGwckU4hN4,2386
|
|
6
|
+
prodigy_prot/modules/freesasa_tools.py,sha256=dy_6ihZUuKv_Kvgc47UDRlHidm-hrXmD83-BVwqJxs4,1932
|
|
7
|
+
prodigy_prot/modules/models.py,sha256=rHepA4SIFbMC17YwA_r_GCldCkD2oU3EstXN1G-RuIg,836
|
|
8
|
+
prodigy_prot/modules/parsers.py,sha256=dByJleD80AScdpn0jZVpnCcdTsBf8vno00JZGwgjbpw,4971
|
|
9
|
+
prodigy_prot/modules/prodigy.py,sha256=rTzNts80XsDdZUFi6eLTDuiUxCziLrCmqU3EYvJp3gQ,9463
|
|
10
|
+
prodigy_prot/modules/utils.py,sha256=tipnPvvhhsxOOfIYGuWPdEIRJXQoXLIeV2BP9V4Ovb4,530
|
|
11
|
+
prodigy_prot-2.3.0.dist-info/METADATA,sha256=C4HYAhK6NvWch3KfmQ_JFl4BMTKLhD6vy44dlZSqENc,7954
|
|
12
|
+
prodigy_prot-2.3.0.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
13
|
+
prodigy_prot-2.3.0.dist-info/entry_points.txt,sha256=Ykcig3AmqLF2U9DU3OrQgCNPQxPE9ZRzLKK_m8YZIZ0,50
|
|
14
|
+
prodigy_prot-2.3.0.dist-info/licenses/LICENSE,sha256=xWpVo3MLyrP3bfS6DlCJEMGwB_HYM1yLZYkal7jrcww,10797
|
|
15
|
+
prodigy_prot-2.3.0.dist-info/RECORD,,
|