simonduerr commited on
Commit
9bd7549
1 Parent(s): ac4779d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -27,13 +27,6 @@ from alphafold.model import data
27
  from alphafold.model import config
28
  from alphafold.model import model
29
 
30
- data = {'id': [], 'sequence': [],'length': []}
31
-
32
- sequencesdf = pd.DataFrame.from_dict(data)
33
-
34
- def update_seqs(choice):
35
- return gr.Textbox.update(choice)
36
-
37
 
38
  def mk_mock_template(query_sequence):
39
  """create blank template"""
@@ -127,9 +120,10 @@ def update_protGPT2(inp, length):
127
  generated_seqs = run_protgpt2(startsequence, seqlen)
128
  gen_seqs = [x["generated_text"] for x in generated_seqs]
129
  print(gen_seqs)
130
- data = {'id': range(len(gen_seqs)), 'sequence': gen_seqs,'length': [len(x) for x in gen_seqs]}
131
- sequencesdf = pd.DataFrame.from_dict(data)
132
- return sequencesdf
 
133
 
134
 
135
  def update(inp):
@@ -341,18 +335,16 @@ with proteindream:
341
  length = gr.Number(value=50, label="Target sequence length")
342
  btn = gr.Button("Predict sequences using protGPT2")
343
 
344
- results = gr.Dataframe(sequencesdf, label="Results", headers=["id","sequence", "length"])
345
- seqChoice = gr.Radio(["sequence 1", "sequence 2", "sequence 3","sequence 4","sequence 5"], label="Choose a sequence")
346
  btn.click(fn=update_protGPT2, inputs=[inp, length], outputs=results)
347
 
348
  gr.Markdown("## AlphaFold")
349
  gr.Markdown(
350
- "Select a generated sequence above for structure prediction using AlphaFold2."
351
  )
352
  with gr.Group():
353
  chosenSeq = gr.Textbox(label="Chosen sequence")
354
  btn2 = gr.Button("Predict structure")
355
- seqChoice.change(fn=change_sequence, inputs=seqChoice, outputs=chosenSeq)
356
  with gr.Group():
357
  meanpLDDT = gr.Textbox(label="Mean pLDDT of chosen sequence")
358
  with gr.Row():
 
27
  from alphafold.model import config
28
  from alphafold.model import model
29
 
 
 
 
 
 
 
 
30
 
31
  def mk_mock_template(query_sequence):
32
  """create blank template"""
 
120
  generated_seqs = run_protgpt2(startsequence, seqlen)
121
  gen_seqs = [x["generated_text"] for x in generated_seqs]
122
  print(gen_seqs)
123
+ sequencestxt = ""
124
+ for i, seq in enumerate(gen_seqs):
125
+ sequencestxt +=f"seq{i}>\n{seq}\n"
126
+ return sequencestxt
127
 
128
 
129
  def update(inp):
 
335
  length = gr.Number(value=50, label="Target sequence length")
336
  btn = gr.Button("Predict sequences using protGPT2")
337
 
338
+ results = gr.Textbox(label="Results", lines=15)
 
339
  btn.click(fn=update_protGPT2, inputs=[inp, length], outputs=results)
340
 
341
  gr.Markdown("## AlphaFold")
342
  gr.Markdown(
343
+ "Select a generated sequence above and copy it in the field below for structure prediction using AlphaFold2."
344
  )
345
  with gr.Group():
346
  chosenSeq = gr.Textbox(label="Chosen sequence")
347
  btn2 = gr.Button("Predict structure")
 
348
  with gr.Group():
349
  meanpLDDT = gr.Textbox(label="Mean pLDDT of chosen sequence")
350
  with gr.Row():