From 3972e3683aea61b78c4a7e45df2edd4bafda56e9 Mon Sep 17 00:00:00 2001 From: Micha Birklbauer Date: Wed, 24 Jan 2024 15:02:10 +0100 Subject: [PATCH] fix undeclared var --- msannika_fdr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/msannika_fdr.py b/msannika_fdr.py index 193b2c8..ed4f302 100644 --- a/msannika_fdr.py +++ b/msannika_fdr.py @@ -148,7 +148,8 @@ def get_cutoff(data: pd.DataFrame, fdr: float) -> float: labels = data["Class_label"].to_numpy() labels_sorted = labels[data["Combined Score"].to_numpy().argsort()] - for i, score in enumerate(sorted(data["Combined Score"].tolist())): + scores = sorted(data["Combined Score"].tolist()) + for i, score in enumerate(scores): if labels_sorted[i:].sum() / (labels_sorted[i:].shape[0] - labels_sorted[i:].sum()) < fdr: return score @@ -181,7 +182,8 @@ def get_cutoff(data: pd.DataFrame, fdr: float) -> float: labels = data["Class_label"].to_numpy() labels_sorted = labels[data["Best CSM Score"].to_numpy().argsort()] - for i, score in enumerate(sorted(data["Best CSM Score"].tolist())): + scores = sorted(data["Best CSM Score"].tolist()) + for i, score in enumerate(scores): if labels_sorted[i:].sum() / (labels_sorted[i:].shape[0] - labels_sorted[i:].sum()) < fdr: return score