wangjin2000 commited on
Commit
f5eb425
·
verified ·
1 Parent(s): 192ed09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -204,6 +204,7 @@ def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_
204
 
205
  # Add the generated binder and its PPL to the results list
206
  binders_with_ppl_plddt.append([generated_binder, ppl_value, plddt_value, iPTM_value])
 
207
 
208
  return binders_with_ppl_plddt
209
 
@@ -255,10 +256,12 @@ def predict_peptide_from_file(base_model_path, finetuned_model_path, file_obj, p
255
  for i, row in input.iterrows():
256
  seq = row['Receptor Sequence']
257
  binders = generate_peptide_for_single_sequence(loaded_model, tokenizer, seq, peptide_length, top_k, num_binders)
258
- for binder, ppl in binders:
259
- results.append([seq, binder, ppl, plddt])
260
- print("Predicted sample: binder, ppl", i, binder, ppl )
261
- results_df = pd.DataFrame(results, columns=['Input Sequence', 'Binder', 'Pseudo Perplexity', 'pLDDT', 'iPTM'])
 
 
262
 
263
  timestamp = datetime.now().strftime('%Y-%m-%d_%H')
264
  outpath = (
 
204
 
205
  # Add the generated binder and its PPL to the results list
206
  binders_with_ppl_plddt.append([generated_binder, ppl_value, plddt_value, iPTM_value])
207
+ print("207:binders_with_ppl_plddt: ",binders_with_ppl_plddt)
208
 
209
  return binders_with_ppl_plddt
210
 
 
256
  for i, row in input.iterrows():
257
  seq = row['Receptor Sequence']
258
  binders = generate_peptide_for_single_sequence(loaded_model, tokenizer, seq, peptide_length, top_k, num_binders)
259
+ results_i = []
260
+ for binder, ppl, plddt, iptm in binders:
261
+ results.append([seq, binder, ppl, plddt, iptm])
262
+ #peptide_lp = results_i['Binder'][results_df['PPL'].idxmin()] #Choosing the one with the lowest perplexity
263
+
264
+ results_df = pd.DataFrame(results, columns=['Input Sequence', 'Binder', 'PPL', 'pLDDT', 'iPTM'])
265
 
266
  timestamp = datetime.now().strftime('%Y-%m-%d_%H')
267
  outpath = (