HInt-ppi 0.9.2__tar.gz → 0.9.3__tar.gz

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.
Files changed (34) hide show
  1. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/HInt.py +8 -3
  2. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/Scoring_HInt.py +20 -2
  3. hint_ppi-0.9.3/HInt/Send_to_database.py +240 -0
  4. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/Utils_HInt.py +15 -7
  5. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/PKG-INFO +1 -1
  6. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/SOURCES.txt +1 -0
  7. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/PKG-INFO +1 -1
  8. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/README.md +4 -1
  9. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/setup.py +1 -1
  10. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/File_proteins.py +0 -0
  11. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/__init__.py +0 -0
  12. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/get_good_inter_pae.py +0 -0
  13. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/__init__.py +0 -0
  14. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/calculate_mpdockq.py +0 -0
  15. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/clean_pdb.py +0 -0
  16. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/interface_assess.py +0 -0
  17. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/pi_score_utils.py +0 -0
  18. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/pisa_utils.py +0 -0
  19. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/run_piscore_wc.py +0 -0
  20. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/sc_utils.py +0 -0
  21. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/__init__.py +0 -0
  22. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/finalized_model_A.sav +0 -0
  23. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/finalized_model_B.sav +0 -0
  24. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/finalized_model_wc.sav +0 -0
  25. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/scaler_model_A.sav +0 -0
  26. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/scaler_model_B.sav +0 -0
  27. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt/script_pi_score/svm_model/scaler_model_wc.sav +0 -0
  28. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/dependency_links.txt +0 -0
  29. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/entry_points.txt +0 -0
  30. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/requires.txt +0 -0
  31. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/HInt_ppi.egg-info/top_level.txt +0 -0
  32. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/LICENSE +0 -0
  33. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/MANIFEST.in +0 -0
  34. {hint_ppi-0.9.2 → hint_ppi-0.9.3}/setup.cfg +0 -0
@@ -59,6 +59,7 @@ def add_arguments(parser) :
59
59
  parser.add_argument("--cpu", help="Number of CPUs available for computation (default: half of the CPUs)", required=False, default=default_cpu, type=int)
60
60
  parser.add_argument("--multi_job_per_gpu", help="Allow multiple jobs to run on the same GPU if VRAM allows it (default: True)", required=False, default="True")
61
61
  parser.add_argument("--multi_scoring", help="Score all models of each interaction (default: False) and make a mean score.", required=False, default="False")
62
+ parser.add_argument("--send_to_database", help="Publish models to the public QSProteome database (https://qsproteome.org/). All, Negative or None", required=False, default="None")
62
63
 
63
64
  # ------------------------------------------------------------------
64
65
  # Main execution
@@ -80,6 +81,9 @@ def main() :
80
81
  multi_scoring = args.multi_scoring
81
82
  if multi_scoring not in ["True", "False"] :
82
83
  raise ValueError("Invalid value for --multi_scoring. Need True or False.")
84
+ send_to_database = args.send_to_database
85
+ if send_to_database not in ["All", "Negative", "None"] :
86
+ raise ValueError("Invalid value for --send_to_database. Need All, Negative or None.")
83
87
  Informations_dict = Define_informations()
84
88
 
85
89
  # --------------------------------------------------------------
@@ -92,6 +96,7 @@ def main() :
92
96
  logger.info(f"Multi-job per GPU set to: {multi_job_per_gpu}")
93
97
  logger.info(f"Number of CPUs set to: {CPU}")
94
98
  logger.info(f"AlphaFold version set to: {Informations_dict['AlphaFold']}")
99
+ logger.info(f"Send to database option set to: {send_to_database}")
95
100
 
96
101
  time_dict = HInt_object.get_time_dict()
97
102
  time_dict["Summarize_info"] = [Informations_dict["Interact_with"], Informations_dict["DeepLoc"], Informations_dict["Signal_peptide"], Informations_dict["Min_protein_length"], Informations_dict["Max_protein_length"], Informations_dict["Homo-oligomer"],str(len(HInt_object.get_possible_prey())),Informations_dict["Organism"]]
@@ -217,11 +222,11 @@ def main() :
217
222
  batch_MSA.append(new_prio_list)
218
223
  start_PPI = time.time()
219
224
  if HInt_object.get_compounds() != {} :
220
- gpu_thread = threading.Thread(target=Generate_3D_model, args=(HInt_object, CPU, multi_scoring, Informations_dict, "Compounds", job_with_vram_length, GPU, multi_job_per_gpu))
225
+ gpu_thread = threading.Thread(target=Generate_3D_model, args=(HInt_object, CPU, multi_scoring, send_to_database, Informations_dict, "Compounds", job_with_vram_length, GPU, multi_job_per_gpu))
221
226
  gpu_thread.start()
222
227
  gpu_thread.join()
223
228
  else :
224
- gpu_thread = threading.Thread(target=Generate_3D_model, args=(HInt_object, CPU, multi_scoring, Informations_dict, "PPI_int", job_with_vram_length, GPU, multi_job_per_gpu))
229
+ gpu_thread = threading.Thread(target=Generate_3D_model, args=(HInt_object, CPU, multi_scoring, send_to_database, Informations_dict, "PPI_int", job_with_vram_length, GPU, multi_job_per_gpu))
225
230
  gpu_thread.start()
226
231
  for batch in batch_MSA :
227
232
  create_feature(HInt_object, Informations_dict, GPU, CPU, [], batch)
@@ -229,7 +234,7 @@ def main() :
229
234
  gpu_thread.join()
230
235
  time_PPI = format_time(time.time() - start_PPI)
231
236
  time_dict["PPI"] = [len(job_with_vram_length), time_PPI]
232
- Score_interaction(HInt_object, Informations_dict, CPU, "PPI_int", "", multi_scoring, bait) #if score is not done in Generate_3D_model, do it here
237
+ Score_interaction(HInt_object, Informations_dict, CPU, "PPI_int", send_to_database, "", multi_scoring, bait) #if score is not done in Generate_3D_model, do it here
233
238
  HInt_object.Make_save_dict()
234
239
 
235
240
 
@@ -6,7 +6,7 @@ import os
6
6
  import csv
7
7
  import logging
8
8
  import multiprocessing
9
- import HInt.get_good_inter_pae
9
+ import HInt.get_good_inter_pae, HInt.Send_to_database
10
10
  import gc
11
11
  import pandas as pd
12
12
  import json
@@ -37,7 +37,7 @@ logging.basicConfig(
37
37
 
38
38
  logger = logging.getLogger()
39
39
 
40
- def Score_interaction (file, Informations_dict, CPU, Interaction, job="", multi_scoring="False", bait="") :
40
+ def Score_interaction (file, Informations_dict, CPU, Interaction, send_to_database, job="", multi_scoring="False", bait="") :
41
41
  """
42
42
  Compute interaction scores (PPI or homo-oligomer) from AlphaFold predictions, aggregate them into meaningful metrics (iQ_score / hiQ_score), and update the list of valid prey proteins accordingly.
43
43
 
@@ -55,6 +55,7 @@ def Score_interaction (file, Informations_dict, CPU, Interaction, job="", multi_
55
55
  Interaction type ("PPI_int" or "homo_int")
56
56
  job : str
57
57
  multi_scoring : str
58
+ send_to_database : str
58
59
  bait : str
59
60
 
60
61
  """
@@ -220,10 +221,16 @@ def Score_interaction (file, Informations_dict, CPU, Interaction, job="", multi_
220
221
  mean_iQ_score[prey_name].append(iQ_score)
221
222
  int_score[prey_name][f"iQ_score_vs_{bait_name}"] = iQ_score
222
223
  result_dict[prey_name][f"iQ_score_vs_{bait_name}"] = iQ_score
224
+ if send_to_database == "All" :
225
+ zip_path = HInt.Send_to_database.HInt_to_QSProteome(f"./result_{Interaction}/{just_name}", AF_version)
226
+ HInt.Send_to_database.send_to_QSproteome(zip_path)
227
+
228
+
223
229
  if prey_name not in new_possible_prey :
224
230
  new_possible_prey.append(prey_name)
225
231
  if "ranked_0" in job :
226
232
  all_lines = all_lines + line
233
+
227
234
  for protein in possible_prey :
228
235
  if multi_scoring == True and protein in mean_iQ_score.keys() :
229
236
  scores = mean_iQ_score[protein]
@@ -236,6 +243,16 @@ def Score_interaction (file, Informations_dict, CPU, Interaction, job="", multi_
236
243
  int_score[protein][f"iQ_score_vs_{bait_name}"] = 0
237
244
  result_dict[protein][f"iQ_score_vs_{bait_name}"] = 0 #if prey don't have interaction, set iQ_score to 0
238
245
  result_dict[protein]["Reason_for_filtering"] = f"Bad interactions with {bait_name} : inter PAE > 10 A"
246
+ if send_to_database == "All" or send_to_database == "Negative" :
247
+ dir_path = Path(f"./result_{Interaction}/{bait_name}_and_{protein}")
248
+ inv_dir = Path(f"./result_{Interaction}/{protein}_and_{bait_name}")
249
+ if dir_path.exists() and dir_path.is_dir() :
250
+ job = dir_path
251
+ elif inv_dir.exists() and inv_dir.is_dir() :
252
+ job = inv_dir
253
+ zip_path = HInt.Send_to_database.HInt_to_QSProteome(job, AF_version)
254
+ HInt.Send_to_database.send_to_QSproteome(zip_path)
255
+
239
256
  #For homo-oligomer
240
257
  if Interaction == "homo_int" : #score homo-oligomer
241
258
  all_homo = dict()
@@ -286,6 +303,7 @@ def Score_interaction (file, Informations_dict, CPU, Interaction, job="", multi_
286
303
  file.set_int_score(int_score)
287
304
  file.set_result_dict(result_dict)
288
305
  file.set_possible_prey(new_possible_prey)
306
+ file.Make_save_dict()
289
307
  else :
290
308
  logger.info(f"result_{Interaction}/ don't exist")
291
309
 
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import json
4
+ import zipfile
5
+ import hashlib
6
+ import io
7
+ import os
8
+ import time
9
+ from collections import defaultdict, Counter
10
+ from pathlib import Path
11
+ import matplotlib
12
+ matplotlib.use("Agg")
13
+ import matplotlib.pyplot as plt
14
+ import requests
15
+ import logging
16
+ import pickle
17
+ import gzip
18
+
19
+ # Configure global logger
20
+ logging.basicConfig(
21
+ filename="./log_file/HInt.log", # Log file name
22
+ level=logging.INFO, # Log level
23
+ format="%(asctime)s - %(levelname)s - %(message)s" # Log format
24
+ )
25
+
26
+ # Use the logger configuration from HInt.py
27
+ logger = logging.getLogger()
28
+
29
+
30
+ def HInt_to_QSProteome (ppi, AF_version) :
31
+ """
32
+ Create a Zip file to send to the database.
33
+
34
+ Parameters :
35
+ ----------
36
+ ppi : str
37
+ AF_version : str
38
+
39
+ """
40
+ folder = Path(ppi)
41
+ name = folder.name
42
+ zip_path = folder / f"{name}_qsproteome_upload.zip"
43
+
44
+ if AF_version == "3" :
45
+ AF_version = "3.0.2"
46
+ num_recycles = 10
47
+
48
+ RENAME = {
49
+ "_model.cif": "_model_0.cif",
50
+ "_summary_confidences.json": "_summary_confidences_0.json",
51
+ "_confidences.json": "_full_data_0.json",
52
+ }
53
+
54
+ with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf :
55
+ for old, new in RENAME.items() :
56
+ zf.write(folder / f"{name}{old}", f"{name}/{name}{new}")
57
+
58
+ data = json.loads((folder / f"{name}_data.json").read_text())
59
+ chains = [
60
+ {"proteinChain": {"sequence": s["protein"]["sequence"], "count": len(s["protein"]["id"]) if isinstance(s["protein"]["id"], list) else 1}}
61
+ for s in data["sequences"] if "protein" in s
62
+ ]
63
+
64
+ job = [{"name": name, "modelSeeds": [str(x) for x in data["modelSeeds"]], "sequences": chains, "dialect": "alphafold3", "version": AF_version, "num_recycles": num_recycles}]
65
+ zf.writestr(f"{name}/{name}_job_request.json", json.dumps(job))
66
+
67
+ if AF_version == "2" :
68
+ AF_version = "2.3.2"
69
+ num_recycles = 3
70
+ AA3 = {"ALA": "A", "ARG": "R", "ASN": "N", "ASP": "D", "CYS": "C", "GLN": "Q", "GLU": "E", "GLY": "G",
71
+ "HIS": "H", "ILE": "I", "LEU": "L", "LYS": "K", "MET": "M", "PHE": "F", "PRO": "P", "SER": "S",
72
+ "THR": "T", "TRP": "W", "TYR": "Y", "VAL": "V"}
73
+ # AF2 has no summary/confidences/data json: build them from ranked_0.pdb and the best result_*.pkl
74
+ best = json.loads((folder / "ranking_debug.json").read_text())["order"][0]
75
+
76
+ pkl = folder / f"result_{best}.pkl"
77
+ with (open(pkl, "rb") if pkl.exists() else gzip.open(f"{pkl}.gz", "rb")) as f :
78
+ result = pickle.load(f)
79
+ num_recycles = int(result.get("num_recycles", num_recycles))
80
+
81
+ pdb = (folder / "ranked_0.pdb").read_text()
82
+ atoms = [l for l in pdb.splitlines() if l.startswith("ATOM")]
83
+ residues = list(dict.fromkeys((l[21], int(l[22:26]), l[17:20]) for l in atoms))
84
+ seqs = {}
85
+ for chain, _, res in residues :
86
+ seqs[chain] = seqs.get(chain, "") + AA3.get(res, "X")
87
+
88
+ summary = {"iptm": float(result["iptm"]) if "iptm" in result else None, "ptm": float(result["ptm"]),
89
+ "ranking_score": float(result["ranking_confidence"]), "num_recycles": num_recycles}
90
+ full_data = {"atom_chain_ids": [l[21] for l in atoms], "atom_plddts": [float(l[60:66]) for l in atoms],
91
+ "pae": result["predicted_aligned_error"].round(2).tolist(),
92
+ "token_chain_ids": [c for c, _, _ in residues], "token_res_ids": [r for _, r, _ in residues]}
93
+
94
+ with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as zf :
95
+ zf.writestr(f"{name}/{name}_model_0.pdb", pdb)
96
+ zf.writestr(f"{name}/{name}_summary_confidences_0.json", json.dumps(summary))
97
+ zf.writestr(f"{name}/{name}_full_data_0.json", json.dumps(full_data))
98
+
99
+ chains = [{"proteinChain": {"sequence": s, "count": n}} for s, n in Counter(seqs.values()).items()]
100
+
101
+ job = [{"name": name, "modelSeeds": [], "sequences": chains, "dialect": "alphafold2", "version": AF_version, "num_recycles": num_recycles}]
102
+ zf.writestr(f"{name}/{name}_job_request.json", json.dumps(job))
103
+ return zip_path
104
+
105
+
106
+ def screenshot(model_bytes) :
107
+ """
108
+ Simple PNG of the Calpha trace, coloured by chain (the database requires an image)
109
+
110
+ Parameters :
111
+ ----------
112
+ model_bytes : bytes
113
+ CIF or PDB file data
114
+
115
+ Returns :
116
+ -------
117
+ bytes : PNG image data
118
+
119
+ """
120
+ cols, chains = [], defaultdict(list)
121
+ for line in model_bytes.decode().splitlines() :
122
+ if line.startswith("_atom_site.") :
123
+ cols.append(line.split(".")[1].strip())
124
+ elif line.startswith("ATOM") and cols : # mmCIF (AF3)
125
+ f = dict(zip(cols, line.split()))
126
+ if f["label_atom_id"] == "CA" :
127
+ chains[f["label_asym_id"]].append((float(f["Cartn_x"]), float(f["Cartn_y"])))
128
+ elif line.startswith("ATOM") and line[12:16].strip() == "CA" : # PDB (AF2)
129
+ chains[line[21]].append((float(line[30:38]), float(line[38:46])))
130
+ fig, ax = plt.subplots(figsize=(4, 4))
131
+ for xy in chains.values() :
132
+ ax.plot(*zip(*xy), lw=1.5)
133
+ ax.set_aspect("equal")
134
+ ax.axis("off")
135
+ buf = io.BytesIO()
136
+ fig.savefig(buf, format="png", dpi=100)
137
+ plt.close(fig)
138
+ return buf.getvalue()
139
+
140
+
141
+ def content_type (name) :
142
+ """
143
+ Determine the content type based on the file extension.
144
+
145
+ Parameters :
146
+ ----------
147
+ name : str
148
+
149
+ Returns :
150
+ -------
151
+ str : Content type
152
+
153
+ """
154
+ if name.endswith(".json"):
155
+ return "application/json"
156
+ if name.endswith(".cif"):
157
+ return "application/cif"
158
+ if name.endswith(".pdb"):
159
+ return "chemical/x-pdb"
160
+ return "application/octet-stream"
161
+
162
+
163
+ def upload_run (s, run_id, files, credits) :
164
+ """
165
+ Upload a single run to the QSProteome database.
166
+
167
+ Parameters :
168
+ ----------
169
+ s : requests.Session
170
+ run_id : str
171
+ files : dict
172
+ credits : dict
173
+
174
+ """
175
+ TIMEOUT = 40
176
+ BASE = os.environ.get("QSPROTEOME_URL", "https://qsproteome.org")
177
+ model_name = next(n for n in files if "model_0" in n)
178
+ model = files[model_name]
179
+
180
+ digest = hashlib.sha256(model).hexdigest()
181
+ if s.post(f"{BASE}/api/rds/check-structure-hash", json={"hash": digest}, timeout=TIMEOUT).json().get("exists") :
182
+ logger.info(f"[{run_id}] already in database, skipping upload")
183
+ return
184
+
185
+ job_id = f"af3ws_{int(time.time() * 1000)}_{run_id}"
186
+ urls = {}
187
+ for name, blob, ctype in [("screenshot.png", screenshot(model), "image/png")] + \
188
+ [(n, b, content_type(n)) for n, b in files.items()]:
189
+ key = f"{job_id}/{name}"
190
+ r = s.get(f"{BASE}/api/s3/get-presigned-url", params={"fileName": key, "fileType": ctype}, timeout=TIMEOUT)
191
+ r.raise_for_status()
192
+ requests.put(r.json()["url"], data=blob, headers={"Content-Type": ctype}, timeout=TIMEOUT).raise_for_status()
193
+ urls[name] = f"https://qsproteome.s3.us-west-1.amazonaws.com/uploads/{key}"
194
+
195
+ def url(k) :
196
+ return next((u for n, u in urls.items() if k in n), None)
197
+
198
+ s.post(f"{BASE}/api/rds/complex-data/upload", json={
199
+ "complex_id": job_id,
200
+ "structure_file": url("model_0"),
201
+ "config_file": url("job_request"),
202
+ "metrics_file": url("full_data_0"),
203
+ "summary_file": url("summary_confidences_0"),
204
+ "image_file": url("screenshot.png"),
205
+ "credits": credits,
206
+ }, timeout=TIMEOUT).raise_for_status()
207
+ logger.info(f"[{run_id}] send -> {BASE}/structure/{job_id}")
208
+
209
+
210
+ def send_to_QSproteome (zip_file) :
211
+ """
212
+ Upload a zip file containing AlphaFold predictions to the QSProteome database, then remove it.
213
+
214
+ Parameters :
215
+ ----------
216
+ zip_file : str
217
+
218
+ """
219
+ BASE = os.environ.get("QSPROTEOME_URL", "https://qsproteome.org")
220
+ KEYS = ["model_0", "summary_confidences_0", "full_data_0", "job_request"]
221
+ credits = {"firstName": "HInt", "lastName": "PPI", "affiliation": "University of Rennes", "publicationLink": ""}
222
+
223
+ try :
224
+ requests.get(BASE, timeout=10).raise_for_status()
225
+ except requests.RequestException as e :
226
+ logger.error(f"QSProteome unreachable, upload skipped ({e}). Zip kept : {zip_file}")
227
+ return
228
+
229
+ runs = defaultdict(dict) # one run per top-level folder, as on the site
230
+ with zipfile.ZipFile(zip_file) as z :
231
+ for name in z.namelist() :
232
+ if any(k in name for k in KEYS) :
233
+ runs[name.split("/")[0]][name] = z.read(name)
234
+
235
+ with requests.Session() as s :
236
+ for run_id, files in runs.items() :
237
+ upload_run(s, run_id, files, credits)
238
+
239
+ Path(zip_file).unlink(missing_ok=True)
240
+
@@ -1110,7 +1110,7 @@ def prioritize_by_vram_fit (jobs, first_batch, GPU, max_per_batch=3) :
1110
1110
  all_batches.append(pending)
1111
1111
  return all_batches
1112
1112
 
1113
- def Generate_3D_model (HInt_object, CPU, multi_scoring, Informations_dict, interaction_type, job_with_vram_length, GPU, multi_job_per_gpu, seq_bait={}, compounds_dict={}) :
1113
+ def Generate_3D_model (HInt_object, CPU, multi_scoring, send_to_database, Informations_dict, interaction_type, job_with_vram_length, GPU, multi_job_per_gpu, seq_bait={}, compounds_dict={}) :
1114
1114
  """
1115
1115
  Generate 3D models using multiple GPUs and multiprocessing.
1116
1116
 
@@ -1118,7 +1118,8 @@ def Generate_3D_model (HInt_object, CPU, multi_scoring, Informations_dict, inter
1118
1118
  ----------
1119
1119
  HInt_object : HInt object
1120
1120
  CPU : int
1121
- multi_scoring : bool
1121
+ multi_scoring : str
1122
+ send_to_database : str
1122
1123
  Informations_dict : dict
1123
1124
  interaction_files : str
1124
1125
  job_with_vram_length : list of tuple
@@ -1151,6 +1152,7 @@ def Generate_3D_model (HInt_object, CPU, multi_scoring, Informations_dict, inter
1151
1152
  HInt_object=HInt_object,
1152
1153
  CPU=CPU,
1153
1154
  multi_scoring=multi_scoring,
1155
+ send_to_database=send_to_database,
1154
1156
  Informations_dict=Informations_dict,
1155
1157
  GPU=GPU,
1156
1158
  max_vram=max_vram,
@@ -1163,7 +1165,7 @@ def Generate_3D_model (HInt_object, CPU, multi_scoring, Informations_dict, inter
1163
1165
  stop_flag.set()
1164
1166
  monitor.join()
1165
1167
 
1166
- def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, GPU, max_vram, interaction_type, multi_job_per_gpu, seq_bait, compounds_dict) :
1168
+ def manager (jobs_pending, HInt_object, CPU, multi_scoring, send_to_database, Informations_dict, GPU, max_vram, interaction_type, multi_job_per_gpu, seq_bait, compounds_dict) :
1167
1169
  """
1168
1170
  Manage repartition of jobs on GPUs, monitor VRAM usage, and handle job completion.
1169
1171
 
@@ -1173,6 +1175,7 @@ def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, G
1173
1175
  HInt_object : HInt object
1174
1176
  CPU : int
1175
1177
  multi_scoring : str
1178
+ send_to_database : str
1176
1179
  Informations_dict : dict
1177
1180
  GPU : list
1178
1181
  max_vram : float
@@ -1199,6 +1202,9 @@ def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, G
1199
1202
  gpu_vram_used = {gpu: 0.0 for gpu in GPU}
1200
1203
  jobs_running = {gpu: [] for gpu in GPU} # {gpu_id: {job_str: process}}
1201
1204
 
1205
+ scoring_pool = ThreadPoolExecutor(max_workers=1) #scoring in background, one at a time
1206
+ scoring_futures = []
1207
+
1202
1208
  while jobs_pending or any(jobs_running.values()) :
1203
1209
 
1204
1210
  while not result_queue.empty() :
@@ -1208,12 +1214,14 @@ def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, G
1208
1214
  if j == job :
1209
1215
  p.join()
1210
1216
  jobs_running[gpu_id].pop(i)
1217
+
1211
1218
  if status == "done" :
1212
- Score_interaction(HInt_object, Informations_dict, CPU, interaction_type, job, multi_scoring, "")
1213
- HInt_object.Make_save_dict()
1219
+ scoring_futures.append(scoring_pool.submit(Score_interaction, HInt_object, Informations_dict, CPU, interaction_type, send_to_database, job, multi_scoring, ""))
1220
+
1214
1221
  elif status == "error" :
1215
1222
  logger.error(f"Error {job}, put on the waiting list")
1216
1223
  jobs_pending.append((job, v))
1224
+
1217
1225
  break
1218
1226
 
1219
1227
  launched = False
@@ -1242,7 +1250,7 @@ def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, G
1242
1250
 
1243
1251
  free = max_vram - gpu_vram_used[gpu_id]
1244
1252
  if job_vram <= free and (multi_job_per_gpu or len(jobs_running[gpu_id]) == 0) :
1245
- logging.info(f"[GPU {gpu_id}] VRAM available for scheduling: "
1253
+ logger.info(f"[GPU {gpu_id}] VRAM available for scheduling: "
1246
1254
  f"{free:.2f} GB"
1247
1255
  )
1248
1256
 
@@ -1267,7 +1275,7 @@ def manager (jobs_pending, HInt_object, CPU, multi_scoring, Informations_dict, G
1267
1275
  gpu_vram_used[gpu_id] += job_vram
1268
1276
  jobs_running[gpu_id].append((interaction, p, job_vram))
1269
1277
  jobs_pending.remove((interaction, job_vram))
1270
- logging.info(
1278
+ logger.info(
1271
1279
  f"[GPU {gpu_id}] Job started: '{interaction.strip()}' | "
1272
1280
  f"PID: {p.pid} | "
1273
1281
  f"Predicted VRAM: {job_vram:.2f} GB | "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HInt-ppi
3
- Version: 0.9.2
3
+ Version: 0.9.3
4
4
  Summary: A tool to find homologous interactions and speed up AlphaFold-based structural modeling.
5
5
  Home-page: https://github.com/Qrouger/HInt
6
6
  Author: Quentin Rouger
@@ -5,6 +5,7 @@ setup.py
5
5
  HInt/File_proteins.py
6
6
  HInt/HInt.py
7
7
  HInt/Scoring_HInt.py
8
+ HInt/Send_to_database.py
8
9
  HInt/Utils_HInt.py
9
10
  HInt/__init__.py
10
11
  HInt/get_good_inter_pae.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: HInt-ppi
3
- Version: 0.9.2
3
+ Version: 0.9.3
4
4
  Summary: A tool to find homologous interactions and speed up AlphaFold-based structural modeling.
5
5
  Home-page: https://github.com/Qrouger/HInt
6
6
  Author: Quentin Rouger
@@ -173,7 +173,7 @@ MNEVYVIAGGEWLRNNLNAIAAFMGTWTWDSIEKIALTLSVLAVAVMWVQRHNVMDLLGWVAVFVLISLLVNVRTSVQII
173
173
  You need to be in the directory containing the HInt.txt file and activate the HInt Conda environment.
174
174
 
175
175
  ```bash
176
- HInt --cpu <Integer> --gpu <Integer(s)> --multi_job_per_gpu <Boolean>
176
+ HInt --cpu <Integer> --gpu <Integer(s)> --multi_job_per_gpu <Boolean> --send_to_database <All,Negative,None>
177
177
  ```
178
178
  <details>
179
179
  <summary>Flag descriptions </summary>
@@ -187,6 +187,9 @@ HInt --cpu <Integer> --gpu <Integer(s)> --multi_job_per_gpu <Boolean>
187
187
 
188
188
  # Allows multiple jobs to run on a single GPU, reducing time of modeling. By default set on True.
189
189
  --multi_job_per_gpu : Boolean
190
+
191
+ # Allows to sending interaction generated in a public database (https://qsproteome.org/). All PPI, only negative PPI or none. By default set on None.
192
+ --send_to_database : All, Negative or None.
190
193
  ```
191
194
  </details>
192
195
 
@@ -4,7 +4,7 @@ from setuptools import setup
4
4
 
5
5
  setup(
6
6
  name='HInt-ppi',
7
- version='0.9.2',
7
+ version='0.9.3',
8
8
  description=(
9
9
  'A tool to find homologous interactions and speed up AlphaFold-based structural modeling.'
10
10
  ),
File without changes
File without changes
File without changes
File without changes
File without changes