Skip to content

Add idparquet support to PeptideIndexer, IDScoreSwitcher, PSMFeatureExtractor and IDFilter - #9396

Merged
timosachsenberg merged 7 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-rescore-tools
May 23, 2026
Merged

timosachsenberg merged 7 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-rescore-tools

Conversation

@jonasscheid

@jonasscheid jonasscheid commented May 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Extends the native .idparquet identification format (introduced in #9225 / #9232) to four
identification-processing TOPP tools that previously accepted only .idXML:

  • PeptideIndexer — -in / -out
  • IDScoreSwitcher — -in / -out
  • PSMFeatureExtractor — -in / -out / -out_type
  • IDFilter — -in / -out, plus the whitelist:peptides / blacklist:peptides filter inputs

This lets identification workflows — e.g. the nf-core/mhcquant search→rescore chain
(CometAdapter → PeptideIndexer → IDMerger → PSMFeatureExtractor → PercolatorAdapter → IDScoreSwitcher → IDFilter) — run end-to-end in .idparquet without IDFileConverter
bridge conversions.

Implementation

FileHandler::loadIdentifications / storeIdentifications already dispatch
FileTypes::IDPARQUET, so no new I/O logic is needed. Each tool received the uniform
change already used for the idparquet-capable tools (IDMerger, PercolatorAdapter, IDRipper):

  1. add idparquet to the setValidFormats_ / setValidStrings_ lists for identification I/O parameters;
  2. add FileTypes::IDPARQUET to the explicit allowed_types whitelist in every loadIdentifications / storeIdentifications call;
  3. extend the in_type / infiletype dispatch guards (PSMFeatureExtractor, IDFilter).

No directory-shaped-output handling is required for these tools — FileHandler::getType
and TOPPBase::inputFileReadable_ already accommodate the .idparquet directory bundle.

Validation

Built locally and validated against real immunopeptidomics data (PRIDE PXD011628, 2 runs).
The mhcquant search→rescore chain was run end-to-end in .idparquet with no
IDFileConverter bridges; each tool's idparquet output is content-equivalent to its idXML
output — identical peptide-identification counts, PSM counts, peptide-sequence sets and
protein-accession sets.

Scope

This PR covers the search→rescore identification tools. The quantification-stage tools
(MapAlignerIdentification, MapRTTransformer, FeatureFinderIdentification,
TextExporter) do not yet accept .idparquet and are left for a follow-up. No CTest cases
are added here — happy to add idparquet round-trip tests if preferred.

Summary by CodeRabbit

  • New Features

    • PeptideIndexer, IDScoreSwitcher, PSMFeatureExtractor, and IDFilter now accept and produce .idparquet identification bundles alongside existing formats; whitelist/blacklist peptide inputs and I/O parameters updated accordingly. PSMFeatureExtractor continues to support mzid as well.
  • Documentation

    • CHANGELOG and tool docs updated with .idparquet compatibility and guidance for mzIdentML conversion via the ID file converter.

Review Change Stack

@github-actions

Copy link
Copy Markdown
Contributor

@jonasscheid The following names might be missing from the AUTHORS file:

  • jonasscheid

Please consider applying the following patch:

--- AUTHORS	2026-05-22 16:26:07.293744613 +0000
+++ AUTHORS.new	2026-05-22 16:26:12.589556899 +0000
@@ -59,6 +59,7 @@
  - Johannes Veit
  - Johannes von Kleist
  - Johan Teleman
+ - jonasscheid
  - Joshua Charkow
  - Juliane Schmachtenberg
  - Julianus Pfeuffer

@coderabbitai

coderabbitai Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Four TOPP identification processing tools—PeptideIndexer, IDFilter, IDScoreSwitcher, and PSMFeatureExtractor—are updated to accept and produce idparquet identification bundles alongside idXML. Documentation, CLI parameter validation, FileHandler invocations, and the CHANGELOG are harmonized to reflect this extended format support.

Changes

idparquet Format Support in TOPP Tools

Layer / File(s) Summary
CHANGELOG documentation
CHANGELOG
Release notes document idparquet format support for four tools, listing specific input, output, and filter parameters affected.
FileHandler Doxygen update
src/openms/include/OpenMS/FORMAT/FileHandler.h
Doxygen for storeIdentifications.allowed_types clarified for empty/single/multi entries and UNKNOWN handling; Exception::InvalidFileType added to documented exceptions.
PeptideIndexer idparquet support
src/topp/PeptideIndexer.cpp
Tool description and mzIdentML documentation updated; CLI registers in/out to accept idXML,idparquet; FileHandler loading and storing handle {IDXML, IDPARQUET} and preserve parquet output when input was parquet.
IDFilter idparquet support
src/topp/IDFilter.cpp
mzIdentML note broadened; CLI in/out and whitelist:peptides/blacklist:peptides accept idparquet; main and filter file loading/storing expanded to {IDXML, IDPARQUET}.
IDScoreSwitcher idparquet support
src/topp/IDScoreSwitcher.cpp
Documentation note adjusted; CLI in/out accept idparquet; loading and storing use {IDXML, IDPARQUET} and preserve parquet output when input was parquet.
PSMFeatureExtractor idparquet support
src/topp/PSMFeatureExtractor.cpp
CLI -in, -out, and -out_type accept idparquet; input loading recognizes IDPARQUET and uses {IDXML, MZIDENTML, IDPARQUET}; storing uses resolved out_type (can be IDPARQUET).

Possibly related PRs

  • OpenMS/OpenMS#9236: Adds idparquet input handling to TOPP tools; overlaps in FileHandler::loadIdentifications usage.
  • OpenMS/OpenMS#9232: Core IDPARQUET support in FileHandler/FileTypes that enables TOPP tool changes.
  • OpenMS/OpenMS#9237: Similar adjustments to preserve idparquet vs idXML when routing load/store in TOPP identification tools.

Suggested reviewers

  • jpfeuffer
  • timosachsenberg

🐰 Four tools now speak parquet's tongue,
Where idXML and idparquet dwell as one,
Each loader, each store, each CLI gate,
Expands its formats to celebrate—
The polyglot bundler is finally free! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding idparquet support to four TOPP identification tools. It is concise, specific, and directly reflects the changeset's primary objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/topp/PeptideIndexer.cpp (1)

89-90: 🏗️ Heavy lift

Add integration coverage for the new idparquet I/O path.

This change extends core read/write behavior but the PR notes no new CTests. Please add TOPP integration tests that exercise idparquet input/output for this tool (round-trip/behavior parity with idXML).

As per coding guidelines "TOPP tools must add integration tests in src/tests/topp/CMakeLists.txt and tool documentation must be added to doc/doxygen/public/TOPP.doxygen".

Also applies to: 118-118, 179-179

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/topp/PeptideIndexer.cpp` around lines 89 - 90, The tool PeptideIndexer
was extended to accept "idparquet" via registerInputFile_ and setValidFormats_,
so add TOPP integration tests that exercise idparquet I/O parity with idXML:
update src/tests/topp/CMakeLists.txt to add new tests invoking the
PeptideIndexer executable with idparquet input and producing idparquet output
(and a round-trip test converting idXML->idparquet->idXML to verify behavior
parity), include appropriate expected output comparisons, and add documentation
entries for PeptideIndexer in doc/doxygen/public/TOPP.doxygen describing the new
idparquet support and the test coverage; ensure tests reference the
PeptideIndexer binary name and use the same command-line options used in
existing idXML tests so they validate equivalent behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/topp/PeptideIndexer.cpp`:
- Around line 89-90: The tool PeptideIndexer was extended to accept "idparquet"
via registerInputFile_ and setValidFormats_, so add TOPP integration tests that
exercise idparquet I/O parity with idXML: update src/tests/topp/CMakeLists.txt
to add new tests invoking the PeptideIndexer executable with idparquet input and
producing idparquet output (and a round-trip test converting
idXML->idparquet->idXML to verify behavior parity), include appropriate expected
output comparisons, and add documentation entries for PeptideIndexer in
doc/doxygen/public/TOPP.doxygen describing the new idparquet support and the
test coverage; ensure tests reference the PeptideIndexer binary name and use the
same command-line options used in existing idXML tests so they validate
equivalent behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9ccbba37-fc6a-48c7-b7ee-2f7849380bee

📥 Commits

Reviewing files that changed from the base of the PR and between bf1dc4a and 41ba18f.

📒 Files selected for processing (5)
  • CHANGELOG
  • src/topp/IDFilter.cpp
  • src/topp/IDScoreSwitcher.cpp
  • src/topp/PSMFeatureExtractor.cpp
  • src/topp/PeptideIndexer.cpp

…ndexer/PSMFeatureExtractor

Widening storeIdentifications' allowed_types from {IDXML} to {IDXML, IDPARQUET}
broke TOPPAS pipelines: intermediate files are named ".unknown" when a tool has
multiple valid output formats and no out_type is set, and FileHandler only falls
back from an UNKNOWN filename to a single allowed type. With two allowed types
it threw InvalidFileType.

Pass a single concrete type to storeIdentifications, derived from the input
file type (or the pre-computed out_type in PSMFeatureExtractor). Document the
size-1 fallback contract on FileHandler::storeIdentifications so future tools
adding format support don't hit the same regression.

Fixes TOPP_ExecutePipeline_Ecoli_Identification.toppas and
TOPP_ExecutePipeline_FDR_NeighborSearch.toppas in PR OpenMS#9396.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/topp/PSMFeatureExtractor.cpp`:
- Line 291: The change adds idparquet support via
FileHandler().storeIdentifications but lacks integration coverage; add a TOPP
integration test that runs the PSMFeatureExtractor idparquet read/write flow
(write identifications using the new idparquet path and read them back) and
register that test in the TOPP tests CMakeLists so it runs in CI, and also add
the corresponding tool documentation entry to the TOPP.doxygen file; ensure the
test invokes the same code paths that call FileHandler().storeIdentifications
and validates round-trip correctness of all_protein_ids/all_peptide_ids.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7710f4c5-dc1c-43e5-9282-03cb313f8dc4

📥 Commits

Reviewing files that changed from the base of the PR and between 41ba18f and 30d2f9b.

📒 Files selected for processing (5)
  • src/openms/include/OpenMS/FORMAT/FileHandler.h
  • src/topp/IDFilter.cpp
  • src/topp/IDScoreSwitcher.cpp
  • src/topp/PSMFeatureExtractor.cpp
  • src/topp/PeptideIndexer.cpp
✅ Files skipped from review due to trivial changes (1)
  • src/openms/include/OpenMS/FORMAT/FileHandler.h

Comment thread src/topp/PSMFeatureExtractor.cpp Resolved
@timosachsenberg
timosachsenberg merged commit ae74574 into OpenMS:develop May 23, 2026
38 checks passed
@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@jonasscheid
jonasscheid deleted the feature/idparquet-rescore-tools branch May 23, 2026 11:03
@jpfeuffer

Copy link
Copy Markdown
Contributor

Nice! Let us know which benfits you observe. For some things like IDFilter, one could even think about streaming solutions now.

@jonasscheid

Copy link
Copy Markdown
Collaborator Author

Will do @jpfeuffer Implementing support for parquet based formats for the quant tools used in mhcquant and then I'll report back to you!

@jonasscheid

Copy link
Copy Markdown
Collaborator Author

@jpfeuffer @timosachsenberg seeing ~ 15x reduced storage occupation, which is great. Speed did not increase on small test dataset, could that be improved with streaming?

@timosachsenberg

Copy link
Copy Markdown
Contributor

Writing was typically quite fast for idXML already. I would have hoped that reading is also faster. I can take a look at some point where we loose time.

jonasscheid added a commit to jonasscheid/OpenMS that referenced this pull request May 26, 2026
Extend the CONSENSUSXML branch (both load and store sides) with CONSENSUSPARQUET.
The store uses the single-concrete pattern from OpenMS#9396 ({infiletype}), already in
use on the idXML/idparquet branch.
timosachsenberg added a commit that referenced this pull request May 30, 2026
* Add parquet read/write to MapRTTransformer

Extend the featureXML/consensusXML/idXML dispatch branches to also accept
their parquet siblings. Load whitelists are multi-element; store calls pass
a single concrete type derived from the input file type, preserving the
size-1 .unknown fallback contract (FileHandler.h:288-294, established by
30d2f9b).

* Add parquet read/write to FeatureFinderIdentification

TOPP tool widens -id/-id_ext to idparquet and -out/-candidates_in/-candidates_out
to featureparquet. Load whitelists are multi-element; the -out store derives a
single concrete type from -id (main path) or -candidates_in (re-score path).

Library change: FeatureFinderIdentificationAlgorithm::storeFeatures(candidates_out_)
now passes a single concrete type derived from the candidates_out filename, with
FEATUREXML fallback for TOPPAS .unknown intermediates (FileHandler.h:286-294
contract from 30d2f9b).

* Add parquet read/write to FeatureLinker* tools (5 binaries)

Touches FeatureLinkerBase.cpp, FeatureLinkerLabeled.cpp, FeatureLinkerUnlabeled.cpp.
- FeatureLinkerBase covers FLULKD, FLULQT, FLWNet via common_main_ (3 binaries).
- FeatureLinkerLabeled overrides registerOptionsAndFlags_; widened locally (1 binary).
- FeatureLinkerUnlabeled has its own complete main_; recipe applied with FEATUREPARQUET
  reference-selection fallback to index 0 (FeatureXMLFile::loadSize is XML-only).

Load whitelists multi-element; stores use single-concrete output derived via
consensusOutTypeFor() helper. The helper is available in FeatureLinkerUnlabeled.cpp
via the textual #include "FeatureLinkerBase.cpp" (static linkage, no duplication needed).

* Add parquet read/write to FileConverter (+ 5 TOPP-tests)

Format lists, in_type/out_type dispatch branches, and rejection guards updated
for featureparquet and consensusparquet. Stores at the featureXML and consensusXML
out_type branches now use {out_type} (single-concrete from out_type) and serve
both XML and parquet sinks from one branch.

Five new TOPP-tests (TOPP_FileConverter_32-36) exercise the full conversion-cell
matrix:
 - 32 featureparquet -> featureXML  (round-trip identity)
 - 33 consensusparquet -> consensusXML  (round-trip identity)
 - 34 featureparquet -> consensusparquet  (mhcquant parquet-lane promote, content verified via XML round-trip)
 - 35 featureXML -> consensusparquet  (cross-serialization, content verified via XML round-trip)
 - 36 featureparquet -> consensusXML  (cross-serialization)

Bundles .featureparquet and .consensusparquet are directories of parquet
files (one per logical table: features/consensus_features + 4 id tables).

Two committed parquet test-input fixtures (FileConverter_9_output.featureparquet,
FileConverter_14_output.consensusparquet) generated via FileConverter from
their XML siblings. Five dedicated XML output fixtures (FileConverter_32-36_output.*)
freeze the expected round-trip content (extra dataProcessing entries from each
FileConverter pass and the parquet schema's spectra_data empty-stringList
UserParam are part of the recorded baseline).

* Add parquet read/write to IDConflictResolver

Extend featureXML/consensusXML dispatch branches with FEATUREPARQUET/CONSENSUSPARQUET.
Load whitelists multi-element; store calls pass single concrete type derived from
in_type. The implicit else-branch is made explicit (else if CONSENSUSXML || CONSENSUSPARQUET)
for readability.

* Add parquet read to MzTabExporter

Extend featureXML/consensusXML/idXML dispatch branches with parquet siblings.
Output is always mzTab, so no store-side changes are needed.

* Add parquet read to TextExporter

Extend featureXML/consensusXML/idXML dispatch branches with parquet siblings.
Output is always tsv/csv/txt, so no store-side changes are needed.

* Add consensusparquet read/write to IDFilter

Extend the CONSENSUSXML branch (both load and store sides) with CONSENSUSPARQUET.
The store uses the single-concrete pattern from #9396 ({infiletype}), already in
use on the idXML/idparquet branch.

* Document size-1 .unknown fallback contract on storeFeatures/storeConsensusFeatures

Verbatim mirror of the wording added to storeIdentifications in 30d2f9b.
Same code-level behavior; documenting it here so future format additions
to TOPP tools dispatching FeatureMap/ConsensusMap use the single-concrete
type pattern and don't break TOPPAS .unknown intermediates.

* Refactor MapAlignerIdentification to FileHandler + parquet support

Refactor loadInitialMaps_ and storeTransformedMaps_ helpers from direct
FeatureXMLFile/ConsensusXMLFile dispatches to FileHandler with if-constexpr
template specialization, preserving the 'avoid code duplication' intent.

Add featureparquet/consensusparquet/idparquet support to the in/out/reference:file
parameters and to all three dispatch branches (FEATUREXML, CONSENSUSXML, IDXML).
The reference-file switch and main_ switch use case-fall-through to share each
parquet+XML pair. storeTransformedMaps_ derives a single concrete output type
from in_type (output format follows input format).

Audit of MapAlignerBase.h:206 reference-format-must-match check: only fires for
REF_RESTRICTED tools (PoseClustering, TreeGuided), which are not getting parquet
support in this PR. MAI uses REF_FLEXIBLE and bypasses the check. No
MapAlignerBase.h change needed.

Drop unused #include <FeatureXMLFile.h> and <ConsensusXMLFile.h>.

* CHANGELOG: parquet support for QUANT-chain TOPP tools

Per-tool entries for the 8 newly-touched binaries (MapRTTransformer,
MapAlignerIdentification, FeatureFinderIdentification, FileConverter,
IDConflictResolver, MzTabExporter, TextExporter, IDFilter) plus a
consolidated FeatureLinker* entry covering all 5 inheritance binaries.

Library entry mirrors the size-1 .unknown fallback contract documentation
onto storeFeatures/storeConsensusFeatures, parallel to the storeIdentifications
wording from 30d2f9b.

All entries reference #TBD pending the upstream PR.

* test(INIUpdater): update TOPPAS refs for FeatureLinker parquet formats

FeatureLinkerBase now advertises featureparquet/consensusparquet in its
in/out supported_formats. INIUpdater regenerates each node's parameter
description from the live tool, so the FeatureLinkerUnlabeled node in the
_1_noupdate and _3_old_out reference toppas files diverged. Sync the two
references to the new format lists.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Address CodeRabbit review: parquet gates + user-facing text

Valid findings fixed:
- FileConverter: CSV/IBSpectra and OMS output gates rejected already-loaded
  parquet maps despite featureparquet/consensusparquet being advertised inputs.
  Widen the in_type guards so consensusparquet->ibspectra and
  feature/consensusparquet->oms reach the same code path as their XML
  counterparts (verified: featureparquet->oms is byte-identical to
  featureXML->oms; consensusparquet->ibspectra now matches consensusXML
  behavior).
- MzTabExporter/TextExporter: tool descriptions still said "XML formats";
  updated to mention parquet.
- FeatureLinkerBase: keep_subelements flag help and the fractionated-design
  error said "consensusXML" only; now mention consensusparquet (also fixed an
  "als"->"as" typo). Regenerated the two INIUpdater .toppas references that
  embed the keep_subelements description.

Skipped (with reason):
- "Add unknown to setValidFormats_" (out params, 3x): TOPPBase already accepts
  UNKNOWN/.unknown extensions for in/out (TOPPBase.cpp ~1428/1495/1514) and
  setValidFormats_(force_OpenMS_format=true) would throw "format 'unknown' is
  invalid" at registration. Would break tool startup; not applied.
- FeatureLinkerUnlabeled parquet reference selection: no lightweight parquet
  feature-count API exists (FeatureMapArrowIO only does full import/export);
  index-0 is a correct documented fallback. Enhancement, not a bug.
- MapAlignerIdentification single in_type for mixed input lists: only affects
  mixed-format input lists with .unknown outputs; uniform lists (the norm) work.
  Belongs with the broader output-track-coupling discussion.
- Brace nitpick: braceless single-statement if is valid and idiomatic here.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Timo Sachsenberg <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.

3 participants