Andrew Stirn commited on
Commit
0590665
·
1 Parent(s): 3b9cb90

calibration working as expected

Browse files
Files changed (1) hide show
  1. tiger.py +7 -0
tiger.py CHANGED
@@ -123,6 +123,13 @@ def process_data(transcript_seq: str):
123
  return target_seq, guide_seq, model_inputs
124
 
125
 
 
 
 
 
 
 
 
126
  def prediction_transform(predictions: np.array, **params):
127
  if len(params) == 0:
128
  with open('transform_params.pkl', 'rb') as f:
 
123
  return target_seq, guide_seq, model_inputs
124
 
125
 
126
+ def calibrate_predictions(predictions: np.array, num_mismatches: np.array, params: pd.DataFrame = None):
127
+ if params is None:
128
+ params = pd.read_pickle('calibration_params.pkl')
129
+ correction = np.squeeze(params.set_index('num_mismatches').loc[num_mismatches].to_numpy())
130
+ return correction * predictions
131
+
132
+
133
  def prediction_transform(predictions: np.array, **params):
134
  if len(params) == 0:
135
  with open('transform_params.pkl', 'rb') as f: