santuchal commited on
Commit
9b669b3
·
verified ·
1 Parent(s): be704c6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -0
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_molecule3d import Molecule3D
3
+ import deepchem as dc
4
+ import os
5
+
6
+ example = Molecule3D().example_inputs()
7
+
8
+
9
+ reps = [
10
+ {
11
+ "model": 0,
12
+ "chain": "",
13
+ "resname": "",
14
+ "style": "stick",
15
+ "color": "whiteCarbon",
16
+ "residue_range": "",
17
+ "around": 0,
18
+ "height": 150,
19
+ "byres": False,
20
+ "visible": False
21
+ }
22
+ ]
23
+
24
+ def get_file_name_without_extension(file_path):
25
+ base_name = os.path.basename(file_path)
26
+ file_name = os.path.splitext(base_name)[0]
27
+ return file_name
28
+
29
+
30
+ def predict(input_receptor,input_ligand):
31
+ print(input_ligand)
32
+ vpg = dc.dock.pose_generation.VinaPoseGenerator()
33
+ saved_filename = get_file_name_without_extension(input_ligand)
34
+ complexes, scores = vpg.generate_poses(molecular_complex=(input_receptor,input_ligand), # protein-ligand files for docking,
35
+ out_dir='./output_directory',
36
+ generate_scores=True
37
+ )
38
+
39
+ # print(complexes[0])
40
+ return scores
41
+
42
+
43
+ with gr.Blocks() as docking:
44
+ inp = [Molecule3D(label="Receptor", reps=reps),Molecule3D(label="Ligand", reps=reps)]
45
+ out = gr.Textbox(label="Docking Output")#Molecule3D(label="Output", reps=reps)
46
+ # out = Molecule3D(label="Output", reps=reps)
47
+ btn = gr.Button("Docking")
48
+ btn.click(predict, inputs=inp, outputs=out)
49
+
50
+
51
+ if __name__ == '__main__':
52
+ docking.launch()