Skip to content

Commit 6df9659

Browse files
committed
some changes
1 parent 1baf442 commit 6df9659

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

onsite/lucxor/flr.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,13 @@ def perform_minorization(self) -> None:
523523
while cur_end < n and not is_minor_point[cur_end]:
524524
cur_end += 1
525525

526-
# Map results back to FDR array
527-
for i in range(n):
528-
for j in range(n):
529-
if self.pos[i] == x[j]:
530-
fdr_array[i] = f[j]
531-
break
526+
# Map results back to FDR array using original indices
527+
# Since pairs were built from minor_map which uses sequential indices,
528+
# we can create a reverse mapping from sorted x back to original indices
529+
original_indices = np.argsort(np.argsort(self.pos[:n])) # Maps sorted position to original
530+
for j in range(n):
531+
orig_idx = original_indices[j]
532+
fdr_array[orig_idx] = f[j]
532533

533534
if iter_type == "global":
534535
self.global_fdr = fdr_array
@@ -742,10 +743,13 @@ def _create_sorted_flr_mapping(self) -> None:
742743
self.sorted_global_flr = np.array([d['global_flr'] for d in flr_data])
743744
self.sorted_local_flr = np.array([d['local_flr'] for d in flr_data])
744745

745-
logger.info(
746-
f"Created sorted FLR mapping with {len(self.sorted_delta_scores)} entries, "
747-
f"delta_score range: [{self.sorted_delta_scores[0]:.4f}, {self.sorted_delta_scores[-1]:.4f}]"
748-
)
746+
if len(self.sorted_delta_scores) > 0:
747+
logger.info(
748+
f"Created sorted FLR mapping with {len(self.sorted_delta_scores)} entries, "
749+
f"delta_score range: [{self.sorted_delta_scores[0]:.4f}, {self.sorted_delta_scores[-1]:.4f}]"
750+
)
751+
else:
752+
logger.warning("Created empty sorted FLR mapping - no valid FLR data available")
749753

750754
def calculate_flr_estimates(self, psms: List) -> None:
751755
"""

0 commit comments

Comments
 (0)