From 3526593a3bbecd2c90b9998f4c6564146e0ed346 Mon Sep 17 00:00:00 2001 From: RalfG Date: Thu, 12 Feb 2026 13:34:02 +0100 Subject: [PATCH 1/2] `io.pepxml`: Fix inferring score when first `spectrum_query` items do not have `search_hit` items. --- psm_utils/__init__.py | 2 +- psm_utils/io/pepxml.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/psm_utils/__init__.py b/psm_utils/__init__.py index e31341a..d790bca 100644 --- a/psm_utils/__init__.py +++ b/psm_utils/__init__.py @@ -1,6 +1,6 @@ """Common utilities for parsing and handling PSMs, and search engine results.""" -__version__ = "1.5.1" +__version__ = "1.5.2" __all__ = ["Peptidoform", "PSM", "PSMList"] from warnings import filterwarnings diff --git a/psm_utils/io/pepxml.py b/psm_utils/io/pepxml.py index 6a82542..af81400 100644 --- a/psm_utils/io/pepxml.py +++ b/psm_utils/io/pepxml.py @@ -73,6 +73,8 @@ def _infer_score_name(self) -> str | None: # Get scores from first PSM with pepxml.read(str(self.filename)) as reader: for spectrum_query in reader: + if "search_hit" not in spectrum_query: + continue score_keys = spectrum_query["search_hit"][0]["search_score"].keys() break else: From c51c9464b9f7eaaf35eb22abc6397444041b5065 Mon Sep 17 00:00:00 2001 From: RalfG Date: Thu, 12 Feb 2026 13:45:32 +0100 Subject: [PATCH 2/2] Fix formatting --- online/pages/1_PSM_file_statistics.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/online/pages/1_PSM_file_statistics.py b/online/pages/1_PSM_file_statistics.py index 9daf6f7..f42e765 100644 --- a/online/pages/1_PSM_file_statistics.py +++ b/online/pages/1_PSM_file_statistics.py @@ -91,16 +91,18 @@ def _input_form(self): self.state["reverse"] = row[0].radio( "Score type: order", options=[True, False], - format_func=lambda x: "Higher score is better" - if x - else "Lower score is better", + format_func=lambda x: ( + "Higher score is better" if x else "Lower score is better" + ), ) self.state["log_scale"] = row[1].radio( "Score type: scale", options=[False, True], - format_func=lambda x: "Logarithmic scale (e.g., e-value)" - if x - else "Linear scale (e.g., Andromeda score)", + format_func=lambda x: ( + "Logarithmic scale (e.g., e-value)" + if x + else "Linear scale (e.g., Andromeda score)" + ), help=( """ Some search engine scores, mostly e-value-like scores, require a