Repository navigation
[FIX] QPX export: make the psm, feature and pg views spec-conformant and joinable - #9825
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughQPX exports now share canonical metadata, scan-format detection, run-file naming, and intensity labels. Consensus features are melted per run, protein evidence is attributed by run, PSM metadata carries scan formats, and ProSE reconciles metadata when merging Parquet files. ChangesQPX export consistency
Sequence Diagram(s)sequenceDiagram
participant ProSE
participant QPXFile
participant ConsensusMapArrowExport
participant ArrowIOHelpers
participant ParquetWriter
ProSE->>QPXFile: export PSM data with scan_format
ConsensusMapArrowExport->>ArrowIOHelpers: derive feature metadata and labels
QPXFile->>ParquetWriter: write PSM metadata
ConsensusMapArrowExport->>ParquetWriter: write feature metadata
ProSE->>ArrowIOHelpers: provide merged-file metadata
ArrowIOHelpers->>ParquetWriter: write merged Parquet output
Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (10)
src/openms/source/FORMAT/ArrowIOHelpers.cpp (2)
106-107: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the required multiline block style.
These new one-line
ifblocks place braces on the conditional line; move each brace onto its own aligned line. As per coding guidelines, “braces on their own aligned lines.”Also applies to: 117-117, 161-161, 172-172, 194-195
🤖 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/FORMAT/ArrowIOHelpers.cpp` around lines 106 - 107, Reformat the affected one-line conditional blocks in the native-ID handling code, including the conditions using StringUtils::hasPrefix and SpectrumNativeIDParser::isNativeID and the additionally referenced blocks, so opening and closing braces appear on separate aligned lines. Preserve each condition and return statement unchanged.Source: Coding guidelines
78-79: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReplace
std::endlin new log paths.
src/openms/source/FORMAT/ArrowIOHelpers.cpp#L78-L79: terminate the error log with'\n'.src/openms/source/FORMAT/ArrowIOHelpers.cpp#L153-L155: terminate the error log with'\n'.src/openms/source/FORMAT/ArrowIOHelpers.cpp#L177-L181: terminate the error log with'\n'.src/openms/source/FORMAT/ArrowIOHelpers.cpp#L200-L201: terminate the warning log with'\n'.As per coding guidelines, “Prefer
\noverstd::endl.”🤖 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/FORMAT/ArrowIOHelpers.cpp` around lines 78 - 79, Replace std::endl with '\n' in the four new log statements in src/openms/source/FORMAT/ArrowIOHelpers.cpp: lines 78-79, 153-155, and 177-181 for errors, and lines 200-201 for the warning. Preserve the existing messages and logging behavior.Source: Coding guidelines
src/openms/source/FORMAT/QPXFile.cpp (2)
766-790: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMisplaced helper documentation.
Lines 766-776 document
IdentifierMSRunMapper/buildRunMapper(constructor-throw semantics, merged-run rationale) but sit directly abovecollectRunPaths, whose own one-line doc follows at 777-778. Move the mapper block down tobuildRunMapperat Line 792 so the throw/degrade contract is attached to the function it describes.🤖 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/FORMAT/QPXFile.cpp` around lines 766 - 790, Move the mapper-specific documentation block from above collectRunPaths to directly above buildRunMapper, keeping the collectRunPaths documentation limited to its run-path collection purpose. Preserve the existing wording and attach the throw/degrade contract to buildRunMapper.
1616-1617: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMaterializing every spectrum reference defeats the streaming path's memory cap.
spectrumReferences(peptide_identification_ptrs)copies every non-empty native ID into one vector beforeqpxScanFormatreduces it to a single token. For the millions-of-PSMs inputs this overload exists for, that is hundreds of MB allocated up front — in the function whose whole purpose is bounding peak memory.qpxScanFormatalso cannot short-circuit: it already returns as soon as two conventions disagree, but only after the full vector is built.Scan the pointers directly instead of collecting them.
♻️ Resolve scan_format without buffering the IDs
Add next to
spectrumReferencesin the anonymous namespace:/// Resolve the QPX scan_format token by scanning `@p` pep_ptrs in place, so the /// streaming export never materializes every native ID at once. std::string scanFormatOf(const std::vector<const PeptideIdentification*>& pep_ptrs) { std::string resolved; for (const auto* p : pep_ptrs) { if (!p) { continue; } const std::string& ref = p->getSpectrumReference(); if (ref.empty()) { continue; } const std::string fmt = ArrowIOHelpers::qpxScanFormat(ref); if (fmt.empty()) { continue; } if (resolved.empty()) { resolved = fmt; } else if (resolved != fmt) { return ""; } // mixed conventions -> omit } return resolved; }Then:
- auto meta = qpxPsmMetadata(config, ArrowIOHelpers::qpxScanFormat(spectrumReferences(peptide_identification_ptrs))); + auto meta = qpxPsmMetadata(config, scanFormatOf(peptide_identification_ptrs));🤖 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/FORMAT/QPXFile.cpp` around lines 1616 - 1617, Replace the materializing spectrumReferences call in the qpxPsmMetadata setup with a direct scan-format resolver that iterates peptide_identification_ptrs in place. Add scanFormatOf beside spectrumReferences, skipping null pointers and empty references, resolving the first non-empty QPX format, and returning an empty string immediately when formats conflict; pass its result to qpxPsmMetadata while preserving the existing unsupported-format handling.src/openms/source/FORMAT/ProteinGroupArrowExport.cpp (2)
310-313: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDrop the now-unused
distinct_peptides_for_runparameter.The reworked counts block no longer reads it, so both call sites pass the magic
-1under a stale comment ("we don't have per-run distinct_peptides directly", Line 558).♻️ Remove the parameter and its call-site noise
auto emitRow = [&](const ProteinIdentification::ProteinGroup& group, const std::string& run_file, - const std::vector<std::pair<std::string, float>>& channel_intensities, - int distinct_peptides_for_run) + const std::vector<std::pair<std::string, float>>& channel_intensities)At Lines 556-560:
for (const auto& [filename, channel_int] : file_intensities) { - // We don't have per-run distinct_peptides directly - use -1 to indicate unknown - emitRow(group, filename, channel_int, -1); + emitRow(group, filename, channel_int); }And at Line 575:
- for (const auto& run : runs) { emitRow(group, run, {}, -1); } + for (const auto& run : runs) { emitRow(group, run, {}); }🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 310 - 313, Remove the unused distinct_peptides_for_run parameter from the emitRow lambda and update both call sites to stop passing the stale -1 argument and associated comment. Leave the remaining row-emission arguments and behavior unchanged.
1122-1134: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate of
collectRunPathsinsrc/openms/source/FORMAT/QPXFile.cpp.This block is the same primary-MS-run-path gather that
QPXFile.cpp(Lines 779-790) implements as a file-localcollectRunPaths, and both feed the identicalqpxValidateRunNamespreflight. SinceArrowIOHelpersalready owns the validator, hosting the collector next to it keeps the two preflights from drifting apart.♻️ Move the collector into ArrowIOHelpers
Declare alongside
qpxValidateRunNamesinsrc/openms/include/OpenMS/FORMAT/ArrowIOHelpers.h:/** `@brief` Collect every primary MS run path referenced by `@p` protein_identifications. Intended as the input to qpxValidateRunNames() in the QPX export preflights. `@param`[in] protein_identifications Identification runs to scan `@return` All primary MS run paths, in encounter order (duplicates retained) */ OPENMS_DLLAPI std::vector<std::string> qpxCollectRunPaths( const std::vector<ProteinIdentification>& protein_identifications);Then here:
- { - std::vector<std::string> paths; - for (const auto& prot_id : protein_identifications) - { - StringList ms_runs; - prot_id.getPrimaryMSRunPath(ms_runs); - for (const auto& p : ms_runs) { paths.push_back(p); } - } - if (!ArrowIOHelpers::qpxValidateRunNames(paths)) { return false; } - } + if (!ArrowIOHelpers::qpxValidateRunNames( + ArrowIOHelpers::qpxCollectRunPaths(protein_identifications))) { return false; }and drop the local
collectRunPathsinsrc/openms/source/FORMAT/QPXFile.cpp.Note the header addition needs no
sources.cmakechange (existing header), but does need the nanobind/pyOpenMS surface checked ifArrowIOHelpersis wrapped. As per coding guidelines: "When changing a C++ API, update nanobind bindings or addons, pyOpenMS tests, and relevant documentation".🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 1122 - 1134, Move the shared primary-MS-run-path collection into ArrowIOHelpers by declaring and implementing qpxCollectRunPaths alongside qpxValidateRunNames, preserving encounter order and duplicates. Replace the local gathering block in ProteinGroupArrowExport with this helper, remove the file-local collectRunPaths in QPXFile.cpp, and update any nanobind/pyOpenMS bindings, tests, or documentation required for the exposed API.Source: Coding guidelines
src/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp (1)
370-419: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider covering the unresolvable-channel case. This section only exercises a recognized method (
tmt10plex_*). A header carryingchannel_namewith a label that names no known isobaric method takes theqpxIntensityLabel() == ""path, which currently emits a blank non-nullablelabel; a test there would pin down whichever behavior you settle on for that path.As per coding guidelines, "Write unit tests for new functionality".
🤖 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/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp` around lines 370 - 419, Extend the test section around ConsensusMapArrowExport::exportToArrow to cover a header with channel_name metadata but an unrecognized method label, exercising the qpxIntensityLabel() == "" path. Assert the chosen behavior for the generated intensity label, including the non-nullable label constraint, so this unresolved-channel case is explicitly pinned down alongside the recognized tmt10plex_* case.Source: Coding guidelines
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (3)
463-495: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueBest-hit selection is recomputed once per melted row of the same feature. Rows for one feature are contiguous, so a one-line memo avoids re-scanning identifications N times per feature (and re-emitting the warning path).
♻️ Cache across rows of the same feature
bool warned_mixed_scores = false; + size_t cached_feat_idx = std::numeric_limits<size_t>::max(); + PeptideHit cached_hit; Size cached_id_index = 0; bool cached_has_id = false; for (const auto& row : rows) { const auto& cf = cmap[row.feat_idx]; const auto& pep_ids = cf.getPeptideIdentifications(); + if (row.feat_idx == cached_feat_idx) + { + best_hit_value = cached_hit; best_id_index = cached_id_index; has_id = cached_has_id; + } + else { /* existing getBestHit try/catch, then populate the cache */ }🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 463 - 495, Cache the best-hit selection across contiguous rows for the same feature instead of recomputing it in every iteration of the rows loop. Reuse the cached hit, identification index, and validity state when row.feat_idx is unchanged, while preserving the existing mixed-score fallback and single-warning behavior in the best-hit selection logic.
1114-1128: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value
refsmaterializes one string per PSM just to resolve a single token. For large maps this is a sizeable transient allocation, andqpxScanFormatbails out as soon as two conventions disagree anyway. Feeding it incrementally (or stopping collection once a second distinct format appears) keeps the metadata step O(1) in memory.🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 1114 - 1128, Update the reference-format detection before qpxScanFormat so it does not materialize one string per peptide-spectrum match in refs. Feed spectrum references incrementally or stop collecting as soon as two distinct scan-format conventions are detected, while preserving qpxScanFormat’s resulting scan_format behavior and avoiding unnecessary transient allocations.
1147-1161: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueValidate before building the table.
qpxValidateRunNames()needs onlycmap, so hoisting it (andqpxFeatureMetadata) above theexportToArrow()call avoids building the whole Arrow table just to discard it on a preflight failure.🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 1147 - 1161, Move the qpxValidateRunNames() and qpxFeatureMetadata(cmap, config) preflight checks before exportToArrow(cmap) in the surrounding export method. Return false on either validation failure before constructing the Arrow table, while preserving the existing metadata replacement and table-creation failure handling.
🤖 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/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 1085-1090: Move the paragraph describing
qpxFeatureMetadata()—including its fresh UUID/creation date behavior and nullptr
result for unsupported compression—from the comment above
collectFeatureRunPaths() to the qpxFeatureMetadata() declaration around line
1107. Keep the collectFeatureRunPaths() description directly above that
function.
- Around line 366-383: Update the feature-handle grouping in the export loop
around column_headers_for_melt and by_run so headers with an empty filename are
not passed to qpxRunFileName or inserted under an empty run key. Treat those
handles like missing headers by skipping them and incrementing the existing
dropped_handleless tally when no valid runs remain, while preserving normal
grouping for non-empty filenames.
- Around line 630-635: Align the charge-dependent calculations in the consensus
export with the emitted charge: in the row-processing logic around the
coordinate selection, derive a row charge from the label-free handle when it is
nonzero, otherwise fall back to cf.getCharge(). Use this row charge for the
existing calculated_mz and mass_error_ppm computations, and emit the same value
in the charge column.
- Around line 991-1001: Update the intensity export loop in the
ConsensusMapArrowExport path around intensity_struct_b, intensity_label_b, and
qpxIntensityLabel so an unresolved isobaric channel never appends an empty label
or intensity entry. Detect the failed label resolution and abort the build by
returning nullptr, consistent with the existing hard-failure behavior for
unidentified methods.
In `@src/openms/source/FORMAT/ProteinGroupArrowExport.cpp`:
- Around line 440-463: Update the ConsensusMap export logic around the
peptide-count construction to populate pc_total_b
(peptide_counts.total_sequences) with the total sequence count, not
group_features.size(). Reuse the per-accession sequence totals computed in the
preceding peptides loop, matching the id-only exportToArrow behavior, while
leaving fc_total_b (feature_counts.total_features) based on
group_features.size().
In `@src/tests/class_tests/openms/source/QPXFile_test.cpp`:
- Around line 399-403: Update the streaming export test call to use a batch size
covering all three peptide identifications instead of 1, while retaining
n_threads set to 3. Ensure the existing concurrency assertion in
QPXFile::exportToParquetStreaming receives all rows in one batch so write_batch
can partition work across multiple workers.
In `@src/topp/ProSE.cpp`:
- Around line 760-769: Update the merged-output flow around merged_ok and
ArrowIOHelpers::concatenateAndWriteToParquet so the PSM write runs first and the
PG write is attempted only when the prior merged_ok status remains true.
Preserve failure propagation and add a test covering PSM concatenation failure
that verifies PG is not written and the merged output is reported unsuccessful.
---
Nitpick comments:
In `@src/openms/source/FORMAT/ArrowIOHelpers.cpp`:
- Around line 106-107: Reformat the affected one-line conditional blocks in the
native-ID handling code, including the conditions using StringUtils::hasPrefix
and SpectrumNativeIDParser::isNativeID and the additionally referenced blocks,
so opening and closing braces appear on separate aligned lines. Preserve each
condition and return statement unchanged.
- Around line 78-79: Replace std::endl with '\n' in the four new log statements
in src/openms/source/FORMAT/ArrowIOHelpers.cpp: lines 78-79, 153-155, and
177-181 for errors, and lines 200-201 for the warning. Preserve the existing
messages and logging behavior.
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 463-495: Cache the best-hit selection across contiguous rows for
the same feature instead of recomputing it in every iteration of the rows loop.
Reuse the cached hit, identification index, and validity state when row.feat_idx
is unchanged, while preserving the existing mixed-score fallback and
single-warning behavior in the best-hit selection logic.
- Around line 1114-1128: Update the reference-format detection before
qpxScanFormat so it does not materialize one string per peptide-spectrum match
in refs. Feed spectrum references incrementally or stop collecting as soon as
two distinct scan-format conventions are detected, while preserving
qpxScanFormat’s resulting scan_format behavior and avoiding unnecessary
transient allocations.
- Around line 1147-1161: Move the qpxValidateRunNames() and
qpxFeatureMetadata(cmap, config) preflight checks before exportToArrow(cmap) in
the surrounding export method. Return false on either validation failure before
constructing the Arrow table, while preserving the existing metadata replacement
and table-creation failure handling.
In `@src/openms/source/FORMAT/ProteinGroupArrowExport.cpp`:
- Around line 310-313: Remove the unused distinct_peptides_for_run parameter
from the emitRow lambda and update both call sites to stop passing the stale -1
argument and associated comment. Leave the remaining row-emission arguments and
behavior unchanged.
- Around line 1122-1134: Move the shared primary-MS-run-path collection into
ArrowIOHelpers by declaring and implementing qpxCollectRunPaths alongside
qpxValidateRunNames, preserving encounter order and duplicates. Replace the
local gathering block in ProteinGroupArrowExport with this helper, remove the
file-local collectRunPaths in QPXFile.cpp, and update any nanobind/pyOpenMS
bindings, tests, or documentation required for the exposed API.
In `@src/openms/source/FORMAT/QPXFile.cpp`:
- Around line 766-790: Move the mapper-specific documentation block from above
collectRunPaths to directly above buildRunMapper, keeping the collectRunPaths
documentation limited to its run-path collection purpose. Preserve the existing
wording and attach the throw/degrade contract to buildRunMapper.
- Around line 1616-1617: Replace the materializing spectrumReferences call in
the qpxPsmMetadata setup with a direct scan-format resolver that iterates
peptide_identification_ptrs in place. Add scanFormatOf beside
spectrumReferences, skipping null pointers and empty references, resolving the
first non-empty QPX format, and returning an empty string immediately when
formats conflict; pass its result to qpxPsmMetadata while preserving the
existing unsupported-format handling.
In `@src/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp`:
- Around line 370-419: Extend the test section around
ConsensusMapArrowExport::exportToArrow to cover a header with channel_name
metadata but an unrecognized method label, exercising the qpxIntensityLabel() ==
"" path. Assert the chosen behavior for the generated intensity label, including
the non-nullable label constraint, so this unresolved-channel case is explicitly
pinned down alongside the recognized tmt10plex_* case.
🪄 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 Plus
Run ID: 90d117cd-de63-409f-bb5b-680bd919362a
📒 Files selected for processing (13)
src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.hsrc/openms/include/OpenMS/FORMAT/QPXFile.hsrc/openms/include/OpenMS/PROCESSING/ID/IDFilter.hsrc/openms/source/FORMAT/ArrowIOHelpers.cppsrc/openms/source/FORMAT/ArrowSchemaRegistry.cppsrc/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/openms/source/FORMAT/ProteinGroupArrowExport.cppsrc/openms/source/FORMAT/QPXFile.cppsrc/tests/class_tests/openms/source/ArrowIOHelpers_test.cppsrc/tests/class_tests/openms/source/ArrowSchemaRegistry_test.cppsrc/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cppsrc/tests/class_tests/openms/source/QPXFile_test.cppsrc/topp/ProSE.cpp
| for (size_t feat_idx = range_begin; feat_idx < range_end; ++feat_idx) | ||
| { | ||
| // std::map keeps runs in a deterministic order, so output is stable for any thread count. | ||
| std::map<std::string, std::vector<const FeatureHandle*>> by_run; | ||
| for (const auto& fh : cmap[feat_idx].getFeatures()) | ||
| { | ||
| auto it = column_headers_for_melt.find(fh.getMapIndex()); | ||
| if (it == column_headers_for_melt.end()) { continue; } | ||
| by_run[ArrowIOHelpers::qpxRunFileName(it->second.filename)].push_back(&fh); | ||
| } | ||
| // A feature with no handles has neither quantification nor a run, so the per-run feature | ||
| // view has nothing to represent -- drop it rather than emit an unkeyed row. | ||
| if (by_run.empty()) { ++dropped_handleless; continue; } | ||
| for (auto& [run, handles] : by_run) | ||
| { | ||
| rows.push_back(RowSpec{feat_idx, run, std::move(handles)}); | ||
| } | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Empty filename yields an empty run_file_name key. qpxRunFileName("") returns "", so a column header without a filename produces a row keyed on the empty string — run_file_name is a non-nullable QPX primary-key component and joins the psm/feature/pg views, so this emits an unjoinable row rather than failing. collectFeatureRunPaths() skips empty filenames, so the collision preflight cannot catch it either. Consider treating an empty stem like a missing header (skip the handle, count it in the drop tally) or failing the export.
🛠️ Proposed guard
auto it = column_headers_for_melt.find(fh.getMapIndex());
if (it == column_headers_for_melt.end()) { continue; }
- by_run[ArrowIOHelpers::qpxRunFileName(it->second.filename)].push_back(&fh);
+ const std::string run = ArrowIOHelpers::qpxRunFileName(it->second.filename);
+ // An unnamed source run cannot key a QPX row: run_file_name is a primary-key
+ // component joined across the psm/feature/pg views.
+ if (run.empty()) { continue; }
+ by_run[run].push_back(&fh);📝 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.
| for (size_t feat_idx = range_begin; feat_idx < range_end; ++feat_idx) | |
| { | |
| // std::map keeps runs in a deterministic order, so output is stable for any thread count. | |
| std::map<std::string, std::vector<const FeatureHandle*>> by_run; | |
| for (const auto& fh : cmap[feat_idx].getFeatures()) | |
| { | |
| auto it = column_headers_for_melt.find(fh.getMapIndex()); | |
| if (it == column_headers_for_melt.end()) { continue; } | |
| by_run[ArrowIOHelpers::qpxRunFileName(it->second.filename)].push_back(&fh); | |
| } | |
| // A feature with no handles has neither quantification nor a run, so the per-run feature | |
| // view has nothing to represent -- drop it rather than emit an unkeyed row. | |
| if (by_run.empty()) { ++dropped_handleless; continue; } | |
| for (auto& [run, handles] : by_run) | |
| { | |
| rows.push_back(RowSpec{feat_idx, run, std::move(handles)}); | |
| } | |
| } | |
| for (size_t feat_idx = range_begin; feat_idx < range_end; ++feat_idx) | |
| { | |
| // std::map keeps runs in a deterministic order, so output is stable for any thread count. | |
| std::map<std::string, std::vector<const FeatureHandle*>> by_run; | |
| for (const auto& fh : cmap[feat_idx].getFeatures()) | |
| { | |
| auto it = column_headers_for_melt.find(fh.getMapIndex()); | |
| if (it == column_headers_for_melt.end()) { continue; } | |
| const std::string run = ArrowIOHelpers::qpxRunFileName(it->second.filename); | |
| // An unnamed source run cannot key a QPX row: run_file_name is a primary-key | |
| // component joined across the psm/feature/pg views. | |
| if (run.empty()) { continue; } | |
| by_run[run].push_back(&fh); | |
| } | |
| // A feature with no handles has neither quantification nor a run, so the per-run feature | |
| // view has nothing to represent -- drop it rather than emit an unkeyed row. | |
| if (by_run.empty()) { ++dropped_handleless; continue; } | |
| for (auto& [run, handles] : by_run) | |
| { | |
| rows.push_back(RowSpec{feat_idx, run, std::move(handles)}); | |
| } | |
| } |
🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 366 - 383,
Update the feature-handle grouping in the export loop around
column_headers_for_melt and by_run so headers with an empty filename are not
passed to qpxRunFileName or inserted under an empty run key. Treat those handles
like missing headers by skipping them and incrementing the existing
dropped_handleless tally when no valid runs remain, while preserving normal
grouping for non-empty filenames.
| // Quantitative coordinates: this run's handle for label-free, the consensus centroid for | ||
| // isobaric (whose handles carry reporter-ion m/z and the quantification scan's RT). | ||
| const FeatureHandle* coord = (!is_isobaric && !row.handles.empty()) ? row.handles.front() : nullptr; | ||
| (void)charge_builder.Append(static_cast<int16_t>(coord ? coord->getCharge() : cf.getCharge())); | ||
| (void)observed_mz_builder.Append(static_cast<float>(coord ? coord->getMZ() : cf.getMZ())); | ||
| (void)rt_builder.Append(static_cast<float>(coord ? coord->getRT() : cf.getRT())); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
charge now comes from the handle while calculated_mz/mass_error_ppm still use cf.getCharge(). For label-free rows the emitted charge is coord->getCharge(), but the calculated m/z and the ppm error are derived earlier from the consensus charge. Handles whose charge is unset default to 0, so such rows would report charge = 0 alongside a calculated_mz computed at the consensus charge — the three columns stop describing the same species. Either derive calculated_mz from the same charge used for the column, or fall back to cf.getCharge() when the handle's charge is 0.
🛠️ Minimal fallback
- (void)charge_builder.Append(static_cast<int16_t>(coord ? coord->getCharge() : cf.getCharge()));
+ const int row_charge = (coord && coord->getCharge() != 0) ? coord->getCharge() : cf.getCharge();
+ (void)charge_builder.Append(static_cast<int16_t>(row_charge));(and use row_charge for the calculated_mz / mass_error_ppm computation above)
🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 630 - 635,
Align the charge-dependent calculations in the consensus export with the emitted
charge: in the row-processing logic around the coordinate selection, derive a
row charge from the label-free handle when it is nonzero, otherwise fall back to
cf.getCharge(). Use this row charge for the existing calculated_mz and
mass_error_ppm computations, and emit the same value in the charge column.
| if (group_features.empty()) | ||
| { | ||
| // Identification-only row: nothing was quantified in this run, so there is nothing to | ||
| // count. Null is the honest answer, distinct from a genuine zero. | ||
| (void)peptide_counts_builder.AppendNull(); | ||
| (void)feature_counts_builder.AppendNull(); | ||
| } | ||
| else | ||
| { | ||
| std::set<std::string> unique_sequences; | ||
| std::set<std::pair<std::string, int>> unique_features; | ||
| for (Size fi : group_features) | ||
| { | ||
| if (!feature_info[fi].sequence.empty()) { unique_sequences.insert(feature_info[fi].sequence); } | ||
| unique_features.emplace(feature_info[fi].peptidoform, feature_info[fi].charge); | ||
| } | ||
| (void)peptide_counts_builder.Append(); | ||
| (void)pc_unique_b->Append(static_cast<int>(unique_sequences.size())); | ||
| (void)pc_total_b->Append(static_cast<int>(group_features.size())); | ||
|
|
||
| // feature_counts - not available | ||
| (void)feature_counts_builder.AppendNull(); | ||
| (void)feature_counts_builder.Append(); | ||
| (void)fc_unique_b->Append(static_cast<int>(unique_features.size())); | ||
| (void)fc_total_b->Append(static_cast<int>(group_features.size())); | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
peptide_counts.total_sequences is now populated with a feature count, and disagrees with the id-only overload.
Lines 456-462 write group_features.size() into both pc_total_b (peptide_counts.total_sequences) and fc_total_b (feature_counts.total_features), so the two fields are always identical and total_sequences no longer counts sequences. The id-only exportToArrow at Line 1010 fills the same QPX field with the sum of per-protein peptide counts, so the identical column carries different quantities depending on which export path produced the file — consumers joining or comparing pg outputs cannot rely on it.
Either count sequences here (summing the per-accession seqs.size() already computed in the peptides loop, consistent with Line 1010) or document why the ConsensusMap path deliberately diverges.
🐛 Sketch: track the per-accession totals already computed above
(void)peptides_builder.Append();
+ int total_sequences = 0;
for (const auto& acc : group.accessions)
{
@@
(void)pep_count_b->Append(static_cast<int>(seqs.size()));
+ total_sequences += static_cast<int>(seqs.size());
}
@@
(void)peptide_counts_builder.Append();
(void)pc_unique_b->Append(static_cast<int>(unique_sequences.size()));
- (void)pc_total_b->Append(static_cast<int>(group_features.size()));
+ (void)pc_total_b->Append(total_sequences);📝 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.
| if (group_features.empty()) | |
| { | |
| // Identification-only row: nothing was quantified in this run, so there is nothing to | |
| // count. Null is the honest answer, distinct from a genuine zero. | |
| (void)peptide_counts_builder.AppendNull(); | |
| (void)feature_counts_builder.AppendNull(); | |
| } | |
| else | |
| { | |
| std::set<std::string> unique_sequences; | |
| std::set<std::pair<std::string, int>> unique_features; | |
| for (Size fi : group_features) | |
| { | |
| if (!feature_info[fi].sequence.empty()) { unique_sequences.insert(feature_info[fi].sequence); } | |
| unique_features.emplace(feature_info[fi].peptidoform, feature_info[fi].charge); | |
| } | |
| (void)peptide_counts_builder.Append(); | |
| (void)pc_unique_b->Append(static_cast<int>(unique_sequences.size())); | |
| (void)pc_total_b->Append(static_cast<int>(group_features.size())); | |
| // feature_counts - not available | |
| (void)feature_counts_builder.AppendNull(); | |
| (void)feature_counts_builder.Append(); | |
| (void)fc_unique_b->Append(static_cast<int>(unique_features.size())); | |
| (void)fc_total_b->Append(static_cast<int>(group_features.size())); | |
| } | |
| if (group_features.empty()) | |
| { | |
| // Identification-only row: nothing was quantified in this run, so there is nothing to | |
| // count. Null is the honest answer, distinct from a genuine zero. | |
| (void)peptide_counts_builder.AppendNull(); | |
| (void)feature_counts_builder.AppendNull(); | |
| } | |
| else | |
| { | |
| std::set<std::string> unique_sequences; | |
| std::set<std::pair<std::string, int>> unique_features; | |
| for (Size fi : group_features) | |
| { | |
| if (!feature_info[fi].sequence.empty()) { unique_sequences.insert(feature_info[fi].sequence); } | |
| unique_features.emplace(feature_info[fi].peptidoform, feature_info[fi].charge); | |
| } | |
| (void)peptide_counts_builder.Append(); | |
| (void)pc_unique_b->Append(static_cast<int>(unique_sequences.size())); | |
| (void)pc_total_b->Append(total_sequences); | |
| (void)feature_counts_builder.Append(); | |
| (void)fc_unique_b->Append(static_cast<int>(unique_features.size())); | |
| (void)fc_total_b->Append(static_cast<int>(group_features.size())); | |
| } |
🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 440 - 463,
Update the ConsensusMap export logic around the peptide-count construction to
populate pc_total_b (peptide_counts.total_sequences) with the total sequence
count, not group_features.size(). Reuse the per-accession sequence totals
computed in the preceding peptides loop, matching the id-only exportToArrow
behavior, while leaving fc_total_b (feature_counts.total_features) based on
group_features.size().
| merged_ok = psm_meta && pg_meta && merged_ok; | ||
| if (psm_meta) | ||
| { | ||
| merged_ok = ArrowIOHelpers::concatenateAndWriteToParquet( | ||
| qpx_psm_tables, out_qpx_dir + "/quantms.psm.parquet", ParquetWriteConfig{}, psm_meta) && merged_ok; | ||
| } | ||
| if (pg_meta) | ||
| { | ||
| merged_ok = ArrowIOHelpers::concatenateAndWriteToParquet( | ||
| qpx_pg_tables, out_qpx_dir + "/quantms.pg.parquet", ParquetWriteConfig{}, pg_meta) && merged_ok; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Stop writing after the first merged-output failure.
If the PSM concatenation fails, merged_ok becomes false, but the PG concatenation still executes at Line 768. This can leave a partial QPX directory. Gate both writes on the prior status and only write PG after PSM succeeds; add a failure-path test.
🤖 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/ProSE.cpp` around lines 760 - 769, Update the merged-output flow
around merged_ok and ArrowIOHelpers::concatenateAndWriteToParquet so the PSM
write runs first and the PG write is attempted only when the prior merged_ok
status remains true. Preserve failure propagation and add a test covering PSM
concatenation failure that verifies PG is not written and the merged output is
reported unsuccessful.
The Arrow schemas already transcribe the bigbio/qpx YAML schemas faithfully, but
the file-level key-value metadata did not match the serialization spec:
- feature.parquet carried NO metadata at all -- neither exportToParquet() nor
exportToParquetStreaming() stamped any.
- file_type used the bare view names ("psm", "pg") where the spec's tokens are
"psm_file", "feature_file", "pg_file".
- compression_format was never written.
- software_provider was the bare string "OpenMS" with no version.
- scan_format was hard-coded to "scan", which is wrong for index=-style native
IDs and meaningless for tables that carry no spectrum references at all.
- ProSE's merged quantms.*.parquet inherited the first per-run file's uuid and
creation_date via plain table concatenation, instead of having an identity.
Introduce ArrowIOHelpers::qpxFileMetadata() as a metadata *factory* rather than a
table wrapper: streaming needs one identity per file, reused for the writer schema
and every batch, so a per-batch wrapper would mint differing uuids and mismatch the
writer schema. It refuses LZ4, which Parquet supports but QPX defines no
compression_format token for.
scan_format is now derived from the spectrum native IDs via
ArrowIOHelpers::qpxScanFormat(). When the IDs disagree, the key is omitted and a
warning logged rather than asserting a token that describes only part of the file;
unrecognized IDs carry no evidence and do not veto an otherwise consistent set.
Because a built table no longer carries native IDs, the table-taking
QPXFile::exportToParquet() overload gained a defaulted scan_format parameter.
Also fixes a latent out-of-bounds in ProteinGroupArrowExport: has_quant checked the
float and string data arrays but not the integer one, while the loop below
dereferences getIntegerDataArrays()[0].
The OpenMS-native Arrow writers (ConsensusMapArrowIO, FeatureMapArrowIO,
ProteinIdentificationArrowIO) are deliberately untouched -- their file_type values
belong to a different format and are not QPX views.
Verified on the regenerated BSA collection: all three views tokened, in-vocabulary
and with distinct uuids. No reference-file churn -- the -out_qpx TOPP tests only
sha256sum for existence, and every FuzzyDiff'd mzTab/consensusXML/idXML comparison
passes untouched.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
#9818 resolves each PSM's run and stems it inline via File::stemName. The label and melt work that follows needs the same reduction in ConsensusMapArrowExport and ProteinGroupArrowExport, so factor it into ArrowIOHelpers::qpxRunFileName() rather than repeating the call and its rationale at each site. This commit originally also carried a per-PSM run resolver and a hard-error preflight on run-name stem collisions. Both are dropped: #9818 landed the same resolution first (and additionally guards a missing id_merge_index, which this version did not), and its warn-and-continue collision policy is the project's choice -- same-named files in different directories are a legitimate layout. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…umbers
intensities[].label is the second documented QPX join key -- the spec matches it
against the unnested run.samples[].label of run.parquet (docs/spec/views.md) -- so
it has to carry a canonical channel token. pg.parquet wrote the raw channel number
("1" for every label-free row), which joins against nothing.
Add ArrowIOHelpers::qpxIntensityLabel(), which maps a ConsensusMap column header to
its label: "LFQ" for label-free, and the method family prefix plus OpenMS' own
reporter name for isobaric channels ("TMT126", "TMT127N", "ITRAQ114"). All plexes
name their channels bare ("126", "127N", ...), so a per-family prefix is sufficient
and no per-plex exception table is needed.
OpenMS' channel names are authoritative: TMT 10-plex channel 10 is "TMT131". qpx's
own converter map is 11-plex-indexed and calls that channel "TMT131N"; that is an
upstream issue (bigbio/qpx#163), not something to encode here. Pinned by a test so
it cannot drift silently.
iTRAQ is spelled uppercase ("ITRAQ114"), consistent with the TMT prefix. qpx's
intensities.md example spells it "iTRAQ114", but no qpx converter actually emits an
iTRAQ channel label -- its channel map is TMT-only and the iTRAQ path passes the raw
tool value through -- so there is no implementation to match, only a doc example.
The lookup is keyed on (run, channel) rather than channel alone, so a map whose runs
used different methods stays correct. A channel whose quantitation method cannot be
identified aborts the export rather than emitting a guessed token: a wrong join key
is worse than a failed write. A channel with no describing column header falls back
to "LFQ" when it is the only channel (label-free by construction) and otherwise
warns loudly, since hand-built or foreign ConsensusMaps can reach this path.
Feature-view labels are deliberately NOT changed here. Collapsing every label-free
entry on a still-wide feature row to "LFQ" would destroy the per-run attribution the
filename currently provides; they change together with the row melt.
Adds class coverage for the isobaric path, which has no TOPP test at all
(IsobaricWorkflow ships none) -- including that the mapping works without
setExperimentType, which IsobaricWorkflow never calls.
145/145 TOPP tests and 10/10 Arrow class tests pass; no reference churn.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
The QPX feature view is defined as "a quantified peptidoform in a specific run file" (docs/spec/feature.md), and pg as "one row per protein group per run" (docs/spec/pg.md). Both were emitted wide. feature.parquet held one row per ConsensusFeature with one intensity per contributing run, so run_file_name was an arbitrary pick among those runs and the intensities were distinguishable only by a non-conformant label. Melt to one row per (ConsensusFeature, run). The coordinate rule is mode-dependent: - label-free: each FeatureHandle carries its own run's RT / m/z / charge, so the row takes its quantitative coordinates from that handle rather than from the consensus centroid. - isobaric: the handles are reporter ions -- m/z is the reporter mass and RT the quantification scan -- while precursor coordinates live on the ConsensusFeature. Keep the consensus values and use the handles only for channel intensities. Taking handle coordinates here would have written a reporter mass into observed_mz. Feature intensity labels move to canonical tokens with the melt, not before it: collapsing them on a wide row would have destroyed the per-run attribution the source file name was accidentally providing. pg.parquet emitted unquantified groups with an empty run_file_name -- a primary-key component the spec says MUST NOT be null, and which quantms silently drops. Melt them onto the runs where the group actually has identification evidence, with null intensities. Evidence comes from the assigned PSMs' features and from unassigned PSMs (resolved through id_merge_index), so a group is never asserted into a run it was not seen in; fanning out across all column headers would have turned 13 unattributed rows into up to 65 fabricated ones. Groups with no evidence anywhere are skipped with a logged count rather than given a null key. peptides, peptide_counts and feature_counts are now populated per (group, run) using quantms semantics -- "unique" means deduplicated, not proteotypic. DIA-NN's converter reads those fields as proteotypic counts, so the numbers are only comparable within quantms-derived collections; noted at the call site. Feature identity now comes from the best-scoring hit across ALL of a feature's identifications instead of pep_ids[0].getHits()[0]. That also repairs a latent bug: a feature whose *first* identification carried no hits lost its identity entirely even when a later one had one. id_run_file_name is resolved from the identification that actually holds the winning hit. This needed a new IDFilter::getBestHit overload reporting the winning identification's index. Note the existing best_id_it is NOT that -- it is the score-type reference and stays pinned to the first non-empty identification -- so the winner is tracked separately. The three-argument form now delegates, keeping one implementation. getBestHit throws on mixed score types (unreachable for our tools, possible for a foreign map), so the caller falls back to the positional pick and warns once rather than failing the export. Consensus features with no handles produce no row: they have neither quantification nor a run to key on. No shipped tool emits them (IsobaricWorkflow filters zero-intensity features at :780), so this is a guard for foreign input. On the BSA collection: feature 39 wide rows -> 60 long rows, one LFQ intensity each; pg 38 -> 40 rows with zero empty run_file_name (was 13). All three views now share one run vocabulary, the primary keys hold, and no required string is empty. 145/145 TOPP tests and 10/10 Arrow class tests pass; no reference churn. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
bigbio/qpx#212 ("de novo peptide sequencing workflows (no database search)", merged 2026-07-29) added `nullable: true` to feature.anchor_protein in both the spec and runtime schemas, keeping `required: true`: anchor_protein: type: string required: true nullable: true doc: "Representative protein; null when no protein mapping was performed" Match it: QPXFeatureSchema declares the field nullable, and a feature with no protein mapping now writes null instead of "". An empty string satisfied the non-nullable column while being neither an accession nor an absence -- exactly the class of value-level defect a schema check cannot see. pg.anchor_protein is untouched: #212 changed only feature.yaml and psm.yaml, so the pg view keeps `required: true` with no nullable, and its non-nullable assertion in QPXFile_test stands. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…lted row Two defects introduced by the feature melt, both invisible to the existing tests because every fixture gave a feature a single identification and identical coordinates. A ConsensusFeature can carry several PSMs. The melt started taking sequence, scores and id_run_file_name from the best-scoring identification while posterior_error_probability, scan and ion_mobility still read pep_ids[0], so one row could report peptide A's identity beside peptide B's acquisition metadata. Bind the winner once and use it for every identification-level column. The mixed-score-type fallback also reverted to pep_ids[0] unconditionally, which reintroduced the empty-first-identification bug the best-hit selection exists to fix; it now falls back to the first identification that actually has a hit. Likewise for coordinates: observed_mz switched to the run's FeatureHandle for label-free rows, but calculated_mz and mass_error_ppm were still computed against the consensus centroid and rt_start/rt_stop against the consensus RT and width. The reported ppm error was therefore measured against an m/z the row does not contain. Resolve the row's coordinate source once -- handle for label-free, consensus for isobaric, whose handles are reporter ions -- and derive charge, observed/calculated m/z, ppm error, RT and the RT bounds from that single binding. Both are covered by new tests: a feature whose better-scoring identification is *not* first, asserting sequence, scan and ion mobility all describe it; and a label-free feature whose handle coordinates differ from the consensus centroid, asserting the ppm error is measured against the m/z the row reports and not against the centroid. Found by an adversarial review of the melt commit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
78a50bf to
45d545b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/FORMAT/QPXFile.cpp (1)
335-341: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winNew hard failure isn't reflected in the documented error contract.
validateMergeIndicesthrowsException::MissingInformation, soexportToArrow,exportPSMsToQPXArrow,exportToParquetandexportToParquetStreamingcan now throw for merged input lackingid_merge_index. The declarations inQPXFile.hstill document onlynullptr/falseerror returns and carry no@throws, so existing callers that only branch on the return value will surface an uncaught exception instead.Add
@throws Exception::MissingInformationto the affected declarations (and mention it in the@returntext).As per coding guidelines: "Exceptions must derive from
Exception::Base; throw with file, line, andOPENMS_PRETTY_FUNCTION, catch by reference, and document possible exceptions."Also applies to: 1505-1507
🤖 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/FORMAT/QPXFile.cpp` around lines 335 - 341, Add the documented exception contract to the declarations of exportToArrow, exportPSMsToQPXArrow, exportToParquet, and exportToParquetStreaming in QPXFile.h: mention that their failure behavior may involve Exception::MissingInformation in the `@return` documentation and add an explicit `@throws` Exception::MissingInformation entry for merged input missing id_merge_index. Keep the existing nullptr/false return descriptions and implementation behavior unchanged.Source: Coding guidelines
🧹 Nitpick comments (1)
src/topp/ProSE.cpp (1)
635-635: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePlace the conditional braces on separate lines.
Proposed formatting fix
- if (!pid.getSpectrumReference().empty()) { spec_refs.push_back(pid.getSpectrumReference()); } + if (!pid.getSpectrumReference().empty()) + { + spec_refs.push_back(pid.getSpectrumReference()); + }As per coding guidelines, C++ braces must be on their own aligned lines.
🤖 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/ProSE.cpp` at line 635, Reformat the conditional in the surrounding ProSE processing code so the opening and closing braces for the getSpectrumReference() check are each placed on separate, properly aligned lines, without changing its behavior.Source: Coding guidelines
🤖 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/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 762-772: In the spectrum-reference export block, guard access to
best_pid with a non-null check rather than only checking !pep_ids.empty().
Update the condition around best_pid->getSpectrumReference() and its metadata
fallback so features with identifications but no peptide hits skip both
dereferences safely.
---
Outside diff comments:
In `@src/openms/source/FORMAT/QPXFile.cpp`:
- Around line 335-341: Add the documented exception contract to the declarations
of exportToArrow, exportPSMsToQPXArrow, exportToParquet, and
exportToParquetStreaming in QPXFile.h: mention that their failure behavior may
involve Exception::MissingInformation in the `@return` documentation and add an
explicit `@throws` Exception::MissingInformation entry for merged input missing
id_merge_index. Keep the existing nullptr/false return descriptions and
implementation behavior unchanged.
---
Nitpick comments:
In `@src/topp/ProSE.cpp`:
- Line 635: Reformat the conditional in the surrounding ProSE processing code so
the opening and closing braces for the getSpectrumReference() check are each
placed on separate, properly aligned lines, without changing its behavior.
🪄 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 Plus
Run ID: afeb2d98-7a1b-4d53-99e8-601ee9b62301
📒 Files selected for processing (13)
src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.hsrc/openms/include/OpenMS/FORMAT/QPXFile.hsrc/openms/include/OpenMS/PROCESSING/ID/IDFilter.hsrc/openms/source/FORMAT/ArrowIOHelpers.cppsrc/openms/source/FORMAT/ArrowSchemaRegistry.cppsrc/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/openms/source/FORMAT/ProteinGroupArrowExport.cppsrc/openms/source/FORMAT/QPXFile.cppsrc/tests/class_tests/openms/source/ArrowIOHelpers_test.cppsrc/tests/class_tests/openms/source/ArrowSchemaRegistry_test.cppsrc/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cppsrc/tests/class_tests/openms/source/QPXFile_test.cppsrc/topp/ProSE.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
- src/openms/source/FORMAT/ArrowSchemaRegistry.cpp
- src/openms/include/OpenMS/FORMAT/QPXFile.h
- src/openms/include/OpenMS/PROCESSING/ID/IDFilter.h
- src/tests/class_tests/openms/source/ArrowSchemaRegistry_test.cpp
… dead one Two CI failures, both introduced by this branch. Doxygen_Warning_test failed on every platform: the `metadata` parameter added to ArrowIOHelpers::concatenateAndWriteToParquet() was never documented, and the gate treats an undocumented parameter as an error. It only skips lines containing "Consider increasing DOT_GRAPH_MAX_NODES" (Doxygen_Warning_Checker.cpp:44), so nothing else absorbed it. This does not reproduce locally without graphviz: without HAVE_DOT, doxygen emits "ignoring \dot command" warnings that the gate also counts, so the test fails for an unrelated reason and masks whether a real warning was added. Verified by running the doc target and confirming the metadata warning is gone, leaving only the two HAVE_DOT lines. Also removes `distinct_peptides_for_run` from the pg emitRow lambda. It became dead when the peptide/feature counts moved to the per-(group, run) evidence index, and was raising -Wunused-parameter. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/FORMAT/ProteinGroupArrowExport.cpp (1)
537-561: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winReject inconsistent quantification arrays instead of silently truncating them.
has_quantonly checks that the three lockstep arrays exist; the loop then usesmin(filenames, abundances, channels), so empty abundances make a quantified group emit no row, and mismatched lengths silently drop intensity/filename/channel data. Validate equal lengths before grouping/intensity emission, and add coverage for malformed lockset arrays.🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 537 - 561, Update the quantification handling around has_quant and the grouping loop to require equal lengths for filenames, abundances, and channels before emitting rows. Reject or skip inconsistent lockstep arrays explicitly rather than iterating to the shortest array; preserve normal grouping for valid data and add coverage for empty or mismatched quantification arrays.Source: Coding guidelines
🧹 Nitpick comments (2)
src/openms/source/FORMAT/ProteinGroupArrowExport.cpp (2)
58-156: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueApply the repository’s C++ formatting and logging conventions.
The changed blocks use same-line braces and
std::endl; use braces on their own aligned lines and prefer'\n'for OpenMS logging.As per coding guidelines, C++ requires aligned braces and OpenMS logging should prefer
\noverstd::endl.Also applies to: 401-467, 496-585, 680-687, 727-729
🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 58 - 156, Apply OpenMS C++ style throughout the changed blocks, including the shown code and the referenced ranges: place opening braces on their own aligned lines instead of same-line braces, and replace OpenMS logging uses of std::endl with '\n'. Preserve the existing control flow and log content.Source: Coding guidelines
717-719: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSynchronize the public metadata documentation.
The public header still documents
file_type="pg", but this implementation stampsfile_type="pg_file". Update the header and related documentation/tests to describe the actual contract.As per coding guidelines, I/O contract changes must update relevant documentation.
🤖 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/FORMAT/ProteinGroupArrowExport.cpp` around lines 717 - 719, Synchronize the public metadata contract with the implementation used by the ProteinGroupArrowExport overload: update the public header and related documentation/tests to state that file_type is "pg_file" instead of "pg". Locate the declarations and assertions associated with QPXPgSchema and ProteinGroupArrowExport, preserving all other metadata behavior.Source: Coding guidelines
🤖 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/openms/source/FORMAT/ProteinGroupArrowExport.cpp`:
- Around line 537-561: Update the quantification handling around has_quant and
the grouping loop to require equal lengths for filenames, abundances, and
channels before emitting rows. Reject or skip inconsistent lockstep arrays
explicitly rather than iterating to the shortest array; preserve normal grouping
for valid data and add coverage for empty or mismatched quantification arrays.
---
Nitpick comments:
In `@src/openms/source/FORMAT/ProteinGroupArrowExport.cpp`:
- Around line 58-156: Apply OpenMS C++ style throughout the changed blocks,
including the shown code and the referenced ranges: place opening braces on
their own aligned lines instead of same-line braces, and replace OpenMS logging
uses of std::endl with '\n'. Preserve the existing control flow and log content.
- Around line 717-719: Synchronize the public metadata contract with the
implementation used by the ProteinGroupArrowExport overload: update the public
header and related documentation/tests to state that file_type is "pg_file"
instead of "pg". Locate the declarations and assertions associated with
QPXPgSchema and ProteinGroupArrowExport, preserving all other metadata behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8b149940-1da4-4b54-ac2d-08b164c293a2
📒 Files selected for processing (2)
src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.hsrc/openms/source/FORMAT/ProteinGroupArrowExport.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- src/openms/include/OpenMS/FORMAT/ArrowIOHelpers.h
Reverts the IDFilter::getBestHit overload added earlier in this branch and moves the selection into ConsensusMapArrowExport as selectFeatureIdentity(). The overload had exactly one caller and could not absorb the existing hand-rolled variants (MapAlignmentAlgorithmIdentification::getBestScoringHit is protected, works within a single identification and returns a pointer; MzTab aggregates scores with different tie-breaking; QTClusterFinder's is a threshold filter, not a selection), so it was public API in a widely-included header with no second user. Score comparison is not duplicated -- the local version delegates to PeptideIdentification::getScoreComparator, the same primitive those sites use -- and mixed score types are now detected directly instead of via a thrown exception used for control flow. Also from a quality review of the melt: The run name and intensity label are now derived once per column header into FeatureIdLookups instead of once per FeatureHandle per row. Both are pure functions of the header, of which there are at most a few dozen, while the export loop touches them per handle per row. File::stemName() scans a 73-entry file-type table, and reading channel_name by string takes the MetaInfoRegistry omp-critical lock -- which buildFeatureTableRange goes out of its way to keep out of the loop for exactly this reason (see the pre-resolved metavalue index block), and which the label lookup had reintroduced inside the parallel batch build. Isobaric detection no longer relies solely on sniffing channel_name. A map counts as isobaric if it declares a labelled experiment type OR annotates channels: neither signal alone is reliable, since IsobaricWorkflow annotates channels without ever calling setExperimentType, while ConsensusMapArrowExport_test's own TMT fixture declares "labeled_MS2" with no channel_name. Getting this wrong writes reporter-ion m/z into observed_mz. The sibling pg exporter already trusted the experiment type, so the two views now agree on how the question is answered. qpxIntensityLabel()'s contract that callers must handle an empty result is now honoured: a channel whose quantitation method cannot be identified fails the export rather than writing an empty string into a documented join key, matching what the pg exporter already did. The family prefix is derived from the method's canonical identifier instead of a nine-case switch whose default silently returned "" -- a dropped join key -- for any method added later. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
There was a problem hiding this comment.
♻️ Duplicate comments (2)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (2)
471-478: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winEmpty
run_file_namekey still reachable —run_nameisn't checked before grouping.
id_lut.run_columnsis populated unconditionally for every column header (including ones with an emptyfilename, whichqpxRunFileName("")maps to""). The grouping loop keysby_runonit->second.run_namewith no emptiness check, so a header without a filename still produces a row withrun_file_name = ""— a non-nullable primary-key component joined across psm/feature/pg views. This is the same defect flagged on a prior revision of this exporter and does not appear to have been fixed here.🛠️ Guard on empty run_name
auto it = id_lut.run_columns.find(fh.getMapIndex()); if (it == id_lut.run_columns.end()) { continue; } - by_run[it->second.run_name].push_back(&fh); + if (it->second.run_name.empty()) { continue; } // unnamed source run cannot key a QPX row + by_run[it->second.run_name].push_back(&fh);🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 471 - 478, Update the grouping loop in the feature export path to skip entries whose resolved run_columns value has an empty run_name before inserting into by_run. Preserve the existing missing-map-index guard and only group features with non-empty run names.
839-850: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winNull dereference:
best_pidcan be null whilepep_idsis non-empty.The guard is
if (!pep_ids.empty()), butbest_pidis only non-null whenhas_idis true (selectFeatureIdentityreturnsnullptrwhenever every identification inpep_idshas empty hits — itcontinues past hitless ids rather than making the list appear empty). A feature whose identifications all carry zero hits leavespep_idsnon-empty butbest_pid == nullptr, andbest_pid->getSpectrumReference()at line 845 dereferences null. Every otherbest_piduse in this function (e.g. theion_mobilityandid_run_file_nameblocks) correctly guards onbest_piditself — this block is the outlier.🐛 Guard on `best_pid` instead of `pep_ids`
std::string spec_ref; - if (!pep_ids.empty()) + if (best_pid) { // Prefer the dedicated member, fall back to metavalue spec_ref = best_pid->getSpectrumReference(); if (spec_ref.empty() && metaHas(*best_pid, idx_spectrum_reference)) { spec_ref = best_pid->getMetaValue(idx_spectrum_reference).toString(); } }🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 839 - 850, Update the scan block’s guard to check best_pid before calling getSpectrumReference() or accessing its metadata, matching the existing guards in the ion_mobility and id_run_file_name blocks; retain the current behavior for valid selected identifications.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
152-155: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueNew logging calls use
std::endlinstead of\n.Both newly-added
OPENMS_LOG_ERROR/OPENMS_LOG_WARNcalls terminate with<< std::endl;, which forces a stream flush on every call.♻️ Use `\n`
OPENMS_LOG_ERROR << "ConsensusMapArrowExport: column header '" << header.label << "' names channel '" << channel_name << "' whose quantitation method " "cannot be identified, so no QPX intensity label can be derived for it." - << std::endl; + << "\n"; ... OPENMS_LOG_WARN << "ConsensusMapArrowExport: consensus feature carries identifications with " "different score types, whose scores are not comparable; using the first " - "hit found instead of the best-scoring one." << std::endl; + "hit found instead of the best-scoring one." << "\n";As per path instructions for
src/**/*.cpp: "Use OpenMS logging macros andOpenMS::LogStream; do not write directly tostd::coutorstd::cerr. Prefer\noverstd::endl."Also applies to: 580-582
🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 152 - 155, Update the newly added OPENMS_LOG_ERROR and OPENMS_LOG_WARN calls in the ConsensusMapArrowExport logging code to terminate with "\n" instead of std::endl, preserving the existing messages and OpenMS logging macros.Source: Path instructions
🤖 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.
Duplicate comments:
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 471-478: Update the grouping loop in the feature export path to
skip entries whose resolved run_columns value has an empty run_name before
inserting into by_run. Preserve the existing missing-map-index guard and only
group features with non-empty run names.
- Around line 839-850: Update the scan block’s guard to check best_pid before
calling getSpectrumReference() or accessing its metadata, matching the existing
guards in the ion_mobility and id_run_file_name blocks; retain the current
behavior for valid selected identifications.
---
Nitpick comments:
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 152-155: Update the newly added OPENMS_LOG_ERROR and
OPENMS_LOG_WARN calls in the ConsensusMapArrowExport logging code to terminate
with "\n" instead of std::endl, preserving the existing messages and OpenMS
logging macros.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1245d33e-81fd-431d-9bb6-5bc0ec616289
📒 Files selected for processing (3)
src/openms/source/FORMAT/ArrowIOHelpers.cppsrc/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/tests/class_tests/openms/source/QPXFile_test.cpp
…lapsed rows Two defects from an adversarial review of the melt. A consensus feature can hold PeptideIdentification objects that are all hitless. The scan column guarded on !pep_ids.empty() and then dereferenced the selected identification, which is null in exactly that case -- a crash, introduced when the identification-level columns were rebound from pep_ids[0] to the winner. Guard on the selected identification instead. The melt grouped rows by the already-stemmed run name, so two runs whose paths differ only in directory (/frac_a/run1.mzML, /frac_b/run1.mzML -- the routine fractionated layout) were merged into ONE row carrying both runs' intensities. That is worse than the ambiguous-but-separate rows #9818 warns about: it fuses records rather than making a key ambiguous. Group by the source path and emit the stem only as the output value. Channels of one isobaric run share ColumnHeader::filename, so they still group into a single row, which is the intent. Both are covered by new tests: a feature whose identifications are all hitless, and two column headers sharing a stem asserted to produce two rows with one intensity each. Also records, without changing it, that explicit rt_start/rt_stop metavalues are authored on the ConsensusFeature and so are inherited unchanged by melted per-run rows. Where the handle RT diverges from the consensus RT that window does not bracket the row's own RT. Overriding an authored value is a semantic change beyond this PR, and existing coverage pins the current behaviour; the width fallback does use the row's own coordinates. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
1217-1225: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDerive
scan_formatfrom the same fallback used for exported scans.Row construction accepts
spectrum_referencefrom aPeptideIdentificationmetavalue, but file metadata ignores it. A file can therefore export scan values without the correspondingscan_formatmetadata. Include the fallback for assigned and unassigned IDs and add a Parquet metadata regression.Proposed fix
- if (!pid.getSpectrumReference().empty()) { refs.push_back(pid.getSpectrumReference()); } + std::string ref = pid.getSpectrumReference(); + if (ref.empty() && pid.metaValueExists("spectrum_reference")) + { + ref = pid.getMetaValue("spectrum_reference").toString(); + } + if (!ref.empty()) + { + refs.push_back(std::move(ref)); + }🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 1217 - 1225, Update the scan_format metadata derivation in the export logic to reuse the same spectrum-reference fallback used by row construction, including references from both assigned peptide identifications and unassigned peptide identifications. Ensure exported files always include scan_format when scan values come from a PeptideIdentification metavalue, and add a Parquet regression test covering this case.
🧹 Nitpick comments (1)
src/openms/source/FORMAT/ConsensusMapArrowExport.cpp (1)
481-485: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the required multi-line block layout.
Lines 482 and 485 use single-line braced blocks, contrary to the C++ formatting rule.
Proposed fix
- if (it == id_lut.run_columns.end()) { continue; } + if (it == id_lut.run_columns.end()) + { + continue; + } by_source[it->second.source].push_back(&fh); } - if (by_source.empty()) { ++dropped_handleless; continue; } + if (by_source.empty()) + { + ++dropped_handleless; + continue; + }As per coding guidelines, C++ blocks must use braces on their own aligned lines.
🤖 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/FORMAT/ConsensusMapArrowExport.cpp` around lines 481 - 485, Update the control-flow blocks in the handle-grouping logic around id_lut.run_columns and by_source.empty() to use the required multi-line brace layout, placing opening and closing braces on their own aligned lines while preserving the existing continue behavior.Source: Coding guidelines
🤖 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/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 1217-1225: Update the scan_format metadata derivation in the
export logic to reuse the same spectrum-reference fallback used by row
construction, including references from both assigned peptide identifications
and unassigned peptide identifications. Ensure exported files always include
scan_format when scan values come from a PeptideIdentification metavalue, and
add a Parquet regression test covering this case.
---
Nitpick comments:
In `@src/openms/source/FORMAT/ConsensusMapArrowExport.cpp`:
- Around line 481-485: Update the control-flow blocks in the handle-grouping
logic around id_lut.run_columns and by_source.empty() to use the required
multi-line brace layout, placing opening and closing braces on their own aligned
lines while preserving the existing continue behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a84db887-0f2f-44d4-bf00-774a53ca9fa9
📒 Files selected for processing (2)
src/openms/source/FORMAT/ConsensusMapArrowExport.cppsrc/tests/class_tests/openms/source/ConsensusMapArrowExport_test.cpp
…ure and pg #9818 established the policy for source paths that collapse onto one run_file_name: warn and continue, because same-named files in different directories are a legitimate layout and only the spec's representation cannot express the distinction. That warning lived solely in the PSM exporter, so feature and pg hit the same condition silently even though they derive the same key. Lift it into ArrowIOHelpers::qpxWarnOnRunNameCollisions() and call it from all three views, so one collection reports the ambiguity once per exporter rather than once, and the policy has a single definition instead of being restated per view. The feature melt now groups rows by source path rather than by stem, so an ambiguous key is reported but the rows themselves stay separate -- the warning describes a key that cannot be told apart, never records that were merged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
selectFeatureIdentity() built a comparator from each identification's own isHigherScoreBetter(), so a feature whose identifications disagreed on orientation was compared in two directions within a single selection and the winner depended on identification order. It also carried a fallback that, on a score-type mismatch, kept the best of the already-scanned prefix while the warning claimed it was using the first hit found -- code and message disagreeing. Take the orientation from the first identification that has a hit and use that one comparator throughout. The winner is now well defined and order-independent. The fallback is removed rather than corrected. Identifications that disagree on score type or orientation are a pipeline defect, not a case to recover from: scores of different types are not comparable, harmonizing them is an explicit step (IDScoreSwitcher / IDScoreSwitcherAlgorithm, which ProteomicsLFQ, Epifany and FalseDiscoveryRate all run), and IDFilter::getBestHit -- the codebase's shared primitive -- throws outright on the same condition, with no caller catching it. The export now warns and proceeds with the reference orientation instead of inventing a recovery that would turn a broken input into an arbitrary answer. Throwing was considered and rejected: it would fail exports the tool previously accepted. Tests: identifications declaring the same score type with contradictory orientations, asserted from both orderings, so a reintroduced per-identification comparator changes an answer; and a leading hitless identification, which the original positional pick silently discarded the feature's identity for. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
The pg view attributes a feature to ONE peptide: its sequence, peptidoform and charge feed peptides[], peptide_counts and feature_counts. The evidence index stored one identity per ConsensusFeature -- taken from the first identification with hits -- while attaching evidence from EVERY identification, so an accession contributed by peptide B was counted using peptide A's identity. It also mis-set unique_sequences and unique_features whenever two features reported different first identifications. Exclude features whose identifications disagree on the top peptide, warning once with the count. This matches what quantification already does: ProteinQuantifier documents that "only features/feature groups with unambiguous peptide annotation are used for peptide quantification", so the counts now agree with the abundances in the same export. ProteomicsLFQ and IsobaricWorkflow already satisfy the condition -- the former resolves conflicts, the latter builds one identification per feature. Uses the existing BaseFeature::getAnnotationState() rather than a new predicate. An earlier version of this change added BaseFeature::hasSingleIdentification(), which was wrong three ways: it duplicated AnnotationState; it inspected only the legacy peptides_ container, ignoring id_matches_; and it rejected FEATURE_ID_MULTIPLE_SAME -- several identifications agreeing on the same modified sequence, which is the deliberate output of IDConflictResolverAlgorithm::resolve(.., keep_matching=true) as called by ProteomicsLFQ. Only FEATURE_ID_MULTIPLE_DIVERGENT is a real conflict, the same distinction PeptideAndProteinQuant and MzTab already make. Also fixes an unterminated START_SECTION: an apostrophe in a section title opens a character literal and swallows the rest of the file, so the two identity-selection tests added earlier never compiled. They pass now. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…re and pg views The QPX feature and pg views record ONE peptide per feature -- singular sequence, peptidoform and charge, and no ConsensusFeature identifier linking alternatives. A feature whose identifications disagree on the top peptide cannot be represented: the feature view published a chosen interpretation while silently discarding the others, and the pg view counted evidence contributed by one peptide under another's identity. Make that a contract instead of a silent projection. ConsensusMapArrowExport:: requireUnambiguousIdentities() throws IllegalArgument on FEATURE_ID_MULTIPLE_DIVERGENT, naming the offending feature and the three resolvers, and is called by both the feature and pg exporters. It replaces the warn-and-skip added in the previous commit, which left the feature view publishing what the pg view refused. Ambiguity-preserving output already has a home: consensusparquet (ConsensusMapArrowIO) keeps every hit and the consensus feature association, and IDConflictResolver accepts it as input. So this is not "QPX loses a permissive mode" -- QPX never had one; its schema cannot express the ambiguity, and pretending otherwise produced a lossy projection wearing the name of an intermediate format. Several identifications agreeing on the same modified sequence (FEATURE_ID_MULTIPLE_SAME) remain accepted -- that is the deliberate output of IDConflictResolverAlgorithm::resolve() with keep_matching, which ProteomicsLFQ uses. The check is a PREFLIGHT, deliberately: buildFeatureTableRange() runs inside an OpenMP region whose worker catch-all would flatten an exception into a boolean, and an exception escaping such a region is std::terminate. It therefore runs before the parallel build and before the output file is opened, matching the merged-run validation #9818 established. Impact is narrow: ProteomicsLFQ resolves conflicts, IsobaricWorkflow builds one identification per feature, ProSE uses the id-only overload. Only ProteinQuantifier fed an unresolved consensusXML is affected, and its own documentation already states that such features are excluded from quantification. Two tests needed rework because their scenarios are now unreachable. The identification-coherence test gives both identifications the same peptide with different acquisition metadata, asserting scan and ion mobility come from the same one. The score orientation test is removed, with a note: observing which of two identifications won required them to name different peptides, which the contract now rejects. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…n QPX write failure ProteinQuantifier was the only shipped path that could trip the QPX feature/pg identity contract, because it is the only one that neither resolves ID conflicts nor builds one identification per feature. It does not need to. Such features already contribute nothing: PeptideAndProteinQuant::getAnnotation_() returns an empty PeptideHit when the top sequences disagree (PeptideAndProteinQuant.cpp:104-107), so they are absent from every abundance the tool computes -- which is what the tool's own documentation has always said. Remove them after loading and warn with the count, naming the three resolvers. That makes the exclusion explicit rather than implicit, and keeps a QPX export describing exactly the features that produced the intensities in the same run. Exporting them would have published protein-level evidence for features absent from every abundance; failing the export would have rejected input the tool otherwise handles. Filtering is unconditional rather than gated on -out_qpx: since the features are already ignored, removing them cannot change a result, and a conditional would add a branch with no observable effect outside QPX. Verified -- all 43 ProteinQuantifier TOPP tests pass unchanged. With this, every in-tree caller establishes the contract (ProteomicsLFQ resolves, IsobaricWorkflow builds one identification per feature, ProteinQuantifier filters), so requireUnambiguousIdentities() is an invariant assertion rather than something a user can trip. Also makes a failed QPX write abort. All three exports logged the error and continued, so a partial collection was left behind with a zero exit code -- indistinguishable from success. The enclosing helper returns ExperimentalDesign, so this throws UnableToCreateFile rather than returning an exit code. 153/153 TOPP tests and 11/11 Arrow class tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…tion The requireUnambiguousIdentities() declaration was inserted between exportToArrow()'s doc block and exportToArrow() itself, so both blocks attached to requireUnambiguousIdentities -- each documenting @PARAM cmap -- and exportToArrow was left undocumented. Doxygen reports this as ConsensusMapArrowExport.h:54: warning: argument 'cmap' from the argument list of OpenMS::ConsensusMapArrowExport::requireUnambiguousIdentities has multiple @PARAM documentation sections which failed Doxygen_Warning_test on all five CI platforms. Move the new declaration below exportToArrow so each block documents its own function. Comment placement only; no API or behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
…9835, #9836 (#9841) Backfills the QPX export spec-conformance series, the macOS PKG notarization fix, and the Windows GUI DLL export fix that merged into develop without changelog entries. #9805 and #9821 were intentionally skipped (test-only / comment-only, no user-visible behavior change), and #9818 was already documented. Claude-Session: https://claude.ai/code/session_0118Yt3TZEMzhMhH6FwZPDVt Co-authored-by: Claude <[email protected]>
Backfills CHANGELOG entries for three merged PRs not yet covered by the recent #9826 backfill: the QPX feature/pg export spec-conformance fix, the macOS installer notarization fix, and the Windows GUI DLL export fix for Annotation1DItem. Claude-Session: https://claude.ai/code/session_01RSKvhJ2dEd2zE4dohdv8af Co-authored-by: Claude <[email protected]>
Two independent backfill commits (#9833 and #9841) each added an entry for these three PRs, so every one of them was listed twice with slightly different wording. Kept the more detailed version from #9841 and dropped the duplicate. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016kxG5jpwHZaYGfrhU2wLHg
Continues the bigbio/qpx conformance work that #9818 started. That PR fixed
run_file_name— per-PSM resolution and stemming. This one does not re-implement run resolution; it was rebased onto #9818 and defers to it, extending its warn-on-stem-collision policy to the two views it did not cover.What remains wrong after #9818, and what this PR fixes:
developtodayfeature.parquetfile metadatafeature.parquetintensities[].label.mzMLpathLFQ/TMT126pg.parquetintensities[].label"1"— the raw channel numberLFQ/TMT126pg.parquetrun_file_namefile_typemetadatapsm/pgpsm_file/feature_file/pg_filecompression_formatscan_format"scan"feature.anchor_proteinquantms.*.parquetuuid/creation_datescan_formatMeasurements are from
OpenMS-build/src/tests/topp/tmp_path/BSA_qpx_dir/, produced by the existingTOPP_ProteomicsLFQ_qpxtest over 5 BSA fraction mzMLs.The three structural changes
1. Row shape. The spec defines both views as long — feature as "a quantified peptidoform in a specific run file" (
docs/spec/feature.md), pg as "one row per protein group per run" (docs/spec/pg.md). Both were wide.feature.parquetheld one row per ConsensusFeature with one intensity per contributing run, sorun_file_namewas an arbitrary pick among those runs. It now melts to one row per (ConsensusFeature, run): 39 rows → 60, each with a singleLFQintensity.The melt groups on the source path, not on the stemmed run name. Grouping on the stem would actively fuse
/frac_a/run1.mzMLand/frac_b/run1.mzMLinto one row — the exact layout that makes stem collisions worth warning about in the first place.The coordinate rule is mode-dependent and that matters:
FeatureHandlecarries its own run's RT / m/z / charge, so the row takes its quantitative coordinates from that handle.observed_mz.2. pg unquantified groups. These were emitted with an empty
run_file_name— a primary-key component the spec says MUST NOT be null, and which quantms'pg_adaptersilently drops. They now melt onto the runs where the group actually has identification evidence (assigned PSMs' features, plus unassigned PSMs resolved throughid_merge_index), with null intensities. Fanning out across all column headers instead would have turned 13 unattributed rows into up to 65 asserting observations that were never made.peptides,peptide_countsandfeature_countsare populated per (group, run) using quantms semantics.3. One peptide per feature is now a contract, not an assumption. The QPX feature and pg views have singular
sequence/peptidoform/chargeand no ConsensusFeature identifier. A feature whose identifications disagree on the top peptide therefore cannot be represented: exporting it publishes one chosen interpretation and silently discards the alternatives, and the pg view counts evidence contributed by one peptide under another's identity.ConsensusMapArrowExport::requireUnambiguousIdentities()rejects that input (Exception::IllegalArgument), reusing the existingBaseFeature::AnnotationStaterather than adding a predicate. Several identifications agreeing on the same modified sequence (FEATURE_ID_MULTIPLE_SAME) are unambiguous and accepted — that is the deliberate output ofIDConflictResolverAlgorithm::resolve()withkeep_matching, whichProteomicsLFQuses.It runs as a preflight: single-threaded, before any OpenMP region and before the output file is opened. An exception escaping the parallel batch build would be flattened into a boolean by the worker's catch-all, and one escaping the region at all is
std::terminate.No shipped pipeline can trip it, and that is deliberate rather than lucky — every in-tree caller now establishes the contract:
ProteomicsLFQresolves conflicts,IsobaricWorkflowconstructs one identification per feature, andProteinQuantifierfilters (below). The ambiguity-preserving representation remains the OpenMS-nativeconsensusparquet, which keeps every hit, and whichIDConflictResolveraccepts as input.Decisions worth a reviewer's attention
The channel vocabulary is no longer a judgement call. It was ratified upstream mid-review, in
sdrf-pipelines'channel_map.yaml(fix(openms): standardize channel labels bigbio/sdrf-pipelines#314), which confirms both choices this PR made from SDRF evidence:tmt10plexchannel 10 isTMT131, notTMT131N, and iTRAQ is uppercase (ITRAQ114). It also settles the LFQ join by makingLFQcanonical withlabel free sampleas a synonym.We derive the label as family prefix + OpenMS' own reporter name, not from an ordinal table. That is what makes it correct: it matches
channel_map.yamlexactly for all eleven OpenMS isobaric methods, including TMT6plex (TMT127, where quantms' ordinal map saysTMT127N), iTRAQ8plex's non-contiguousITRAQ121, and TMT32/35plex'sTMT127D/TMT134CD. An ordinal table would have had to be re-derived per plex and would silently mislabel any method added later.Three hard failures, all on join or primary keys, where a guessed value is worse than a refused write: an unidentifiable isobaric quantitation method, LZ4 (for which qpx defines no
compression_formattoken), and divergent feature identities.Best-hit selection is local, and deliberately so. An earlier revision added an
IDFilter::getBestHitoverload; that was withdrawn.IDFilteris now untouched.IDFilter::getBestHitreports only the hit, and its internal "best" iterator is the score-type reference, not the winner — while the feature view needs the winner's parent to resolveid_run_file_name. Exposing that meant new public API in a widely-included header for one caller. Score comparison itself is not duplicated: it delegates toPeptideIdentification::getScoreComparator, the same primitiveIDFilterandMapAlignmentAlgorithmIdentificationuse.One score orientation per feature. Comparison uses the orientation of the first identification that has a hit. Using each identification's own would compare in different directions within a single selection and make the winner depend on identification order. Identifications disagreeing on score type or orientation warn once and proceed with that reference — harmonizing them is an explicit pipeline step (
IDScoreSwitcher), andIDFilter::getBestHitthrows outright on the same condition. There is no fall back topep_ids[0]: an earlier revision had one, and it reintroduced the empty-first-identification bug that best-hit selection exists to fix.A latent out-of-bounds is fixed in
ProteinGroupArrowExport:has_quantchecked the float and string data arrays but not the integer one it then dereferences.Behaviour changes for consumers
ConsensusFeaturewith noFeatureHandles produces no row — it has neither quantification nor a run to key on. No shipped tool emits them (IsobaricWorkflowfilters zero-intensity features at:780); this is a guard for foreign input.ProteinQuantifierdrops features whose identifications disagree on the top sequence, with a warning naming the three resolvers (IDConflictResolver,ConsensusIDwithalgorithm=best,FileFilter -id:keep_best_score_id). It is the only shipped path that neither resolves conflicts nor builds one identification per feature. The filter is unconditional, not gated on-out_qpx, because those features already contribute nothing:PeptideAndProteinQuant::getAnnotation_()returns an emptyPeptideHitwhen the top sequences disagree, so they are absent from every abundance the tool computes. This makes an existing implicit exclusion explicit — and it is verified rather than reasoned: all 43 ProteinQuantifier TOPP tests pass byte-identically.ProteinQuantifiernow aborts on a QPX write failure instead of logging and continuing. All three writes previously left a partial collection behind with a zero exit code, which is indistinguishable from success.Verification
ProteomicsLFQ,ProSE,ProteinQuantifier,IsobaricAnalyzer) and 27/27 Arrow/QPX/Parquet class tests, including [FIX] QPX export: resolve run_file_name per PSM and drop path/extension (#9816) #9818'sProteinGroupArrowExport_test.-out_qpxTOPP tests onlysha256sumfor existence, and output is not byte-reproducible anyway (freshuuid/creation_date).scan_formatderivation; label mapping including the TMT10 case; LZ4 rejection; and a joinability test asserting all three views share one run vocabulary.qpxc validateis not a meaningful gate here — it downgrades null and duplicate-PK violations to warnings andis_validignores warnings, which is precisely why these defects survived.Review history
Adversarial review of the melt caught two defects the tests could not, because every fixture gave a feature one identification and identical coordinates:
scan/ion_mobility/PEP still frompep_ids[0].observed_mzfrom the handle, butcalculated_mzandmass_error_ppmcomputed against the consensus centroid.A later pass found the melt grouping on the stemmed run name (fusing same-stem runs) and a null dereference on all-hitless features. Each is fixed with a regression test.
Against #9817
sdrf-pipelines(above), and it agrees with what this PR emits. fix(qpx): canonical channel labels for QuantMS TMT/iTRAQ/LFQ (both QPX paths) bigbio/qpx#215 added downstream relabeling of OpenMS-out_qpxoutput as an explicitly temporary bridge, citing this issue as the source fix — that bridge can be dropped for output produced by this PR.-out_qpxtools use, now attributes unquantified groups by evidence, retiring the empty-run_file_nameoption. The id-only overload is untouched by this PR and still takesrun_paths[0]; the cross-run dedup question the issue leaves open is likewise untouched.importFromArrowshell branch.Known and not addressed here
pg.parquetstill invents a label wherefeature.parquetnow refuses to: an underivable channel falls back to"LFQ"for channel 1 and to the channel number otherwise, with a warning. It should adopt the feature view's refusal — the clearest remaining inconsistency now that strictness is the rule elsewhere.id_merge_indexvalidation, so a merged-run identification with a missing index can still resolve to run 0.is_isobaric, or fail the export over a channel no feature references.batch_size, which counts input features while each now expands to one row per run. Worth fixing before very large collections; it does not affect correctness.run_file_name/anchor_proteinare non-nullable, but an empty string is not null, so""satisfies Arrow while violating the spec.channel_map.yamldefinesSILAC light/SILAC medium/SILAC heavy. Reachable only viaProteinQuantifieron a multiplex consensusXML.additional_intensitiesempty-list vs null inconsistency between quantified and id-only pg rows.Separately worth raising upstream: the feature primary key
[sequence, charge, run_file_name, anchor_protein]keys on the unmodified sequence, so it cannot distinguishYIC[UNIMOD:4]DNQDTISSKfromYICDNQDTISSK. Three such collisions appear in this PR's 60-row output, all between genuinely distinct species at different m/z.🤖 Generated with Claude Code
https://claude.ai/code/session_01DF2YUewPQTC5tJWqn23pUm
Summary by CodeRabbit
run_file_name,scan_format, and intensity-channel labels.scan_formatconsistently (only set when all inputs agree).anchor_protein).