@@ -62,9 +62,10 @@ def sliding_window(elements, window_size, flexible=True):
62
62
Gives you sliding window functionality without using container
63
63
types (list, deque etc.) to speed it up. Only works for lists of
64
64
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:
68
69
PEP_of_PSM = (n_decoys_in_window * 2) / n_total_PSMs_in_window
69
70
'''
70
71
if flexible :
@@ -112,7 +113,7 @@ def sliding_window(elements, window_size, flexible=True):
112
113
break # cause StopIteration silently ends for-loops, will be fixed in py3.6 :)
113
114
114
115
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
116
117
117
118
118
119
class CombinedPEP (object ):
@@ -273,7 +274,7 @@ def generate_psm_to_scores_dict(self, input_engines):
273
274
kv_tuple [1 ]['Is decoy' ] for kv_tuple in psms_sorted_by_bayes_pep
274
275
]
275
276
276
- for i , (n_decoys , current_win_size ) in enumerate (
277
+ for i , (n_decoys , __ , current_win_size ) in enumerate (
277
278
sliding_window (sorted_decoy_bools , self .window_size )):
278
279
279
280
n_false_positives = 2 * n_decoys
0 commit comments