Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import re
|
2 |
from pathlib import Path
|
3 |
import gradio as gr
|
4 |
|
@@ -25,6 +25,7 @@ def make_cond_seq(seq_len, msa_file, n_sequences, model_type):
|
|
25 |
if model_type == "EvoDiff-MSA":
|
26 |
checkpoint = MSA_OA_DM_MAXSUB()
|
27 |
model, collater, tokenizer, scheme = checkpoint
|
|
|
28 |
tokeinzed_sample, generated_sequence = generate_query_oadm_msa_simple(msa_file.name, model, tokenizer, int(n_sequences), seq_length=int(seq_len), device='cpu', selection_type='random')
|
29 |
|
30 |
return generated_sequence
|
@@ -49,6 +50,7 @@ def make_scaffold_motifs(pdb_code, start_idx, end_idx, scaffold_length, model_ty
|
|
49 |
checkpoint = OA_DM_38M()
|
50 |
model, collater, tokenizer, scheme = checkpoint
|
51 |
data_top_dir = ''
|
|
|
52 |
start_idx = list(map(int, start_idx.strip('][').split(',')))
|
53 |
end_idx = list(map(int, end_idx.strip('][').split(',')))
|
54 |
generated_sequence, new_start_idx, new_end_idx = generate_scaffold(model, pdb_code, start_idx, end_idx, scaffold_length, data_top_dir, tokenizer, device='cpu')
|
@@ -67,9 +69,7 @@ usg_app = gr.Interface(
|
|
67 |
gr.Slider(10, 250, step=1, label = "Sequence Length"),
|
68 |
gr.Dropdown(["EvoDiff-Seq-OADM 38M", "EvoDiff-D3PM-Uniform 38M"], value="EvoDiff-Seq-OADM 38M", type="value", label = "Model")
|
69 |
],
|
70 |
-
outputs=[
|
71 |
-
"text"
|
72 |
-
],
|
73 |
title = "Unconditional sequence generation",
|
74 |
description="Generate a sequence with `EvoDiff-Seq-OADM 38M` (smaller/faster) or `EvoDiff-D3PM-Uniform 38M` (larger/slower) models."
|
75 |
)
|
@@ -82,9 +82,7 @@ csg_app = gr.Interface(
|
|
82 |
gr.Number(value=64, placeholder=64, precision=0, label = "Number of Sequences to Sample"),
|
83 |
gr.Dropdown(["EvoDiff-MSA"], value="EvoDiff-MSA", type="value", label = "Model")
|
84 |
],
|
85 |
-
outputs=[
|
86 |
-
"text"
|
87 |
-
],
|
88 |
# examples=[["https://github.com/microsoft/evodiff/raw/main/examples/example_files/bfd_uniclust_hits.a3m"]],
|
89 |
title = "Conditional sequence generation",
|
90 |
description="Evolutionary guided sequence generation with the `EvoDiff-MSA` model."
|
@@ -93,14 +91,14 @@ csg_app = gr.Interface(
|
|
93 |
idr_app = gr.Interface(
|
94 |
fn=make_inpainted_idrs,
|
95 |
inputs=[
|
96 |
-
gr.Textbox(
|
|
|
|
|
97 |
gr.Number(value=20, placeholder=20, precision=0, label = "Start Index"),
|
98 |
gr.Number(value=50, placeholder=50, precision=0, label = "End Index"),
|
99 |
gr.Dropdown(["EvoDiff-Seq"], value="EvoDiff-Seq", type="value", label = "Model")
|
100 |
],
|
101 |
-
outputs=[
|
102 |
-
"text"
|
103 |
-
],
|
104 |
title = "Inpainting IDRs",
|
105 |
description="Inpaining a new region inside a given sequence using the `EvoDiff-Seq` model."
|
106 |
)
|
@@ -108,15 +106,13 @@ idr_app = gr.Interface(
|
|
108 |
scaffold_app = gr.Interface(
|
109 |
fn=make_scaffold_motifs,
|
110 |
inputs=[
|
111 |
-
gr.Textbox(placeholder="1prw", label = "PDB Code"),
|
112 |
gr.Textbox(value="[15, 51]", placeholder="[15, 51]", label = "Start Index (as list)"),
|
113 |
gr.Textbox(value="[34, 70]", placeholder="[34, 70]", label = "End Index (as list)"),
|
114 |
gr.Number(value=75, placeholder=75, precision=0, label = "Scaffold Length"),
|
115 |
gr.Dropdown(["EvoDiff-Seq", "EvoDiff-MSA"], value="EvoDiff-Seq", type="value", label = "Model")
|
116 |
],
|
117 |
-
outputs=[
|
118 |
-
"text"
|
119 |
-
],
|
120 |
title = "Scaffolding functional motifs",
|
121 |
description="Scaffolding a new functional motif inside a given PDB structure using the `EvoDiff-Seq` model."
|
122 |
)
|
|
|
1 |
+
import re, os
|
2 |
from pathlib import Path
|
3 |
import gradio as gr
|
4 |
|
|
|
25 |
if model_type == "EvoDiff-MSA":
|
26 |
checkpoint = MSA_OA_DM_MAXSUB()
|
27 |
model, collater, tokenizer, scheme = checkpoint
|
28 |
+
print(f"MSA File Path: {msa_file.name}")
|
29 |
tokeinzed_sample, generated_sequence = generate_query_oadm_msa_simple(msa_file.name, model, tokenizer, int(n_sequences), seq_length=int(seq_len), device='cpu', selection_type='random')
|
30 |
|
31 |
return generated_sequence
|
|
|
50 |
checkpoint = OA_DM_38M()
|
51 |
model, collater, tokenizer, scheme = checkpoint
|
52 |
data_top_dir = ''
|
53 |
+
print("Current Scaffold Directory:", os.getcwd())
|
54 |
start_idx = list(map(int, start_idx.strip('][').split(',')))
|
55 |
end_idx = list(map(int, end_idx.strip('][').split(',')))
|
56 |
generated_sequence, new_start_idx, new_end_idx = generate_scaffold(model, pdb_code, start_idx, end_idx, scaffold_length, data_top_dir, tokenizer, device='cpu')
|
|
|
69 |
gr.Slider(10, 250, step=1, label = "Sequence Length"),
|
70 |
gr.Dropdown(["EvoDiff-Seq-OADM 38M", "EvoDiff-D3PM-Uniform 38M"], value="EvoDiff-Seq-OADM 38M", type="value", label = "Model")
|
71 |
],
|
72 |
+
outputs=["text"],
|
|
|
|
|
73 |
title = "Unconditional sequence generation",
|
74 |
description="Generate a sequence with `EvoDiff-Seq-OADM 38M` (smaller/faster) or `EvoDiff-D3PM-Uniform 38M` (larger/slower) models."
|
75 |
)
|
|
|
82 |
gr.Number(value=64, placeholder=64, precision=0, label = "Number of Sequences to Sample"),
|
83 |
gr.Dropdown(["EvoDiff-MSA"], value="EvoDiff-MSA", type="value", label = "Model")
|
84 |
],
|
85 |
+
outputs=["text"],
|
|
|
|
|
86 |
# examples=[["https://github.com/microsoft/evodiff/raw/main/examples/example_files/bfd_uniclust_hits.a3m"]],
|
87 |
title = "Conditional sequence generation",
|
88 |
description="Evolutionary guided sequence generation with the `EvoDiff-MSA` model."
|
|
|
91 |
idr_app = gr.Interface(
|
92 |
fn=make_inpainted_idrs,
|
93 |
inputs=[
|
94 |
+
gr.Textbox(value = "DQTERTVRSFEGRRTAPYLDSRNVLTIGYGHLLNRPGANKSWEGRLTSALPREFKQRLTELAASQLHETDVRLATARAQALYGSGAYFESVPVSLNDLWFDSVFNLGERKLLNWSGLRTKLESRDWGAAAKDLGRHTFGREPVSRRMAESMRMRRGIDLNHYNI",
|
95 |
+
placeholder="DQTERTVRSFEGRRTAPYLDSRNVLTIGYGHLLNRPGANKSWEGRLTSALPREFKQRLTELAASQLHETDVRLATARAQALYGSGAYFESVPVSLNDLWFDSVFNLGERKLLNWSGLRTKLESRDWGAAAKDLGRHTFGREPVSRRMAESMRMRRGIDLNHYNI",
|
96 |
+
label = "Sequence"),
|
97 |
gr.Number(value=20, placeholder=20, precision=0, label = "Start Index"),
|
98 |
gr.Number(value=50, placeholder=50, precision=0, label = "End Index"),
|
99 |
gr.Dropdown(["EvoDiff-Seq"], value="EvoDiff-Seq", type="value", label = "Model")
|
100 |
],
|
101 |
+
outputs=["text"],
|
|
|
|
|
102 |
title = "Inpainting IDRs",
|
103 |
description="Inpaining a new region inside a given sequence using the `EvoDiff-Seq` model."
|
104 |
)
|
|
|
106 |
scaffold_app = gr.Interface(
|
107 |
fn=make_scaffold_motifs,
|
108 |
inputs=[
|
109 |
+
gr.Textbox(value="1prw", placeholder="1prw", label = "PDB Code"),
|
110 |
gr.Textbox(value="[15, 51]", placeholder="[15, 51]", label = "Start Index (as list)"),
|
111 |
gr.Textbox(value="[34, 70]", placeholder="[34, 70]", label = "End Index (as list)"),
|
112 |
gr.Number(value=75, placeholder=75, precision=0, label = "Scaffold Length"),
|
113 |
gr.Dropdown(["EvoDiff-Seq", "EvoDiff-MSA"], value="EvoDiff-Seq", type="value", label = "Model")
|
114 |
],
|
115 |
+
outputs=["text"],
|
|
|
|
|
116 |
title = "Scaffolding functional motifs",
|
117 |
description="Scaffolding a new functional motif inside a given PDB structure using the `EvoDiff-Seq` model."
|
118 |
)
|