Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Andrew Stirn
commited on
Commit
·
ab4b6b4
1
Parent(s):
63d3254
bug fix for zero off-targets
Browse files
tiger.py
CHANGED
|
@@ -340,11 +340,13 @@ def tiger_exhibit(transcripts: pd.DataFrame, mode: str, check_off_targets: bool,
|
|
| 340 |
if check_off_targets and off_target_candidates is not None:
|
| 341 |
off_target_candidates = find_off_targets(off_target_candidates, status_update_fn)
|
| 342 |
off_target_predictions = predict_off_target(off_target_candidates, model=tiger)
|
| 343 |
-
off_target_predictions
|
|
|
|
|
|
|
| 344 |
|
| 345 |
# finalize tables
|
| 346 |
for df in [on_target_predictions, titration_predictions, off_target_predictions]:
|
| 347 |
-
if df is not None:
|
| 348 |
df[GUIDE_COL] = df[GUIDE_COL].apply(lambda s: s[::-1]) # reverse guide sequences
|
| 349 |
df[TARGET_COL] = df[TARGET_COL].apply(lambda seq: seq[CONTEXT_5P:len(seq) - CONTEXT_3P]) # remove context
|
| 350 |
|
|
|
|
| 340 |
if check_off_targets and off_target_candidates is not None:
|
| 341 |
off_target_candidates = find_off_targets(off_target_candidates, status_update_fn)
|
| 342 |
off_target_predictions = predict_off_target(off_target_candidates, model=tiger)
|
| 343 |
+
if len(off_target_predictions) > 0:
|
| 344 |
+
off_target_predictions = off_target_predictions.sort_values(SCORE_COL, ascending=False)
|
| 345 |
+
off_target_predictions = off_target_predictions.reset_index(drop=True)
|
| 346 |
|
| 347 |
# finalize tables
|
| 348 |
for df in [on_target_predictions, titration_predictions, off_target_predictions]:
|
| 349 |
+
if df is not None and len(df) > 0:
|
| 350 |
df[GUIDE_COL] = df[GUIDE_COL].apply(lambda s: s[::-1]) # reverse guide sequences
|
| 351 |
df[TARGET_COL] = df[TARGET_COL].apply(lambda seq: seq[CONTEXT_5P:len(seq) - CONTEXT_3P]) # remove context
|
| 352 |
|