wangjin2000 commited on
Commit
6fad7e1
·
verified ·
1 Parent(s): e3ab95b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -177,7 +177,7 @@ def compute_plddt_iptm(protein_seq, binder_seq):
177
 
178
  return avg_plddt, iPTM
179
 
180
- def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_length = 15, top_k = 3, num_binders = 4):
181
  start = time.time()
182
 
183
  peptide_length = int(peptide_length)
@@ -211,7 +211,7 @@ def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_
211
  ppl_value = compute_pseudo_perplexity(model, tokenizer, protein_seq, generated_binder)
212
 
213
  # Get PLDDT from ESMFold model
214
- #plddt_value, iPTM_value = compute_plddt_iptm(protein_seq, generated_binder)
215
  plddt_value, iPTM_value = [0, 0]
216
 
217
  # Add the generated binder and its PPL to the results list
@@ -254,7 +254,7 @@ def predict_peptide(base_model_path, finetuned_model_path, input_seqs, peptide_l
254
 
255
  return results_df, PPC
256
 
257
- def predict_peptide_from_file(base_model_path, finetuned_model_path, file_obj, max_peptide_length=15, num_binders=4, top_k=3):
258
  # Load the model
259
  loaded_model = AutoModelForMaskedLM.from_pretrained(finetuned_model_path)
260
 
@@ -275,7 +275,8 @@ def predict_peptide_from_file(base_model_path, finetuned_model_path, file_obj, m
275
 
276
  #get metrics for ground truth peptide
277
  ppl = compute_pseudo_perplexity(loaded_model, tokenizer, protein_seq, peptide_seq)
278
- plddt, iptm = compute_plddt_iptm(protein_seq, peptide_seq)
 
279
 
280
  results.append([protein_seq, peptide_seq, ppl, plddt, iptm, 1]) # flag 1 for ground truth peptide
281
 
@@ -339,7 +340,7 @@ with demo:
339
  )
340
  with gr.Row():
341
  peptide_length=gr.Slider(minimum=10, maximum=100, step=1, label="Peptide Maximum Length", value=15)
342
- num_pred_peptides=gr.Slider(minimum=1, maximum=10, step=1, label="Number of Predicted Peptides", value=4)
343
  with gr.Column(scale=5, variant="compact"):
344
  name = gr.Dropdown(
345
  label="Choose a Sample Protein",
 
177
 
178
  return avg_plddt, iPTM
179
 
180
+ def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_length = 15, top_k = 3, num_binders = 5):
181
  start = time.time()
182
 
183
  peptide_length = int(peptide_length)
 
211
  ppl_value = compute_pseudo_perplexity(model, tokenizer, protein_seq, generated_binder)
212
 
213
  # Get PLDDT from ESMFold model
214
+ #plddt_value, iPTM_value = compute_plddt_iptm(protein_seq, generated_binder) #too time-consuming
215
  plddt_value, iPTM_value = [0, 0]
216
 
217
  # Add the generated binder and its PPL to the results list
 
254
 
255
  return results_df, PPC
256
 
257
+ def predict_peptide_from_file(base_model_path, finetuned_model_path, file_obj, max_peptide_length=15, num_binders=5, top_k=3):
258
  # Load the model
259
  loaded_model = AutoModelForMaskedLM.from_pretrained(finetuned_model_path)
260
 
 
275
 
276
  #get metrics for ground truth peptide
277
  ppl = compute_pseudo_perplexity(loaded_model, tokenizer, protein_seq, peptide_seq)
278
+ #plddt, iptm = compute_plddt_iptm(protein_seq, peptide_seq) #too time-consuming
279
+ plddt_value, iPTM_value = [0, 0]
280
 
281
  results.append([protein_seq, peptide_seq, ppl, plddt, iptm, 1]) # flag 1 for ground truth peptide
282
 
 
340
  )
341
  with gr.Row():
342
  peptide_length=gr.Slider(minimum=10, maximum=100, step=1, label="Peptide Maximum Length", value=15)
343
+ num_pred_peptides=gr.Slider(minimum=1, maximum=10, step=1, label="Number of Predicted Peptides", value=5)
344
  with gr.Column(scale=5, variant="compact"):
345
  name = gr.Dropdown(
346
  label="Choose a Sample Protein",