From aff07eb4f3daa1bd53539e6d38dc72e0232643fa Mon Sep 17 00:00:00 2001 From: William Fondrie Date: Mon, 25 Jan 2021 13:11:20 -0800 Subject: [PATCH] Fixes problem with unsigned integers --- mokapot/qvalues.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mokapot/qvalues.py b/mokapot/qvalues.py index b0b00177..ad41a72c 100644 --- a/mokapot/qvalues.py +++ b/mokapot/qvalues.py @@ -61,6 +61,11 @@ def tdc(scores, target, desc=True): if scores.shape[0] != target.shape[0]: raise ValueError("'scores' and 'target' must be the same length") + # Unsigned integers can cause weird things to happen. + # Convert all scores to floats to for safety. + if np.issubdtype(scores.dtype, np.integer): + scores = scores.astype(np.float_) + # Sort and estimate FDR if desc: srt_idx = np.argsort(-scores)