Skip to content

Add idparquet I/O to some quant TOPP tools - #9405

Merged
timosachsenberg merged 13 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-quant-tools
May 30, 2026
Merged

timosachsenberg merged 13 commits into
OpenMS:developfrom
jonasscheid:feature/idparquet-quant-tools

Conversation

@jonasscheid

@jonasscheid jonasscheid commented May 25, 2026 •

Copy link
Copy Markdown
Collaborator

This PR extends the idparquet I/O introduced in #9396 (rescore-chain tools) to the QUANT-chain TOPP tools. 11 user-facing binaries gain featureparquet / consensusparquet / idparquet read+write.

Tools touched (via 9 source files): MapAlignerIdentification (refactored to FileHandler + parquet), MapRTTransformer, FeatureFinderIdentification, FeatureLinker* (FLUKD + 4 siblings via shared base), IDConflictResolver, FileConverter (+ 5 new TOPP-tests for cross-format coverage), IDFilter (consensusparquet), MzTabExporter, TextExporter (read-only — outputs stay in their native mzTab/tsv formats).

Implementation pattern: uniform across tools — setValidFormats_ entries widened to include the parquet variants; load/store dispatch routes through the existing FeatureMapArrowIO / ConsensusMapArrowIO / IdentificationDataArrowIO machinery. Only MapAlignerIdentification needed structural work — a small refactor to use FileHandler instead of duplicated format-sniffing logic.

Depends on #9400 (FeatureMap MetaValue + ProteinIdentification identifier parity) — already merged. The setPrimaryMSRunPath round-trip and spectra_data linkage fixes from #9400 are required for the QUANT chain to round-trip cleanly through parquet; without them, MzTabExporter fails on consensusparquet input.

Validation: end-to-end run through nf-core/mhcquant test_full profile (PXD011628 immunopeptidomics, 6 raw files, PBMC009 + PBMC007), comparing every intermediate + final output of both lanes. Detailed report below — headline: 16/18 pairs all-pass; the 2 "diverged" mzTab pairs have identical section-row counts and differ only in ms_run-location ordering (cosmetic non-determinism, separate follow-up).

RESULTS_consolidated.html

Summary by CodeRabbit

  • New Features

    • Broad Parquet support added: .featureparquet, .consensusparquet, .idparquet accepted across converters, exporters, alignment, linking, and ID tools; tools can convert between Parquet and XML.
  • Documentation

    • CHANGELOG and tool help updated to document Parquet support and input/output behavior.
  • Tests

    • Added FileConverter tests for Parquet↔XML round‑trips.
  • Chores

    • File I/O behavior clarified: intermediate “.unknown” fallback requires a single concrete type (mismatches now raise InvalidFileType).

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-25 16:00:07.695707734 +0000
+++ AUTHORS.new	2026-05-25 16:00:12.480054449 +0000
@@ -59,6 +59,7 @@
  - Johannes Veit
  - Johannes von Kleist
  - Johan Teleman
+ - jonasscheid
  - Joshua Charkow
  - Juliane Schmachtenberg
  - Julianus Pfeuffer

@jonasscheid jonasscheid changed the title feat(quant-chain): add idparquet I/O to QUANT-chain TOPP tools Add idparquet I/O to some quant TOPP tools May 25, 2026
@timosachsenberg

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

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).
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).
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).
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).
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.
Extend featureXML/consensusXML/idXML dispatch branches with parquet siblings.
Output is always mzTab, so no store-side changes are needed.
Extend featureXML/consensusXML/idXML dispatch branches with parquet siblings.
Output is always tsv/csv/txt, so no store-side changes are needed.
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.
…ensusFeatures

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 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>.
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.
@jonasscheid
jonasscheid force-pushed the feature/idparquet-quant-tools branch from 5bf55c4 to 1433379 Compare May 26, 2026 21:20
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]>
@timosachsenberg
timosachsenberg marked this pull request as ready for review May 30, 2026 08:51
@timosachsenberg
timosachsenberg enabled auto-merge (squash) May 30, 2026 08:51
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR extends parquet file-format support across the OpenMS TOPP tool ecosystem. It documents a new FileHandler contract for .unknown intermediates, refactors analysis and export tools to accept featureparquet/consensusparquet/idparquet alongside XML formats, and adds comprehensive test coverage for parquet round-trip conversions.

Changes

Parquet format support across TOPP ecosystem

Layer / File(s) Summary
Documentation and FileHandler contract
CHANGELOG, src/openms/include/OpenMS/FORMAT/FileHandler.h
Documents parquet support for FileConverter, TextExporter, and multiple analysis tools; establishes size-1 .unknown fallback contract requiring concrete file types for intermediate outputs.
FeatureFinderIdentification algorithm and core pattern
src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
Demonstrates the explicit file-type contract pattern by determining output type and passing it to storeFeatures instead of using implicit defaults.
FileConverter conversion hub
src/topp/FileConverter.cpp
Extends format validation lists, consensus/feature/parquet compatibility checks, and output storage to support both XML and parquet serialization for features and consensus data.
FeatureLinker base and output type selection
src/topp/FeatureLinkerBase.cpp
Adds consensusOutTypeFor helper and extends input validation/loading to accept featureparquet/consensusparquet; output format follows input type.
FeatureLinker labeled and unlabeled variants
src/topp/FeatureLinkerLabeled.cpp, src/topp/FeatureLinkerUnlabeled.cpp
Extends both linkers to accept featureparquet inputs and consensusparquet outputs; FeatureLinkerUnlabeled refactors reference-map selection to handle parquet formats.
FeatureFinderIdentification tool extension
src/topp/FeatureFinderIdentification.cpp
Adds parquet support for id/id_ext inputs and feature/candidate outputs; selects output type based on candidate input presence and corresponding input file type.
ID and consensus processing tools
src/topp/IDConflictResolver.cpp, src/topp/IDFilter.cpp
Extends both tools to accept and output parquet variants of feature and consensus formats; output format follows input type.
MapAlignerIdentification refactoring
src/topp/MapAlignerIdentification.cpp
Refactors load/store helpers to use FileHandler with parquet support; adds feature/consensus/id parquet cases to alignment switch and extends reference-file loading to handle parquet variants.
MapRTTransformer retention time transformation
src/topp/MapRTTransformer.cpp
Extends input dispatch to load/transform/store feature, consensus, and identification data in both XML and parquet formats with output type following input format.
Export tools
src/topp/TextExporter.cpp, src/topp/MzTabExporter.cpp
Extends both exporters to accept parquet inputs for features, consensus, and identifications; updates input dispatch and FileHandler loading to include parquet format options.
Test coverage and TOPPAS updates
src/tests/topp/CMakeLists.txt, src/tests/topp/INIUpdater_*.toppas
Adds five new FileConverter parquet round-trip tests (featureparquet↔featureXML, consensusparquet↔consensusXML, cross-serialization); updates TOPPAS test files to specify parquet format support in tool parameters.

Sequence Diagram

sequenceDiagram
  participant TOPPTool
  participant FileConverter
  participant FileHandler
  participant FileSystem
  TOPPTool->>FileConverter: request conversion/load
  FileConverter->>FileHandler: loadFeatures/loadConsensusFeatures/loadIdentifications (XML/Parquet allowed_types)
  FileHandler->>FileSystem: read file (XML or Parquet)
  FileHandler-->>FileConverter: in-memory maps/IDs
  FileConverter->>FileHandler: storeFeatures/storeConsensusFeatures/storeIdentifications (explicit out_type)
  FileHandler->>FileSystem: write file (XML or Parquet)
Loading

Possibly related PRs

  • OpenMS/OpenMS#9242: Adds FileTypes::FEATUREPARQUET/CONSENSUSPARQUET and FileHandler support for loading/storing parquet formats, which this PR builds upon.
  • OpenMS/OpenMS#9396: Related effort addressing FileHandler size-1 .unknown fallback behavior shared across identifications and feature storage.
  • OpenMS/OpenMS#9232: Adds FileTypes::IDPARQUET and idparquet support via FileHandler, which this PR extends across multiple tools.

Suggested reviewers

  • timosachsenberg
  • jpfeuffer

Poem

🐰 I hopped through code with a curious squeak,

parquet and XML now speak cheek to cheek,
FileHandler guides the path where formats meet,
TOPP tools march in step, outputs now neat,
round-trip tests clap — a tidy, hoppity beat!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.11% 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 'Add idparquet I/O to some quant TOPP tools' is concise, clear, and accurately captures the main objective of the pull request: extending parquet I/O support to quantitative TOPP tools.
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.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/topp/FeatureLinkerBase.cpp (1)

71-77: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update the consensusXML-only wording.

The keep_subelements help text and the design-file error still say consensusXML only, but CONSENSUSPARQUET now follows the same path. Leaving those strings unchanged will mislead users about what the tool accepts.

Also applies to: 133-136

🤖 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/FeatureLinkerBase.cpp` around lines 71 - 77, Update the help text
and any error messages that mention "consensusXML only" to reflect that
CONSENSUSPARQUET is also supported: change the message in the registerFlag_ call
for keep_subelements (registerFlag_("keep_subelements", ...)) and the
design-file error handling text (the error at the block around the code handling
the design file, previously referencing "consensusXML") to mention both
"consensusXML and consensusparquet" (or a neutral phrase like "consensus
formats") so users aren’t misled; ensure both places use the same wording.
src/topp/MapAlignerIdentification.cpp (1)

340-350: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject mixed XML/parquet input lists or pick the output type per file.

Line 340 captures in_type from input_files[0] once, but the feature/consensus/id load paths now accept both XML and parquet for every entry. That means a mixed list like featureXML + featureparquet will still load, then every output gets forced to the first file’s concrete format at Lines 444, 465, and 499. Please either validate that all inputs in a batch use the same concrete type or derive out_type from each input_files[i] before storing.

Possible localized fix
     StringList output_files = getStringList_("out");
     StringList trafo_files = getStringList_("trafo_out");
     FileTypes::Type in_type = FileHandler::getType(input_files[0]);
+    for (Size i = 1; i < input_files.size(); ++i)
+    {
+      if (FileHandler::getType(input_files[i]) != in_type)
+      {
+        writeLogError_("Error: all input files must use the same concrete file format.");
+        return ILLEGAL_PARAMETERS;
+      }
+    }

Also applies to: 444-445, 463-465, 499-506

🤖 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/MapAlignerIdentification.cpp` around lines 340 - 350, The code
currently captures FileTypes::Type in_type from input_files[0] and then assumes
that concrete format for all loads/outputs (affecting code paths around in_type,
out_type and calls handling FEATUREXML/FEATUREPARQUET/CONSENSUS*), which breaks
for mixed input lists; either validate that every entry in input_files has the
same concrete FileTypes::Type as in_type and fail early with a clear error, or
change the logic to determine out_type per file (e.g., compute
FileHandler::getType(input_files[i]) inside the loop that loads/stores and use
that per-file out_type when selecting XML vs parquet load/save branches such as
the branches referenced by in_type/out_type and the transformation/storage
code), updating every place that currently uses the single in_type/out_type
assumption so each file uses its own derived type before storing.
🧹 Nitpick comments (1)
src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp (1)

957-958: ⚡ Quick win

Add braces around the single-statement if block.

The conditional assignment spans two lines and should use braces for consistency with the project's coding guidelines. As per coding guidelines, braces are required even for single-line blocks (trivial one-liners may stay single-line, but this is not one).

♻️ Proposed fix
-      if (candidates_out_type != FileTypes::FEATUREPARQUET)
-        candidates_out_type = FileTypes::FEATUREXML;
+      if (candidates_out_type != FileTypes::FEATUREPARQUET)
+      {
+        candidates_out_type = FileTypes::FEATUREXML;
+      }

As per coding guidelines: "Always use braces, even for single-line blocks (trivial one-liners may stay single-line)."

🤖 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/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp`
around lines 957 - 958, The conditional assignment to candidates_out_type lacks
braces; update the if statement that checks "candidates_out_type !=
FileTypes::FEATUREPARQUET" to use a braced block and move the assignment into it
(set candidates_out_type = FileTypes::FEATUREXML inside the braces) while
preserving existing indentation and formatting around the
FeatureFinderIdentificationAlgorithm::... code area.
🤖 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/FeatureFinderIdentification.cpp`:
- Around line 172-179: The output format validation currently rejects "unknown"
for the 'out' and 'candidates_out' outputs; update the calls to setValidFormats_
associated with registerOutputFile_("out", ...) and
registerOutputFile_("candidates_out", ...) to include "unknown" in their allowed
format lists so that runtime-inferred types and TOPPAS/intermediate-file flows
can pass through to the singleton fallback. Ensure the two setValidFormats_
invocations for symbols "out" and "candidates_out" include "unknown" alongside
their existing entries.

In `@src/topp/FeatureLinkerUnlabeled.cpp`:
- Around line 133-149: The parquet branch currently falls back to
reference_index = 0 making selection order-dependent; instead perform a
lightweight first pass to estimate feature counts for parquet files and pick the
file with the largest count like the XML branch does. In
FeatureLinkerUnlabeled.cpp, when file_type == FileTypes::FEATUREPARQUET iterate
the ins list and for each parquet input use the minimal reader/metadata API
(analogous to FeatureXMLFile::loadSize for XML) to obtain the feature count (or
row count) without fully materializing maps, track max_count and set
reference_index to the index with the largest count; keep the XML path using
FeatureXMLFile::loadSize unchanged and reuse the same reference_index variable.

In `@src/topp/FileConverter.cpp`:
- Around line 472-480: The CSV/OMS writer compatibility checks only accept XML
enum types and therefore reject inputs that were loaded from Parquet; update the
conditional checks that gate CSV and OMS writing to also accept
FileTypes::FEATUREPARQUET and FileTypes::CONSENSUSPARQUET. Specifically, where
FileConverter.cpp inspects in_type/out_type around the blocks that call
FileHandler().loadConsensusFeatures(...) (populating cm) and the analogous
feature map loader (populating fm), add the parquet enum values
(FileTypes::CONSENSUSPARQUET and FileTypes::FEATUREPARQUET) to the same boolean
branches that currently list FileTypes::CONSENSUSXML and FileTypes::FEATUREXML
so CSV and OMS writers see the loaded cm/fm as compatible.

In `@src/topp/IDConflictResolver.cpp`:
- Around line 92-93: The valid output formats for the "out" output are too
restrictive and must include "unknown" so TOPPAS intermediate outputs are
accepted; update the setValidFormats_ call for the "out" output (the call to
setValidFormats_("out", ListUtils::create<String>(...))) to include "unknown" in
the list (e.g. add "unknown" alongside
"featureXML,consensusXML,featureparquet,consensusparquet") so the resolver
accepts store paths with unknown extensions while still listing the concrete
types.

In `@src/topp/IDFilter.cpp`:
- Around line 125-126: The output format whitelist for the "out" output
currently set by setValidFormats_("out",
{"idXML","consensusXML","idparquet","consensusparquet"}) is missing ".unknown",
which prevents TOPPAS fallback when out is type-inferred from infiletype; update
the valid formats for the "out" output in IDFilter.cpp (the setValidFormats_
call for "out") to include ".unknown" so argument validation allows the
inferred/unknown type fallback used by TOPPAS.

In `@src/topp/MzTabExporter.cpp`:
- Line 91: The CLI description passed to TOPPBase still refers only to "XML
formats" while setValidFormats_("in", ...) was expanded to include parquet;
update the description string you pass into the MzTabExporter/TOPPBase
constructor (or the setProgramDescription/setDescription call) to mention both
XML and Parquet (or say "XML and Parquet formats" / "supported input formats:
XML, Parquet, MZID") so the -help output matches the formats registered by
setValidFormats_("in", ListUtils::create<String>(...)).

In `@src/topp/TextExporter.cpp`:
- Line 613: The CLI now accepts parquet inputs but the user-facing descriptions
and subsection labels in TextExporter.cpp are still XML-only; update the
displayed/help strings to mention "parquet" alongside "XML" wherever formats are
listed (e.g., update the call site and nearby descriptive strings associated
with setValidFormats_ and any tool page/subsection labels or
getDescription()/getSubsection() text in this file) so generated docs/help
reflect supported "featureparquet, consensusparquet, idparquet" as well as the
XML variants.

---

Outside diff comments:
In `@src/topp/FeatureLinkerBase.cpp`:
- Around line 71-77: Update the help text and any error messages that mention
"consensusXML only" to reflect that CONSENSUSPARQUET is also supported: change
the message in the registerFlag_ call for keep_subelements
(registerFlag_("keep_subelements", ...)) and the design-file error handling text
(the error at the block around the code handling the design file, previously
referencing "consensusXML") to mention both "consensusXML and consensusparquet"
(or a neutral phrase like "consensus formats") so users aren’t misled; ensure
both places use the same wording.

In `@src/topp/MapAlignerIdentification.cpp`:
- Around line 340-350: The code currently captures FileTypes::Type in_type from
input_files[0] and then assumes that concrete format for all loads/outputs
(affecting code paths around in_type, out_type and calls handling
FEATUREXML/FEATUREPARQUET/CONSENSUS*), which breaks for mixed input lists;
either validate that every entry in input_files has the same concrete
FileTypes::Type as in_type and fail early with a clear error, or change the
logic to determine out_type per file (e.g., compute
FileHandler::getType(input_files[i]) inside the loop that loads/stores and use
that per-file out_type when selecting XML vs parquet load/save branches such as
the branches referenced by in_type/out_type and the transformation/storage
code), updating every place that currently uses the single in_type/out_type
assumption so each file uses its own derived type before storing.

---

Nitpick comments:
In `@src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp`:
- Around line 957-958: The conditional assignment to candidates_out_type lacks
braces; update the if statement that checks "candidates_out_type !=
FileTypes::FEATUREPARQUET" to use a braced block and move the assignment into it
(set candidates_out_type = FileTypes::FEATUREXML inside the braces) while
preserving existing indentation and formatting around the
FeatureFinderIdentificationAlgorithm::... code area.
🪄 Autofix (Beta)

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: fc9b42fa-b827-4c12-bd41-ffbfa2a2b5b6

📥 Commits

Reviewing files that changed from the base of the PR and between 653dd9c and d3946d4.

⛔ Files ignored due to path filters (10)
  • src/tests/topp/FileConverter_14_output.consensusparquet/consensus_features.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_14_output.consensusparquet/protein_groups.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_14_output.consensusparquet/proteins.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_14_output.consensusparquet/psms.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_14_output.consensusparquet/search_params.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_9_output.featureparquet/features.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_9_output.featureparquet/protein_groups.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_9_output.featureparquet/proteins.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_9_output.featureparquet/psms.parquet is excluded by !**/*.parquet
  • src/tests/topp/FileConverter_9_output.featureparquet/search_params.parquet is excluded by !**/*.parquet
📒 Files selected for processing (22)
  • CHANGELOG
  • src/openms/include/OpenMS/FORMAT/FileHandler.h
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/topp/CMakeLists.txt
  • src/tests/topp/FileConverter_32_output.featureXML
  • src/tests/topp/FileConverter_33_output.consensusXML
  • src/tests/topp/FileConverter_34_output.consensusXML
  • src/tests/topp/FileConverter_35_output.consensusXML
  • src/tests/topp/FileConverter_36_output.consensusXML
  • src/tests/topp/INIUpdater_1_noupdate.toppas
  • src/tests/topp/INIUpdater_3_old_out.toppas
  • src/topp/FeatureFinderIdentification.cpp
  • src/topp/FeatureLinkerBase.cpp
  • src/topp/FeatureLinkerLabeled.cpp
  • src/topp/FeatureLinkerUnlabeled.cpp
  • src/topp/FileConverter.cpp
  • src/topp/IDConflictResolver.cpp
  • src/topp/IDFilter.cpp
  • src/topp/MapAlignerIdentification.cpp
  • src/topp/MapRTTransformer.cpp
  • src/topp/MzTabExporter.cpp
  • src/topp/TextExporter.cpp

Comment on lines 172 to +179
registerOutputFile_("out", "<file>", "", "Output file: Features");
setValidFormats_("out", {"featureXML"});
setValidFormats_("out", {"featureXML", "featureparquet"});
registerOutputFile_("lib_out", "<file>", "", "Output file: Assay library", false);
setValidFormats_("lib_out", {"traML"});
registerOutputFile_("chrom_out", "<file>", "", "Output file: Chromatograms", false);
setValidFormats_("chrom_out", {"mzML"});
registerOutputFile_("candidates_out", "<file>", "", "Output file: Feature candidates (before filtering and model fitting)", false);
setValidFormats_("candidates_out", {"featureXML"});
setValidFormats_("candidates_out", {"featureXML", "featureparquet"});

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Allow .unknown for inferred output formats.

out and candidates_out now have their concrete type selected at runtime, so rejecting *.unknown here breaks TOPPAS/intermediate-file flows before the singleton fallback can kick in. Please add unknown to both output format lists.

Suggested change
-    setValidFormats_("out", {"featureXML", "featureparquet"});
+    setValidFormats_("out", {"featureXML", "featureparquet", "unknown"});
...
-    setValidFormats_("candidates_out", {"featureXML", "featureparquet"});
+    setValidFormats_("candidates_out", {"featureXML", "featureparquet", "unknown"});
🤖 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/FeatureFinderIdentification.cpp` around lines 172 - 179, The output
format validation currently rejects "unknown" for the 'out' and 'candidates_out'
outputs; update the calls to setValidFormats_ associated with
registerOutputFile_("out", ...) and registerOutputFile_("candidates_out", ...)
to include "unknown" in their allowed format lists so that runtime-inferred
types and TOPPAS/intermediate-file flows can pass through to the singleton
fallback. Ensure the two setValidFormats_ invocations for symbols "out" and
"candidates_out" include "unknown" alongside their existing entries.

Comment on lines +133 to 149
if (file_type == FileTypes::FEATUREXML || file_type == FileTypes::FEATUREPARQUET)
{
// use map with highest number of features as reference:
Size max_count(0);
FeatureXMLFile f;
for (Size i = 0; i < ins.size(); ++i)
// FeatureXMLFile::loadSize is XML-only; for parquet fall back to index 0.
if (file_type == FileTypes::FEATUREXML)
{
Size s = f.loadSize(ins[i]);
if (s > max_count)
Size max_count(0);
FeatureXMLFile f;
for (Size i = 0; i < ins.size(); ++i)
{
max_count = s;
reference_index = i;
Size s = f.loadSize(ins[i]);
if (s > max_count)
{
max_count = s;
reference_index = i;
}
}

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Parquet input makes reference selection order-dependent.

For XML, the reference map is still chosen as the largest input, but parquet now silently falls back to reference_index = 0. That changes the grouping behavior based on CLI order and can produce different results from the XML path for the same data. Please derive a comparable size for parquet too, even if that requires a lightweight first pass.

🤖 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/FeatureLinkerUnlabeled.cpp` around lines 133 - 149, The parquet
branch currently falls back to reference_index = 0 making selection
order-dependent; instead perform a lightweight first pass to estimate feature
counts for parquet files and pick the file with the largest count like the XML
branch does. In FeatureLinkerUnlabeled.cpp, when file_type ==
FileTypes::FEATUREPARQUET iterate the ins list and for each parquet input use
the minimal reader/metadata API (analogous to FeatureXMLFile::loadSize for XML)
to obtain the feature count (or row count) without fully materializing maps,
track max_count and set reference_index to the index with the largest count;
keep the XML path using FeatureXMLFile::loadSize unchanged and reuse the same
reference_index variable.

Comment thread src/topp/FileConverter.cpp Resolved
Comment on lines 92 to +93
registerOutputFile_("out", "<file>", "", "Output file (data with one peptide identification per feature)");
setValidFormats_("out", ListUtils::create<String>("featureXML,consensusXML"));
setValidFormats_("out", ListUtils::create<String>("featureXML,consensusXML,featureparquet,consensusparquet"));

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep unknown as a valid output extension here.

This tool writes a single concrete output type derived from in_type, so excluding unknown will reject valid TOPPAS intermediate outputs even though the store path can resolve them.

Suggested change
-    setValidFormats_("out", ListUtils::create<String>("featureXML,consensusXML,featureparquet,consensusparquet"));
+    setValidFormats_("out", ListUtils::create<String>("featureXML,consensusXML,featureparquet,consensusparquet,unknown"));
🤖 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/IDConflictResolver.cpp` around lines 92 - 93, The valid output
formats for the "out" output are too restrictive and must include "unknown" so
TOPPAS intermediate outputs are accepted; update the setValidFormats_ call for
the "out" output (the call to setValidFormats_("out",
ListUtils::create<String>(...))) to include "unknown" in the list (e.g. add
"unknown" alongside "featureXML,consensusXML,featureparquet,consensusparquet")
so the resolver accepts store paths with unknown extensions while still listing
the concrete types.

Comment thread src/topp/IDFilter.cpp
Comment on lines 125 to +126
registerOutputFile_("out", "<file>", "", "output file ");
setValidFormats_("out", {"idXML","consensusXML","idparquet"});
setValidFormats_("out", {"idXML","consensusXML","idparquet","consensusparquet"});

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add .unknown to the output format whitelist.

out is effectively type-inferred from infiletype, so omitting unknown blocks the TOPPAS fallback path at argument validation time.

Suggested change
-    setValidFormats_("out", {"idXML","consensusXML","idparquet","consensusparquet"});
+    setValidFormats_("out", {"idXML","consensusXML","idparquet","consensusparquet","unknown"});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
registerOutputFile_("out", "<file>", "", "output file ");
setValidFormats_("out", {"idXML","consensusXML","idparquet"});
setValidFormats_("out", {"idXML","consensusXML","idparquet","consensusparquet"});
registerOutputFile_("out", "<file>", "", "output file ");
setValidFormats_("out", {"idXML","consensusXML","idparquet","consensusparquet","unknown"});
🤖 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/IDFilter.cpp` around lines 125 - 126, The output format whitelist
for the "out" output currently set by setValidFormats_("out",
{"idXML","consensusXML","idparquet","consensusparquet"}) is missing ".unknown",
which prevents TOPPAS fallback when out is type-inferred from infiletype; update
the valid formats for the "out" output in IDFilter.cpp (the setValidFormats_
call for "out") to include ".unknown" so argument validation allows the
inferred/unknown type fallback used by TOPPAS.

Comment thread src/topp/MzTabExporter.cpp Resolved
Comment thread src/topp/TextExporter.cpp Resolved
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]>

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/topp/MzTabExporter.cpp (1)

115-122: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in comment.

Line 118 contains a duplicate word: "study variable variable level" should be "study variable level".

✏️ Proposed fix
-        // For featureXML/featureparquet we export a "Summary Quantification" file. This means we don't need to report feature quantification values at the assay level
-        // but only at the (single) study variable variable level.
+        // For featureXML/featureparquet we export a "Summary Quantification" file. This means we don't need to report feature quantification values at the assay level
+        // but only at the (single) study variable level.
🤖 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/MzTabExporter.cpp` around lines 115 - 122, In the if-block checking
in_type == FileTypes::FEATUREXML || in_type == FileTypes::FEATUREPARQUET (around
the FeatureMap/ FileHandler().loadFeatures code), fix the comment that currently
reads "study variable variable level" by removing the duplicate word so it reads
"study variable level"; update the comment text only (no code changes).
🤖 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.

Outside diff comments:
In `@src/topp/MzTabExporter.cpp`:
- Around line 115-122: In the if-block checking in_type == FileTypes::FEATUREXML
|| in_type == FileTypes::FEATUREPARQUET (around the FeatureMap/
FileHandler().loadFeatures code), fix the comment that currently reads "study
variable variable level" by removing the duplicate word so it reads "study
variable level"; update the comment text only (no code changes).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c04e46e3-67dd-4e64-a7c4-dd05d54aab79

📥 Commits

Reviewing files that changed from the base of the PR and between d3946d4 and 92ef86b.

📒 Files selected for processing (6)
  • src/tests/topp/INIUpdater_1_noupdate.toppas
  • src/tests/topp/INIUpdater_3_old_out.toppas
  • src/topp/FeatureLinkerBase.cpp
  • src/topp/FileConverter.cpp
  • src/topp/MzTabExporter.cpp
  • src/topp/TextExporter.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/tests/topp/INIUpdater_1_noupdate.toppas
  • src/topp/TextExporter.cpp
  • src/topp/FeatureLinkerBase.cpp
  • src/topp/FileConverter.cpp

@timosachsenberg
timosachsenberg disabled auto-merge May 30, 2026 10:38
@timosachsenberg
timosachsenberg merged commit b2cfcbf into OpenMS:develop May 30, 2026
37 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.

2 participants