Spaces:
Running
on
Zero
Running
on
Zero
Anton Bushuiev
commited on
Commit
·
d850a03
1
Parent(s):
538375d
Improve layout
Browse files
app.py
CHANGED
@@ -247,6 +247,7 @@ def plot_3dmol(pdb_path, ppi_path, mut, attn, attn_mut_id=0):
|
|
247 |
</script>
|
248 |
</body></html>"""
|
249 |
)
|
|
|
250 |
|
251 |
return f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
|
252 |
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
@@ -302,6 +303,8 @@ def predict(models, temp_dir, *inputs):
|
|
302 |
raise gr.Error("Prediction failed. Please double check your inputs.")
|
303 |
ddg = ddg.detach().numpy().tolist()
|
304 |
|
|
|
|
|
305 |
# Update dataframe and attention tensor
|
306 |
idx = df_sub.index
|
307 |
df.loc[idx, 'ddG [kcal/mol]'] = ddg
|
@@ -313,8 +316,6 @@ def predict(models, temp_dir, *inputs):
|
|
313 |
attn_pdb = attn
|
314 |
df['Attn Id'] = df['Attn Id'].astype(int)
|
315 |
|
316 |
-
logging.info('Predictions made')
|
317 |
-
|
318 |
# Round ddG values
|
319 |
df['ddG [kcal/mol]'] = df['ddG [kcal/mol]'].round(3)
|
320 |
|
@@ -385,15 +386,14 @@ with app:
|
|
385 |
|
386 |
After making a prediction with the model, you will see binding free energy changes (ddG values) for each mutation and a 3D visualization of the PPI with mutated residues highlighted in red. The visualization additionally shows
|
387 |
the attention coefficients of the model for the nearest neighboring residues, which quantifies the contribution of the residues to the predicted ddG value. The brighted and thicker a reisudes is, the more attention the model paid to it.
|
388 |
-
Currently, the web only visualizes the first mutation in the list.
|
389 |
""")
|
390 |
|
391 |
-
with gr.Row():
|
392 |
with gr.Column():
|
393 |
gr.Markdown("## PPI structure")
|
394 |
-
with gr.Row():
|
395 |
-
pdb_code = gr.Textbox(placeholder="1BUI", label="PDB code", info="Protein Data Bank
|
396 |
-
partners = gr.Textbox(placeholder="A,B,C", label="Partners", info="Protein
|
397 |
pdb_path = gr.File(file_count="single", label="Or PDB file instead of PDB code")
|
398 |
|
399 |
with gr.Column():
|
@@ -408,7 +408,7 @@ with app:
|
|
408 |
["1KNE", "A,P", ';'.join([f"TP6{a}" for a in AMINO_ACID_CODES_1])]
|
409 |
],
|
410 |
inputs=[pdb_code, partners, muts],
|
411 |
-
label="Examples (click on a line to pre-fill inputs)"
|
412 |
)
|
413 |
|
414 |
# Predict GUI
|
|
|
247 |
</script>
|
248 |
</body></html>"""
|
249 |
)
|
250 |
+
print(html)
|
251 |
|
252 |
return f"""<iframe style="width: 100%; height: 600px" name="result" allow="midi; geolocation; microphone; camera;
|
253 |
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
|
|
303 |
raise gr.Error("Prediction failed. Please double check your inputs.")
|
304 |
ddg = ddg.detach().numpy().tolist()
|
305 |
|
306 |
+
logging.info(f'Predictions made for {path}')
|
307 |
+
|
308 |
# Update dataframe and attention tensor
|
309 |
idx = df_sub.index
|
310 |
df.loc[idx, 'ddG [kcal/mol]'] = ddg
|
|
|
316 |
attn_pdb = attn
|
317 |
df['Attn Id'] = df['Attn Id'].astype(int)
|
318 |
|
|
|
|
|
319 |
# Round ddG values
|
320 |
df['ddG [kcal/mol]'] = df['ddG [kcal/mol]'].round(3)
|
321 |
|
|
|
386 |
|
387 |
After making a prediction with the model, you will see binding free energy changes (ddG values) for each mutation and a 3D visualization of the PPI with mutated residues highlighted in red. The visualization additionally shows
|
388 |
the attention coefficients of the model for the nearest neighboring residues, which quantifies the contribution of the residues to the predicted ddG value. The brighted and thicker a reisudes is, the more attention the model paid to it.
|
|
|
389 |
""")
|
390 |
|
391 |
+
with gr.Row(equal_height=True):
|
392 |
with gr.Column():
|
393 |
gr.Markdown("## PPI structure")
|
394 |
+
with gr.Row(equal_height=True):
|
395 |
+
pdb_code = gr.Textbox(placeholder="1BUI", label="PDB code", info="Protein Data Bank identifier for the structure (https://www.rcsb.org/)")
|
396 |
+
partners = gr.Textbox(placeholder="A,B,C", label="Partners", info="Protein chain identifiers in the PDB file forming the PPI interface (two or more)")
|
397 |
pdb_path = gr.File(file_count="single", label="Or PDB file instead of PDB code")
|
398 |
|
399 |
with gr.Column():
|
|
|
408 |
["1KNE", "A,P", ';'.join([f"TP6{a}" for a in AMINO_ACID_CODES_1])]
|
409 |
],
|
410 |
inputs=[pdb_code, partners, muts],
|
411 |
+
label="Examples (click on a line to pre-fill the inputs)"
|
412 |
)
|
413 |
|
414 |
# Predict GUI
|