wangjin2000 commited on
Commit
7362684
·
verified ·
1 Parent(s): 6948058

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -146,7 +146,7 @@ def compute_pseudo_perplexity(model, tokenizer, protein_seq, binder_seq):
146
 
147
  end = time.time()
148
  elapsed = end - start
149
- print(f'compute_pseudo_perplexity time: {elapsed:.4f} seconds')
150
 
151
  return pseudo_perplexity
152
 
@@ -173,9 +173,9 @@ def compute_plddt_iptm(protein_seq, binder_seq):
173
 
174
  end = time.time()
175
  elapsed = end - start
176
- print(f'compute_plddt_iptm time: {elapsed:.4f} seconds')
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()
@@ -219,7 +219,7 @@ def generate_peptide_for_single_sequence(model, tokenizer, protein_seq, peptide_
219
 
220
  end = time.time()
221
  elapsed = end - start
222
- print(f'generate_peptide_for_single_sequence: {elapsed:.4f} seconds')
223
 
224
  return binders_with_ppl_plddt
225
 
@@ -269,8 +269,10 @@ def predict_peptide_from_file(base_model_path, finetuned_model_path, file_obj, m
269
  results = []
270
 
271
  for i, row in input.iterrows():
272
- protein_seq = row['Receptor Sequence']
273
- peptide_seq = row['Peptide Sequence']
 
 
274
  peptide_length = min([len(peptide_seq), max_peptide_length]) # use the same length of ground truth peptide length for prediction limited to max_peptide_length
275
 
276
  #get metrics for ground truth peptide
 
146
 
147
  end = time.time()
148
  elapsed = end - start
149
+ #print(f'compute_pseudo_perplexity time: {elapsed:.4f} seconds')
150
 
151
  return pseudo_perplexity
152
 
 
173
 
174
  end = time.time()
175
  elapsed = end - start
176
+ #print(f'compute_plddt_iptm time: {elapsed:.4f} seconds')
177
 
178
+ return avg_plddt, ptm
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()
 
219
 
220
  end = time.time()
221
  elapsed = end - start
222
+ #print(f'generate_peptide_for_single_sequence: {elapsed:.4f} seconds')
223
 
224
  return binders_with_ppl_plddt
225
 
 
269
  results = []
270
 
271
  for i, row in input.iterrows():
272
+ #protein_seq = row['Receptor Sequence']
273
+ #peptide_seq = row['Peptide Sequence']
274
+ protein_seq = row['P_Sequence']
275
+ peptide_seq = row['p_Sequence']
276
  peptide_length = min([len(peptide_seq), max_peptide_length]) # use the same length of ground truth peptide length for prediction limited to max_peptide_length
277
 
278
  #get metrics for ground truth peptide