Spaces:
Sleeping
Sleeping
Simon Duerr
commited on
Commit
•
0fc2f31
1
Parent(s):
334e3a1
fix:zip file path, memory consumption, feat: surface toggle, 6moa example
Browse files- app.py +25 -3
- examples/6moa_ligand.sdf +71 -0
- examples/6moa_protein_processed.pdb +0 -0
app.py
CHANGED
@@ -156,6 +156,7 @@ def molecule(input_pdb, ligand_pdb, original_ligand):
|
|
156 |
</head>
|
157 |
<body>
|
158 |
<button id="startanimation">Replay diffusion process</button>
|
|
|
159 |
<div>
|
160 |
<span class="green"></span> Uploaded ligand position
|
161 |
<span class="magenta"></span> Predicted ligand position
|
@@ -174,7 +175,8 @@ def molecule(input_pdb, ligand_pdb, original_ligand):
|
|
174 |
+ """
|
175 |
|
176 |
let viewer = null;
|
177 |
-
|
|
|
178 |
$(document).ready(function () {
|
179 |
let element = $("#container");
|
180 |
let config = { backgroundColor: "white" };
|
@@ -197,6 +199,15 @@ def molecule(input_pdb, ligand_pdb, original_ligand):
|
|
197 |
$("#startanimation").click(function() {
|
198 |
viewer.animate({loop: "forward",reps: 1});
|
199 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
</script>
|
201 |
</body></html>"""
|
202 |
)
|
@@ -212,7 +223,7 @@ import sys
|
|
212 |
|
213 |
|
214 |
def esm(protein_path, out_file):
|
215 |
-
print("
|
216 |
esm_embedding_prep(out_file, protein_path)
|
217 |
# create args object with defaults
|
218 |
os.environ["HOME"] = "esm/model_weights"
|
@@ -449,11 +460,15 @@ def update(inp, file, ligand_inp, ligand_file, n_it):
|
|
449 |
failures += 1
|
450 |
return None
|
451 |
# zip outputs
|
452 |
-
zippath = shutil.make_archive(
|
|
|
|
|
453 |
print("Zipped outputs to", zippath)
|
454 |
labels = [
|
455 |
f"rank {i+1}, confidence {confidences[i]:.2f}" for i in range(len(filenames))
|
456 |
]
|
|
|
|
|
457 |
return (
|
458 |
molecule(pdb_path, filenames[0], ligand_file),
|
459 |
gr.Dropdown.update(choices=labels, value=labels[0]),
|
@@ -515,6 +530,13 @@ with demo:
|
|
515 |
"examples/6w70_ligand.sdf",
|
516 |
10,
|
517 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
[
|
519 |
"",
|
520 |
"examples/6o5u_protein_processed.pdb",
|
|
|
156 |
</head>
|
157 |
<body>
|
158 |
<button id="startanimation">Replay diffusion process</button>
|
159 |
+
<button id="Toggle surface">Toggle surface representation</button>
|
160 |
<div>
|
161 |
<span class="green"></span> Uploaded ligand position
|
162 |
<span class="magenta"></span> Predicted ligand position
|
|
|
175 |
+ """
|
176 |
|
177 |
let viewer = null;
|
178 |
+
let surface = false;
|
179 |
+
let surf = null;
|
180 |
$(document).ready(function () {
|
181 |
let element = $("#container");
|
182 |
let config = { backgroundColor: "white" };
|
|
|
199 |
$("#startanimation").click(function() {
|
200 |
viewer.animate({loop: "forward",reps: 1});
|
201 |
});
|
202 |
+
$("#togglesurface").click(function() {
|
203 |
+
if (surface!=true){
|
204 |
+
surf = viewer.addSurface(py3Dmol.VDW,{"opacity":0.9,"color":"white"});
|
205 |
+
surface = true;
|
206 |
+
}else{
|
207 |
+
removeSurface(surf)
|
208 |
+
surface = false;
|
209 |
+
}
|
210 |
+
});
|
211 |
</script>
|
212 |
</body></html>"""
|
213 |
)
|
|
|
223 |
|
224 |
|
225 |
def esm(protein_path, out_file):
|
226 |
+
print("running esm")
|
227 |
esm_embedding_prep(out_file, protein_path)
|
228 |
# create args object with defaults
|
229 |
os.environ["HOME"] = "esm/model_weights"
|
|
|
460 |
failures += 1
|
461 |
return None
|
462 |
# zip outputs
|
463 |
+
zippath = shutil.make_archive(
|
464 |
+
os.path.join("results", os.path.basename(pdb_path)), "zip", write_dir
|
465 |
+
)
|
466 |
print("Zipped outputs to", zippath)
|
467 |
labels = [
|
468 |
f"rank {i+1}, confidence {confidences[i]:.2f}" for i in range(len(filenames))
|
469 |
]
|
470 |
+
|
471 |
+
torch.cuda.empty_cache()
|
472 |
return (
|
473 |
molecule(pdb_path, filenames[0], ligand_file),
|
474 |
gr.Dropdown.update(choices=labels, value=labels[0]),
|
|
|
530 |
"examples/6w70_ligand.sdf",
|
531 |
10,
|
532 |
],
|
533 |
+
[
|
534 |
+
"6moa",
|
535 |
+
"examples/6moa_protein_processed.pdb",
|
536 |
+
"",
|
537 |
+
"examples/6moa_ligand.sdf",
|
538 |
+
10,
|
539 |
+
],
|
540 |
[
|
541 |
"",
|
542 |
"examples/6o5u_protein_processed.pdb",
|
examples/6moa_ligand.sdf
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
RDKit 3D
|
3 |
+
|
4 |
+
30 35 0 0 0 0 0 0 0 0999 V2000
|
5 |
+
6.2968 58.1936 -6.7517 C 0 0 0 0 0 0 0 0 0 0 0 0
|
6 |
+
5.1035 58.8201 -6.1288 C 0 0 0 0 0 0 0 0 0 0 0 0
|
7 |
+
3.7958 58.4707 -6.4904 C 0 0 0 0 0 0 0 0 0 0 0 0
|
8 |
+
2.7073 59.0722 -5.8919 C 0 0 0 0 0 0 0 0 0 0 0 0
|
9 |
+
2.9189 60.0304 -4.9246 C 0 0 0 0 0 0 0 0 0 0 0 0
|
10 |
+
4.2268 60.3805 -4.5624 C 0 0 0 0 0 0 0 0 0 0 0 0
|
11 |
+
5.3090 59.7770 -5.1629 C 0 0 0 0 0 0 0 0 0 0 0 0
|
12 |
+
6.6607 60.1383 -4.7890 C 0 0 0 0 0 0 0 0 0 0 0 0
|
13 |
+
7.3183 61.1933 -5.4064 C 0 0 0 0 0 0 0 0 0 0 0 0
|
14 |
+
8.5883 61.5725 -5.0913 C 0 0 0 0 0 0 0 0 0 0 0 0
|
15 |
+
9.2881 60.8940 -4.1110 C 0 0 0 0 0 0 0 0 0 0 0 0
|
16 |
+
8.6560 59.8464 -3.4872 C 0 0 0 0 0 0 0 0 0 0 0 0
|
17 |
+
7.3711 59.4625 -3.8057 C 0 0 0 0 0 0 0 0 0 0 0 0
|
18 |
+
7.0027 58.4275 -3.0563 N 0 0 0 0 0 0 0 0 0 0 0 0
|
19 |
+
8.0627 58.1502 -2.2536 C 0 0 0 0 0 0 0 0 0 0 0 0
|
20 |
+
9.0581 59.0122 -2.5200 N 0 0 0 0 0 0 0 0 0 0 0 0
|
21 |
+
8.1493 57.0716 -1.2283 C 0 0 0 0 0 0 0 0 0 0 0 0
|
22 |
+
9.5766 56.5796 -1.0253 C 0 0 0 0 0 0 0 0 0 0 0 0
|
23 |
+
8.8832 57.3389 0.0412 C 0 0 0 0 0 0 0 0 0 0 0 0
|
24 |
+
9.2291 62.6963 -5.7800 C 0 0 0 0 0 0 0 0 0 0 0 0
|
25 |
+
9.7347 63.8265 -5.1605 C 0 0 0 0 0 0 0 0 0 0 0 0
|
26 |
+
10.2222 64.5824 -6.1570 N 0 0 0 0 0 0 0 0 0 0 0 0
|
27 |
+
10.0372 63.9781 -7.2947 O 0 0 0 0 0 0 0 0 0 0 0 0
|
28 |
+
9.4349 62.8237 -7.1167 C 0 0 0 0 0 0 0 0 0 0 0 0
|
29 |
+
9.0345 61.8184 -8.1338 C 0 0 0 0 0 0 0 0 0 0 0 0
|
30 |
+
9.6965 64.0557 -3.7051 C 0 0 0 0 0 0 0 0 0 0 0 0
|
31 |
+
4.4459 61.3389 -3.5948 C 0 0 0 0 0 0 0 0 0 0 0 0
|
32 |
+
3.3642 61.9433 -2.9935 C 0 0 0 0 0 0 0 0 0 0 0 0
|
33 |
+
2.0968 61.5645 -3.3844 C 0 0 0 0 0 0 0 0 0 0 0 0
|
34 |
+
1.8948 60.6282 -4.3295 N 0 0 0 0 0 0 0 0 0 0 0 0
|
35 |
+
1 2 1 0
|
36 |
+
2 3 2 0
|
37 |
+
3 4 1 0
|
38 |
+
4 5 2 0
|
39 |
+
5 6 1 0
|
40 |
+
6 7 2 0
|
41 |
+
7 8 1 0
|
42 |
+
8 9 2 0
|
43 |
+
9 10 1 0
|
44 |
+
10 11 2 0
|
45 |
+
11 12 1 0
|
46 |
+
12 13 2 0
|
47 |
+
13 14 1 0
|
48 |
+
14 15 2 0
|
49 |
+
15 16 1 0
|
50 |
+
15 17 1 0
|
51 |
+
17 18 1 0
|
52 |
+
18 19 1 0
|
53 |
+
10 20 1 0
|
54 |
+
20 21 1 0
|
55 |
+
21 22 2 0
|
56 |
+
22 23 1 0
|
57 |
+
23 24 1 0
|
58 |
+
24 25 1 0
|
59 |
+
21 26 1 0
|
60 |
+
6 27 1 0
|
61 |
+
27 28 2 0
|
62 |
+
28 29 1 0
|
63 |
+
29 30 2 0
|
64 |
+
7 2 1 0
|
65 |
+
30 5 1 0
|
66 |
+
13 8 1 0
|
67 |
+
16 12 1 0
|
68 |
+
19 17 1 0
|
69 |
+
24 20 2 0
|
70 |
+
M END
|
71 |
+
$$$$
|
examples/6moa_protein_processed.pdb
ADDED
The diff for this file is too large to render.
See raw diff
|
|