Andrew Stirn commited on
Commit
12459b9
·
1 Parent(s): f373c96

single prediction bug fix

Browse files
Files changed (1) hide show
  1. tiger.py +2 -2
tiger.py CHANGED
@@ -178,7 +178,7 @@ def get_on_target_predictions(transcripts: pd.DataFrame, model: tf.keras.Model,
178
  target_seq, guide_seq, model_inputs = process_data(row[SEQ_COL])
179
 
180
  # get predictions
181
- lfc_estimate = np.squeeze(model.predict(model_inputs, batch_size=BATCH_SIZE_COMPUTE, verbose=False))
182
  lfc_estimate = calibrate_predictions(lfc_estimate, num_mismatches=np.zeros_like(lfc_estimate))
183
  scores = transform_predictions(lfc_estimate)
184
  predictions = pd.concat([predictions, pd.DataFrame({
@@ -308,7 +308,7 @@ def predict_off_target(off_targets: pd.DataFrame, model: tf.keras.Model):
308
  tf.reshape(one_hot_encode_sequence(off_targets[TARGET_COL], add_context_padding=False), [len(off_targets), -1]),
309
  tf.reshape(one_hot_encode_sequence(off_targets[GUIDE_COL], add_context_padding=True), [len(off_targets), -1]),
310
  ], axis=-1)
311
- lfc_estimate = np.squeeze(model.predict(model_inputs, batch_size=BATCH_SIZE_COMPUTE, verbose=False))
312
  lfc_estimate = calibrate_predictions(lfc_estimate, off_targets['Number of Mismatches'].to_numpy())
313
  off_targets[SCORE_COL] = transform_predictions(lfc_estimate)
314
 
 
178
  target_seq, guide_seq, model_inputs = process_data(row[SEQ_COL])
179
 
180
  # get predictions
181
+ lfc_estimate = model.predict(model_inputs, batch_size=BATCH_SIZE_COMPUTE, verbose=False)[:, 0]
182
  lfc_estimate = calibrate_predictions(lfc_estimate, num_mismatches=np.zeros_like(lfc_estimate))
183
  scores = transform_predictions(lfc_estimate)
184
  predictions = pd.concat([predictions, pd.DataFrame({
 
308
  tf.reshape(one_hot_encode_sequence(off_targets[TARGET_COL], add_context_padding=False), [len(off_targets), -1]),
309
  tf.reshape(one_hot_encode_sequence(off_targets[GUIDE_COL], add_context_padding=True), [len(off_targets), -1]),
310
  ], axis=-1)
311
+ lfc_estimate = model.predict(model_inputs, batch_size=BATCH_SIZE_COMPUTE, verbose=False)[:, 0]
312
  lfc_estimate = calibrate_predictions(lfc_estimate, off_targets['Number of Mismatches'].to_numpy())
313
  off_targets[SCORE_COL] = transform_predictions(lfc_estimate)
314