Skip to content

Commit c38065f

Browse files
committed
fixed sliding window test
1 parent d397d82 commit c38065f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ursgal/resources/platform_independent/arc_independent/combine_pep_1_0_0/combine_pep_1_0_0.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ def sliding_window(elements, window_size, flexible=True):
6262
Gives you sliding window functionality without using container
6363
types (list, deque etc.) to speed it up. Only works for lists of
6464
numbers. Yields the sum of all numbers in the sliding window
65-
(= the number of decoys in the sliding window in our case), and
66-
the current length of the sliding window (= total number of PSMs
67-
in the sliding window). Used for PEP calculation:
65+
(= the number of decoys in the sliding window in our case), the
66+
central number of the sliding window (required for the test only),
67+
and the current length of the sliding window (= total number of
68+
PSMs in the sliding window). Used for PEP calculation:
6869
PEP_of_PSM = (n_decoys_in_window * 2) / n_total_PSMs_in_window
6970
'''
7071
if flexible:
@@ -112,7 +113,7 @@ def sliding_window(elements, window_size, flexible=True):
112113
break # cause StopIteration silently ends for-loops, will be fixed in py3.6 :)
113114

114115
previous_start_i, previous_stop_i = start_i, stop_i
115-
yield n_decoys, current_win_size
116+
yield n_decoys, center_value, current_win_size
116117

117118

118119
class CombinedPEP(object):
@@ -273,7 +274,7 @@ def generate_psm_to_scores_dict(self, input_engines):
273274
kv_tuple[1]['Is decoy'] for kv_tuple in psms_sorted_by_bayes_pep
274275
]
275276

276-
for i, (n_decoys, current_win_size) in enumerate(
277+
for i, (n_decoys, __, current_win_size) in enumerate(
277278
sliding_window(sorted_decoy_bools, self.window_size)):
278279

279280
n_false_positives = 2 * n_decoys

0 commit comments

Comments
 (0)