Skip to content

Commit 31fa225

Browse files
committed
io.flashlfq: Fix FDR filtering if some PSMs have qvalue None
1 parent 4e9b83c commit 31fa225

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

psm_utils/io/flashlfq.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,13 @@ def write_file(self, psm_list: PSMList):
194194
target_mask = np.ones(len(psm_list), dtype=bool)
195195

196196
# Filter out PSMs above FDR threshold
197-
fdr_mask = psm_list["qvalue"] <= self.fdr_threshold
197+
if any(psm.qvalue is None for psm in psm_list):
198+
LOGGER.warning(
199+
"Not all PSMs have a q-value. Skipping FDR filtering for FlashLFQ file."
200+
)
201+
fdr_mask = np.ones(len(psm_list), dtype=bool)
202+
else:
203+
fdr_mask = psm_list["qvalue"] <= self.fdr_threshold
198204
filtered_by_fdr = (~fdr_mask & target_mask).sum()
199205
LOGGER.debug(f"Skipping {filtered_by_fdr} PSMs above FDR threshold for FlashLFQ file.")
200206

0 commit comments

Comments
 (0)