Skip to content

deprecate qpxc convert openms (-out_qpx parquet) in favour of openms-consensus - #237

Merged
ypriverol merged 11 commits into
devfrom
fix/openms-unidentified-and-dup-pk
Aug 6, 2026
Merged

ypriverol merged 11 commits into
devfrom
fix/openms-unidentified-and-dup-pk

Conversation

@ypriverol

@ypriverol ypriverol commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

qpxc convert openms reads the OpenMS ProteomicsLFQ -out_qpx parquet folder, which is broken upstream:

  • Run mis-assignment (major) — every PSM's run_file_name is stamped with the first run (the per-PSM map_index is dropped). On any multi-run / multi-fraction / multi-replicate design ~half the PSMs carry the wrong run. Filed OpenMS#9872.
  • Duplicate PSMs — a spectrum is emitted twice (one feature-attached PeptideIdentification + one UnassignedPeptideIdentification). Filed OpenMS#9871.

qpxc convert openms-consensus already reads the consensusXML directly and resolves the correct run per PSM (map_index / id_merge_index / feature-element runs, incl. multi-run isobaric), derives the peptidoform natively (to_proforma), and dedups on [peptidoform, charge, run_file_name, scan]. quantms (bigbio/quantms#725) has switched its QPX_CONVERT module to it and all pipeline CI passes across every profile.

So the fix is not to patch the parquet path — it's to deprecate it and steer everyone to the consensusXML path.

Changes

  • Deprecate qpxc convert openms: Click deprecated=True, a [DEPRECATED] docstring pointing to openms-consensus, and a runtime warning naming OpenMS#9871/#9872. The command still runs (it will be reconsidered once OpenMS ships an -out_qpx with the correct per-PSM run).
  • Keep the writer-level "duplicate primary key → warning, not error" so the deprecated path degrades gracefully instead of crashing; a null id remains a hard error.
  • Unidentified Feature → derive id from composite (not raise).
  • CHANGELOG Deprecated section added.

Note

An earlier iteration of this branch prototyped a consensusXML-based run-file repair of the parquet path (psm_refs.py + _repair_psm_run_files). On review, openms-consensus already does this natively and more correctly (isobaric run resolution, native peptidoform), so that prototype was reverted as redundant.

Related: OpenMS#9871, OpenMS#9872, bigbio/quantms#725, #229.

…d Features

OpenMS -out_qpx (and other producers) can emit data that trips the mandatory-id
close-validation and crashes qpxc convert:
- Duplicate primary key -> now a WARNING, not a raise (e.g. per-protein PSM rows
  collapsing on [peptidoform,charge,run,scan]). Null id stays a hard error.
- Unidentified Feature (null peptidoform) with no producer id -> derive feature_id
  from the composite (null peptidoform + measured charge/run/rt) instead of raising.
  A producer id, when present, is still namespaced by run and stashed as a cv_param.

Aligns with the agreed design (clashes reported as warnings during conversion).
Tests updated; full suite 870 passed.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 078fc7ac-b6fb-474f-98ef-6f6f1e970ce7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@codacy-production

codacy-production Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 12 complexity

Metric Results
Complexity 12

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@jpfeuffer

Copy link
Copy Markdown
Contributor

(likely per-protein PSM rows)

Did you investigate this further? sounds weird to have multiple annotations of the same peptidoform per scan.

@ypriverol

Copy link
Copy Markdown
Contributor Author

@jpfeuffer Im trying to find out why; but remember this is OpenMS ;)

…ble path too

The earlier fix only relaxed the whole-file close check; write_table validates with
strict=True, under which duplicate_pk is an error, so OpenMS -out_qpx multi-engine PSM
rows (same [peptidoform,charge,run,scan], different engine score/mz — the #229 merged-
engine case) still crashed qpxc convert openms. write_table now warns on duplicate_pk
while keeping null/type issues as hard errors. Adds a write_table dup-PK test; suite 871.
The openms converter re-validates staged core files (_validate_core, strict=True) and
raised on duplicate_pk — a THIRD gate (after write_table and the close check) that
still crashed qpxc convert openms on OpenMS -out_qpx multi-engine PSM rows. It now
warns on duplicate_pk while keeping null/type issues as hard failures, and no longer
blocks installation of the converted file. Test updated to assert the tolerant
behavior (duplicate identity warns + converts). Suite 871.
OpenMS -out_qpx emits one PSM row per search engine (Comet + MS-GF+):
same spectrum+peptidoform, differing only in the per-engine score
(OpenMS#9871). Dedup these on the identity composite — keep the
lowest-PEP row and fold the other engines' additional_scores into it,
so psm_id is unique and no engine's score is lost.
OpenMS -out_qpx stamps every PSM with the first run's file (map_index
dropped, OpenMS#9872) — ~half the PSMs get the wrong run on multi-run
designs. Read the authoritative per-PSM run from the companion
consensusXML (psm_refs.py) and restore run_file_name, matched on the
exact (plain_sequence, charge, scan) key; chemistry stays from the
parquet. Also collapse OpenMS's assigned+unassigned duplicate PSMs
(OpenMS#9871), preferring the feature-attached row.

Verified on real phospho output: 496 all-rep1 -> 254 rep1 / 238 rep2,
240 corrected, 4 merged, zero duplicate identities.
@daichengxin

Copy link
Copy Markdown
Collaborator

This is due to an issue with the OpenMS QPX export. The current consensusXML is fine. Check for updates to the quantms PR

@ypriverol ypriverol changed the title fix(writers): don't hard-fail on producer PK collisions / unidentified Features fix(openms): correct PSM run_file_name from consensusXML + collapse duplicate/unidentified PSMs Aug 6, 2026
Extract _collapse_duplicate_psms/_fold_additional_scores/_relabel_psm_runs
so the merge and run-repair paths share one collapse implementation
(cuts _repair_psm_run_files complexity 17->low, removes the
loop-closure warnings). Suppress the PsmRef too-many-attributes notice
(it's a reference-field record) and the unused iterparse event var.
Behavior unchanged (real phospho: 492 rows, 240 relabeled, 4 merged,
0 dup identities).
Reviewed Dai's openms_consensus converter: it reads the consensusXML
natively (pyopenms), resolves run_file_name per PSM via
map_index/id_merge_index/feature-element runs (handles multi-run
isobaric), derives peptidoform via to_proforma, and dedups on
[peptidoform,charge,run,scan]. It is strictly cleaner and more correct
than the -out_qpx parquet path, so the run_file_name repair I prototyped
(psm_refs.py + _repair_psm_run_files) is redundant — reverted.

The -out_qpx parquet path is fundamentally broken upstream: it
mis-assigns every PSM's run to the first run (OpenMS#9872) and duplicates
PSMs (OpenMS#9871). Mark 'qpxc convert openms' deprecated (Click
deprecated flag + docstring + a runtime warning) and steer to
'qpxc convert openms-consensus'. Keep the writer-level duplicate-PK
warning so the deprecated path degrades gracefully.
@ypriverol ypriverol changed the title fix(openms): correct PSM run_file_name from consensusXML + collapse duplicate/unidentified PSMs deprecate qpxc convert openms (-out_qpx parquet) in favour of openms-consensus Aug 6, 2026
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.

4 participants