colbyford commited on
Commit
ac7c6bd
·
verified ·
1 Parent(s): 56bb9b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -36
app.py CHANGED
@@ -53,24 +53,24 @@ def make_inpainted_idrs(sequence, start_idx, end_idx, model_type):
53
 
54
  return generated_idr_output
55
 
56
- def make_scaffold_motifs(pdb_code, start_idx, end_idx, scaffold_length, model_type):
57
- if model_type == "EvoDiff-Seq":
58
- checkpoint = OA_DM_38M()
59
- model, collater, tokenizer, scheme = checkpoint
60
- data_top_dir = '/home/user/.cache/huggingface/datasets/'
61
- os.makedirs(data_top_dir, exist_ok=True)
62
- # print("Folders in User Cache Directory:", os.listdir("/home/user/.cache"))
63
- start_idx = list(map(int, start_idx.strip('][').split(',')))
64
- end_idx = list(map(int, end_idx.strip('][').split(',')))
65
- generated_sequence, new_start_idx, new_end_idx = generate_scaffold(model, pdb_code, start_idx, end_idx, scaffold_length, data_top_dir, tokenizer, device=get_device())
66
-
67
- generated_scaffold_output = {
68
- "generated_sequence": generated_sequence,
69
- "new_start_index": new_start_idx,
70
- "new_end_index": new_end_idx
71
- }
72
-
73
- return generated_scaffold_output
74
 
75
  usg_app = gr.Interface(
76
  fn=make_uncond_seq,
@@ -111,19 +111,19 @@ idr_app = gr.Interface(
111
  description="Inpainting a new region inside a given sequence using the `EvoDiff-Seq` model."
112
  )
113
 
114
- scaffold_app = gr.Interface(
115
- fn=make_scaffold_motifs,
116
- inputs=[
117
- gr.Textbox(value="1prw", label = "PDB Code"),
118
- gr.Textbox(value="[15, 51]", label = "Start Index (as list)"),
119
- gr.Textbox(value="[34, 70]", label = "End Index (as list)"),
120
- gr.Number(value=75, precision=0, label = "Scaffold Length"),
121
- gr.Dropdown(["EvoDiff-Seq", "EvoDiff-MSA"], value="EvoDiff-Seq", type="value", label = "Model")
122
- ],
123
- outputs=["text"],
124
- title = "Scaffolding functional motifs",
125
- description="Scaffolding a new functional motif inside a given PDB structure using the `EvoDiff-Seq` model."
126
- )
127
 
128
  with gr.Blocks() as edapp:
129
  with gr.Row():
@@ -132,7 +132,7 @@ with gr.Blocks() as edapp:
132
  # EvoDiff
133
  ## Generation of protein sequences and evolutionary alignments via discrete diffusion models
134
 
135
- Created By: Microsoft Research [Sarah Alamdari, Nitya Thakkar, Rianne van den Berg, Alex X. Lu, Nicolo Fusi, ProfileAva P. Amini, and Kevin K. Yang]
136
 
137
  Spaces App By: Tuple, The Cloud Genomics Company [Colby T. Ford]
138
  """
@@ -141,14 +141,14 @@ with gr.Blocks() as edapp:
141
  gr.TabbedInterface([
142
  usg_app,
143
  csg_app,
144
- idr_app,
145
- scaffold_app
146
  ],
147
  [
148
  "Unconditional sequence generation",
149
  "Conditional generation",
150
- "Inpainting IDRs",
151
- "Scaffolding functional motifs"
152
  ])
153
 
154
 
 
53
 
54
  return generated_idr_output
55
 
56
+ # def make_scaffold_motifs(pdb_code, start_idx, end_idx, scaffold_length, model_type):
57
+ # if model_type == "EvoDiff-Seq":
58
+ # checkpoint = OA_DM_38M()
59
+ # model, collater, tokenizer, scheme = checkpoint
60
+ # data_top_dir = '/home/user/.cache/huggingface/datasets/'
61
+ # os.makedirs(data_top_dir, exist_ok=True)
62
+ # # print("Folders in User Cache Directory:", os.listdir("/home/user/.cache"))
63
+ # start_idx = list(map(int, start_idx.strip('][').split(',')))
64
+ # end_idx = list(map(int, end_idx.strip('][').split(',')))
65
+ # generated_sequence, new_start_idx, new_end_idx = generate_scaffold(model, pdb_code, start_idx, end_idx, scaffold_length, data_top_dir, tokenizer, device=get_device())
66
+
67
+ # generated_scaffold_output = {
68
+ # "generated_sequence": generated_sequence,
69
+ # "new_start_index": new_start_idx,
70
+ # "new_end_index": new_end_idx
71
+ # }
72
+
73
+ # return generated_scaffold_output
74
 
75
  usg_app = gr.Interface(
76
  fn=make_uncond_seq,
 
111
  description="Inpainting a new region inside a given sequence using the `EvoDiff-Seq` model."
112
  )
113
 
114
+ # scaffold_app = gr.Interface(
115
+ # fn=make_scaffold_motifs,
116
+ # inputs=[
117
+ # gr.Textbox(value="1prw", label = "PDB Code"),
118
+ # gr.Textbox(value="[15, 51]", label = "Start Index (as list)"),
119
+ # gr.Textbox(value="[34, 70]", label = "End Index (as list)"),
120
+ # gr.Number(value=75, precision=0, label = "Scaffold Length"),
121
+ # gr.Dropdown(["EvoDiff-Seq", "EvoDiff-MSA"], value="EvoDiff-Seq", type="value", label = "Model")
122
+ # ],
123
+ # outputs=["text"],
124
+ # title = "Scaffolding functional motifs",
125
+ # description="Scaffolding a new functional motif inside a given PDB structure using the `EvoDiff-Seq` model."
126
+ # )
127
 
128
  with gr.Blocks() as edapp:
129
  with gr.Row():
 
132
  # EvoDiff
133
  ## Generation of protein sequences and evolutionary alignments via discrete diffusion models
134
 
135
+ Created By: Microsoft Research [Sarah Alamdari, Nitya Thakkar, Rianne van den Berg, Alex X. Lu, Nicolo Fusi, Ava P. Amini, and Kevin K. Yang]
136
 
137
  Spaces App By: Tuple, The Cloud Genomics Company [Colby T. Ford]
138
  """
 
141
  gr.TabbedInterface([
142
  usg_app,
143
  csg_app,
144
+ idr_app#,
145
+ # scaffold_app
146
  ],
147
  [
148
  "Unconditional sequence generation",
149
  "Conditional generation",
150
+ "Inpainting IDRs"#,
151
+ # "Scaffolding functional motifs"
152
  ])
153
 
154