Skip to content

fix(results): support pyOpenMS 3.5.0 IdXMLFile.load signature - #32

Merged
t0mdavid-m merged 1 commit into
mainfrom
fix/pyopenms-350-idxml
Sep 1, 2026
Merged

fix(results): support pyOpenMS 3.5.0 IdXMLFile.load signature#32
t0mdavid-m merged 1 commit into
mainfrom
fix/pyopenms-350-idxml

Conversation

@t0mdavid-m

Copy link
Copy Markdown
Member

Problem

Every workflow run on the cluster dies as soon as it tries to read a Comet result:

ERROR: can not handle type of ('/workspaces-streamlit-template/.../B000248_..._comet.idXML', [], [])
  File "/app/./src/WorkflowTest.py", line 758, in execution
    id_df, spectra_data = parse_idxml(idxml_path)
  File "/app/./src/common/results_helpers.py", line 104, in parse_idxml
    IdXMLFile().load(str(idxml_path), proteins, peptides)
Exception: can not handle type of (...)

Root cause

pyOpenMS 3.5.0 changed the signature of IdXMLFile.load()/store(). The third
parameter went from a libcpp_vector[PeptideIdentification], which accepted an ordinary
Python list, to a dedicated PeptideIdentificationList container:

# 3.4.0
def load(self, filename, protein_ids: List[ProteinIdentification], peptide_ids: List[PeptideIdentification]) -> None

# 3.5.0
def load(self, filename, protein_ids: List[ProteinIdentification], peptide_ids: PeptideIdentificationList) -> None

Passing [] matches no overload, so autowrap's dispatcher raises before any file I/O —
which is why the message names the file but never touches it. protein_ids is unchanged
and still takes a plain list.

Bisected across locally installed releases:

pyopenms IdXMLFile().load(path, [], [])
3.1.0, 3.2.0, 3.3.0, 3.4.0, 3.4.1 works
3.5.0 can not handle type of

requirements.txt pins pyopenms==3.5.0 and Dockerfile builds OpenMS release/3.5.0,
so deployed images always hit this, while dev environments still on 3.3.x never do.
That's the version mismatch — the deployment is ahead of the code, not behind it.

Other pyOpenMS loaders in the repo (MzMLFile, ConsensusXMLFile, ParamXMLFile) pass
properly wrapped objects rather than plain lists, and were verified unaffected on 3.5.0.

Fix

Add load_idxml() to results_helpers, which feature-detects the new container and
normalises the result back to a plain list so every caller is unchanged:

proteins = []
peptides = PeptideIdentificationList() if PeptideIdentificationList else []
IdXMLFile().load(str(idxml_file), proteins, peptides)
return proteins, list(peptides)

Feature detection rather than a version check keeps the app working on 3.4.x and earlier,
so local dev environments don't have to be upgraded in lockstep. The three call sites
(idxml_to_df, parse_idxml, and the inline copy in WorkflowTest) now route through it;
IdXMLFile is no longer referenced in WorkflowTest, so that import is dropped.

Note PeptideIdentificationList exposes push_back, not append — worth remembering for
any future code that builds one to hand to store().

Verification

  • End-to-end against a generated idXML on 3.1.0, 3.3.0, 3.4.0 (legacy list path) and
    3.5.0 (new container) — all four produce identical parsed output through
    load_idxml, idxml_to_df and parse_idxml.
  • Two regression tests added to tests/test_results_helpers.py. Reverting the fix makes
    them fail with the exact production error message,
    Exception: can not handle type of ('...', [], []).
  • Full suite in a CI-faithful venv (streamlit 1.49.1 + requirements.txt, i.e. pyopenms
    3.5.0): 102 passed.
  • Pylint, run as CI invokes it: no new findings — the change removes one pre-existing
    E0611 by dropping the now-unused import.

🤖 Generated with Claude Code

https://claude.ai/code/session_016Qn3mLqr7zBr7rgCokx6ku

Loading any idXML on the cluster failed with:

    Exception: can not handle type of ('..._comet.idXML', [], [])

pyOpenMS 3.5.0 changed the third parameter of IdXMLFile.load()/store()
from a libcpp_vector[PeptideIdentification], which accepted an ordinary
Python list, to a dedicated PeptideIdentificationList container. Passing
a list there matches no overload, so autowrap's dispatcher raises before
any file I/O happens. protein_ids is unaffected and still takes a list.

Bisected across locally installed releases: 3.1.0, 3.2.0, 3.3.0, 3.4.0
and 3.4.1 all accept a list; 3.5.0 does not. requirements.txt pins
pyopenms==3.5.0 and Dockerfile builds OpenMS release/3.5.0, so deployed
images hit this on every results page, while dev environments still on
3.3.x do not.

Add load_idxml() in results_helpers, which feature-detects
PeptideIdentificationList and normalises the result back to a plain list,
and route the three call sites through it. Feature detection rather than
a version check keeps the app working on 3.4.x and earlier too.
IdXMLFile is no longer referenced in WorkflowTest, so drop the import.

Verified end-to-end against a generated idXML on 3.1.0, 3.3.0, 3.4.0
(legacy list path) and 3.5.0 (new container), all yielding identical
parsed output. The added regression tests reproduce the exact production
error message when the fix is reverted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Qn3mLqr7zBr7rgCokx6ku
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a2bda614-3193-4cb1-bb71-0cbbdb5fa7ee


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@t0mdavid-m
t0mdavid-m merged commit 797fb3d into main Sep 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant