Skip to content

Commit

Permalink
Fixes problem with unsigned integers
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Jan 25, 2021
1 parent 28d3f35 commit aff07eb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mokapot/qvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit aff07eb

Please sign in to comment.