Skip to content

Commit faeadc5

Browse files
authored
Merge pull request #143 from CompOmics/fix/pepxml-searchhit-error
`io.pepxml`: Fix inferring score when first `spectrum_query` item does not have `search_hit` items.
2 parents c5960ee + c51c946 commit faeadc5

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

online/pages/1_PSM_file_statistics.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,18 @@ def _input_form(self):
9191
self.state["reverse"] = row[0].radio(
9292
"Score type: order",
9393
options=[True, False],
94-
format_func=lambda x: "Higher score is better"
95-
if x
96-
else "Lower score is better",
94+
format_func=lambda x: (
95+
"Higher score is better" if x else "Lower score is better"
96+
),
9797
)
9898
self.state["log_scale"] = row[1].radio(
9999
"Score type: scale",
100100
options=[False, True],
101-
format_func=lambda x: "Logarithmic scale (e.g., e-value)"
102-
if x
103-
else "Linear scale (e.g., Andromeda score)",
101+
format_func=lambda x: (
102+
"Logarithmic scale (e.g., e-value)"
103+
if x
104+
else "Linear scale (e.g., Andromeda score)"
105+
),
104106
help=(
105107
"""
106108
Some search engine scores, mostly e-value-like scores, require a

psm_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Common utilities for parsing and handling PSMs, and search engine results."""
22

3-
__version__ = "1.5.1"
3+
__version__ = "1.5.2"
44
__all__ = ["Peptidoform", "PSM", "PSMList"]
55

66
from warnings import filterwarnings

psm_utils/io/pepxml.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def _infer_score_name(self) -> str | None:
7373
# Get scores from first PSM
7474
with pepxml.read(str(self.filename)) as reader:
7575
for spectrum_query in reader:
76+
if "search_hit" not in spectrum_query:
77+
continue
7678
score_keys = spectrum_query["search_hit"][0]["search_score"].keys()
7779
break
7880
else:

0 commit comments

Comments
 (0)