Skip to content

Commit

Permalink
Updated auto num tests to look for empty bin > median
Browse files Browse the repository at this point in the history
  • Loading branch information
niemasd committed Jun 22, 2023
1 parent 9b8ce3d commit 0aaed11
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MESS.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from os.path import isfile
from scipy.stats import expon, gaussian_kde, linregress
from seaborn import histplot, kdeplot
from statistics import median
from sys import argv, stderr, stdout
from warnings import warn
import argparse
Expand All @@ -19,7 +20,7 @@
matplotlib.use("Agg")

# constants
VERSION = '1.0.7'
VERSION = '1.0.8'

# no correction
def qvalues_nocorrection(pvalues):
Expand Down Expand Up @@ -225,8 +226,9 @@ def write_mess_output(output_tsv_fn, mess, p_values, q_values, rate, loc, correc
# find number of significance tests to perform
def find_num_tests(mess_scores):
hist, bin_edges = histogram(mess_scores, bins='auto')
med = median(mess_scores)
for i in range(len(hist)):
if hist[i] == 0:
if hist[i] == 0 and bin_edges[i] > med:
min_mess_test = bin_edges[i]; break
return min_mess_test, len([v for v in mess_scores if v > min_mess_test])

Expand Down

0 comments on commit 0aaed11

Please sign in to comment.