Spaces:
Runtime error
Runtime error
Update inference_app.py
Browse files- inference_app.py +8 -30
inference_app.py
CHANGED
|
@@ -28,11 +28,6 @@ from enspara import geometry
|
|
| 28 |
from sklearn.cluster import DBSCAN
|
| 29 |
import pandas as pd
|
| 30 |
|
| 31 |
-
os.system("pwd")
|
| 32 |
-
|
| 33 |
-
os.system("ls")
|
| 34 |
-
|
| 35 |
-
os.system("touch ligand.sdf")
|
| 36 |
|
| 37 |
def run_smina(
|
| 38 |
ligand_path, protein_path, out_path, pocket_center, pocket_size, num_poses=1, exhaustiveness=1
|
|
@@ -151,36 +146,14 @@ def predict (input_sequence, input_ligand, input_protein):
|
|
| 151 |
output_text = run_smina(
|
| 152 |
"/usr/src/app/ligand.pdbqt",
|
| 153 |
"/usr/src/app/receptor.pdbqt",
|
| 154 |
-
"/usr/src/app/docking_pose.
|
| 155 |
pocket_center,
|
| 156 |
[10,10,10],
|
| 157 |
)
|
| 158 |
-
|
| 159 |
-
parser = PDB.PDBParser(QUIET=True)
|
| 160 |
-
|
| 161 |
-
# Parse the PDB files
|
| 162 |
-
structure1 = parser.get_structure('Structure1', input_protein.name)
|
| 163 |
-
structure2 = parser.get_structure('Structure2', "/usr/src/app/docking_pose_renamed.pdb")
|
| 164 |
-
|
| 165 |
-
# Create a new structure for the combined output
|
| 166 |
-
combined_structure = PDB.Structure.Structure('Combined_Structure')
|
| 167 |
-
|
| 168 |
-
# Add models from the first structure
|
| 169 |
-
for model in structure1:
|
| 170 |
-
combined_structure.add(model)
|
| 171 |
-
|
| 172 |
-
# Add models from the second structure
|
| 173 |
-
for model in structure2:
|
| 174 |
-
combined_structure.add(model)
|
| 175 |
-
|
| 176 |
-
# Save the combined structure to the output file
|
| 177 |
-
io = PDB.PDBIO()
|
| 178 |
-
io.set_structure(combined_structure)
|
| 179 |
-
io.save("/usr/src/app/output.pdb")
|
| 180 |
-
#os.system(f"pdb_merge {input_protein.name} /usr/src/app/docking_pose_renamed.pdb > /usr/src/app/output.pdb")
|
| 181 |
end_time = time.time()
|
| 182 |
run_time = end_time - start_time
|
| 183 |
-
return "/usr/src/app/output.pdb", run_time
|
| 184 |
|
| 185 |
with gr.Blocks() as app:
|
| 186 |
|
|
@@ -229,6 +202,11 @@ with gr.Blocks() as app:
|
|
| 229 |
"resname": "LIG",
|
| 230 |
"style": "stick",
|
| 231 |
"color": "greenCarbon",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
}
|
| 233 |
|
| 234 |
]
|
|
|
|
| 28 |
from sklearn.cluster import DBSCAN
|
| 29 |
import pandas as pd
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def run_smina(
|
| 33 |
ligand_path, protein_path, out_path, pocket_center, pocket_size, num_poses=1, exhaustiveness=1
|
|
|
|
| 146 |
output_text = run_smina(
|
| 147 |
"/usr/src/app/ligand.pdbqt",
|
| 148 |
"/usr/src/app/receptor.pdbqt",
|
| 149 |
+
"/usr/src/app/docking_pose.sdf",
|
| 150 |
pocket_center,
|
| 151 |
[10,10,10],
|
| 152 |
)
|
| 153 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
end_time = time.time()
|
| 155 |
run_time = end_time - start_time
|
| 156 |
+
return ["/usr/src/app/output.pdb","/usr/src/app/docking_pose.sdf"], run_time
|
| 157 |
|
| 158 |
with gr.Blocks() as app:
|
| 159 |
|
|
|
|
| 202 |
"resname": "LIG",
|
| 203 |
"style": "stick",
|
| 204 |
"color": "greenCarbon",
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"model": 1,
|
| 208 |
+
"style": "stick",
|
| 209 |
+
"color": "greenCarbon",
|
| 210 |
}
|
| 211 |
|
| 212 |
]
|