Skip to content

Note: Breaking API change in pyOpenMS 3.5: IdXMLFile.load() and store() now require PeptideIdentificationList #8552

@RalfG

Description

@RalfG

Operating System and Hardware

Any

OpenMS Version

pyOpenMS 3.5

Installation Method

Python: pip

Bug Description

As a note to other users; feel free to close immediately.

In pyOpenMS 3.5, the signature for IdXMLFile.load() and IdXMLFile.store() changed in a breaking way. The peptide_ids parameter now requires a PeptideIdentificationList object instead of a regular Python list.

Before (pyOpenMS <3.5):

protein_ids = []
peptide_ids = []
oms.IdXMLFile().load(filename, protein_ids, peptide_ids)

After (pyOpenMS 3.5+):

protein_ids = []
peptide_ids = oms.PeptideIdentificationList()  # Changed!
oms.IdXMLFile().load(filename, protein_ids, peptide_ids)

Additionally, PeptideIdentificationList uses .push_back() instead of .append():

peptide_ids.push_back(peptide_id)  # Instead of .append()

Backward compatible solution:

if hasattr(oms, "PeptideIdentificationList"):
    peptide_ids = oms.PeptideIdentificationList()
    # Use .push_back() to add items
else:
    peptide_ids = []
    # Use .append() to add items

This change affects any code that reads or writes idXML files.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions