Skip to content

[ProSE] Extensive end-of-search command-line report + YAML summary - #9642

Merged
timosachsenberg merged 7 commits into
OpenMS:developfrom
timosachsenberg:feat/prose-search-report
Jun 22, 2026
Merged

timosachsenberg merged 7 commits into
OpenMS:developfrom
timosachsenberg:feat/prose-search-report

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an extensive end-of-search Search Report to the ProSE TOPP tool, printed on completion and optionally serialized as YAML (-summary_out), covering all run modes (single/multi-file, open/closed search, target-only vs target+decoy, with/without Percolator, with/without calibration, SNES, chunked, failures).

What it reports

  • Config recap — enzyme, missed cleavages, precursor/fragment tolerances, charges, fixed/variable mods, ion series, calibration, open/closed mode, SNES, chunked.
  • Database / fragment index — target + decoy proteins, decoy mode (generated/external/none), indexed peptides/fragments, build time.
  • Results (per file) — matched spectra + ID rate, unique peptides/proteins, target/decoy PSM counts, achieved PSM FDR, charge & missed-cleavage histograms, HyperScore distribution.
  • Tolerance estimate — precursor/fragment median + MAD → recommended ppm.
  • Timing — per-phase (calibration/search/FDR) + shared index build + whole-run total.
  • Modification discovery (open search) — top PTMs + unknown delta masses.
  • Output manifest — every file actually written.
  • Multi-file — per-file table with totals + aggregate modification discovery.

Console (printed unless -no_summary)

[ProSE] ===================== Search Report =====================
[ProSE] Input        : SimpleSearchEngine_1.mzML  (3 MS2 spectra)
[ProSE] Config       : Trypsin, 1 MC | prec [-10, +10] ppm | frag 20 ppm | z 2-5
[ProSE]                fixed: Carbamidomethyl (C) | variable: Oxidation (M)
[ProSE]                ions: b,y | calibration: off | mode: closed
[ProSE] Database     : human.fasta  (11 target + 11 decoy proteins, decoys: generated)
[ProSE] Fragment idx : 164 peptides / 3838 fragments  (build 0.0 s)
[ProSE] --------------------------- Results ---------------------------
[ProSE] Matched      : 3 / 3 spectra   (ID rate 100.0%)
[ProSE] Peptides/prot: 3 unique peptides | 3 unique proteins
[ProSE] Target/decoy : 3 target / 0 decoy PSMs  | PSM FDR <= 5.0%, achieved 0.00%
[ProSE] Charges      : 3:3
[ProSE] Missed clv   : 0:3
[ProSE] HyperScore   : min 19.2  median 39.6  max 47.4
[ProSE] ------------------------- Timing -----------------------------
[ProSE] search 0.0s | fdr 0.0s | index(shared) 0.0s
[ProSE] ------------------------- Outputs ----------------------------
[ProSE]   idXML           -> out.idXML
[ProSE] ==============================================================

-summary_out report.yaml (machine-readable, same data)

shared:
  database_file: "human.fasta"
  enzyme: "Trypsin"
  precursor_tol_lower: 10
  fragment_tol: 20
  fixed_mods:
    - "Carbamidomethyl (C)"
  decoy_mode: "generated"
  db_target_proteins: 11
  db_decoy_proteins: 11
  indexed_peptides: 164
  seconds_total: 0.06
per_file:
  - input_file: "sample.mzML"
    matched_spectra: 3
    target_psms: 3
    decoy_psms: 0
    achieved_psm_fdr: 0
    hyperscore: {valid: true, min: 19.2423, median: 39.6443, max: 47.3598}
    precursor_error: {valid: true, median_ppm: 0.31, mad_ppm: 1.12, recommended_ppm: 5.0}
    fragment_error: {valid: true, median_ppm: 1.04, mad_ppm: 2.2, recommended_ppm: 12.0}
    charge_histogram:
      "3": 3
    timing_seconds:
      search: 0.000775
      fdr: 6.6e-05
outputs:
  - type: "idXML"
    paths:
      - "out.idXML"
files_failed: 0
files_total: 1

New options

  • -summary_out <file.yaml> — machine-readable summary (per-file stats + shared config/db/index + output manifest) for pipeline ingestion.
  • -no_summary — suppress the console report (the YAML is still written if requested).

Implementation

  • Per-run stats on ProSEAlgorithm::SearchResult::stats; shared config/db/index facts on MultiFileSearchResult::shared (computed once — the index is built once and reused, so shared costs are never summed per file).
  • Static renderRunSummary() / renderModificationSummary() console renderers + renderRunSummaryYaml(); updateFinalStats() recomputes result-level stats after Percolator rescoring / deferred PSM-FDR / protein-FDR finalization so the report reflects the final identifications.
  • New FragmentIndex::getNumFragments() accessor.
  • YAML, not JSON — no extra dependency. The summary is serialized by a small hand-rolled YAML emitter in the library (every string scalar is double-quoted and all control characters escaped as \xNN, so file paths / accessions round-trip safely; non-finite numbers → null; locale-independent, YAML-1.1-safe floats). This drops the nlohmann/json dependency entirely: nlohmann_json is PRIVATE-linked to the OpenMS library and not exported to TOPP tools, so an in-tool JSON include compiled only on Linux (via Arrow's transitive config) and failed the macOS/Windows build with 'nlohmann/json.hpp' file not found. YAML is also more idiomatic for OpenMS (CWL tool descriptions are YAML). YAML is registered as a first-class (writeable) FileTypes entry.

Behavior change: the algorithm class no longer auto-prints the old per-run diagnostic / modification-summary log blocks — rendering moved to the TOPP tool. Library callers that want the summary now call the static renderRunSummary() / renderModificationSummary() / renderRunSummaryYaml() helpers on the returned structs. Noted in the CHANGELOG.

Rebased onto current develop, reconciled with the auto-decoy / new-default-tolerances work (#9644) that landed in the meantime: the report's decoy counts and decoy_mode now derive from the resolved decoy marker (prefix or suffix), and FragmentIndex parameter shielding is preserved.

Testing

  • TOPP_ProSE_9_summary integration test (writes the YAML under -no_summary, existence-checked).
  • Full ProSE ctest suite + FileTypes_test / FileHandler_test green (44 tests, incl. Bruker .d DDA and external-FDR workflows).
  • Reviewed for correctness + robustness (opus + codex), incl. YAML escaping (control chars / Windows paths), number formatting (locale-independent, YAML-1.1-safe floats), and exact field parity with the prior JSON.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • ProSE now prints a consolidated end-of-search Search Report with configuration recap, index/database stats, per-file identification outcomes, PSM FDR metrics, charge and missed-cleavage distributions, HyperScore analysis, tolerance estimates, timing, open-search modification summary (when applicable), and an output manifest (including failed inputs).
    • Added -summary_out <file> to export the report as machine-readable YAML for pipeline ingestion.
    • Added -no_summary to suppress the console report while still producing YAML.
  • Tests

    • Added smoke tests to verify YAML generation and artifact presence.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

ProSEAlgorithm gains two new nested statistics types (RunStatistics, SharedSearchStats) that are populated throughout single- and multi-file search paths via new timing, FDR, and histogram collection helpers. The ProSE TOPP tool is extended with -summary_out and -no_summary CLI options that produce a formatted console search report and an optional machine-readable YAML file at the end of each run.

Changes

ProSE End-of-Search Reporting

Layer / File(s) Summary
Statistics data contracts and API surface
src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h, src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
Defines RunStatistics and SharedSearchStats nested types with identification counts, FDR/timing metadata, and histograms; extends SearchResult and MultiFileSearchResult to carry them; adds mutable last_run_stats_, private collection helper declarations, and public static updateFinalStats/renderRunSummary/renderModificationSummary/renderRunSummaryYaml API. FragmentIndex gains getNumFragments() accessor.
Timing instrumentation in calibration and search phases
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Wraps calibration and main search phases with StopWatch in both single-context and context-taking search overloads; resets last_run_stats_ at each search entry point; and records elapsed wall time for calibration, search, and FDR phases into last_run_stats_ fields.
Pre-FDR, FDR application, and post-FDR stats in search paths
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Captures pre-FDR target/decoy PSM counts and HyperScore distribution bounds before FalseDiscoveryRate modifies scores; times PSM-level FDR application with add_decoy_peptides=true; records achieved retained-score threshold; and triggers collectRunStatistics_ to finalize consolidated per-run statistics in both chunked and context-taking search overloads.
Stats collection helper implementations
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Implements accessionHasDecoyMarker_ (decoy detection), capturePreFdrStats_ (pre-FDR target/decoy counts and HyperScore bounds), updateFinalStats support, and collectRunStatistics_ (charge/missed-cleavage histograms and median/MAD-based tolerance estimation from retained PSMs).
Multi-file stats propagation and shared metadata
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Propagates last_run_stats_ into each SearchResult.stats (including on failures); populates mfres.shared with enzyme/tolerance/charge-range/digestion/configuration recap, decoy-mode classification, database protein counts, and index-build timing/metrics in both chunked and non-chunked multi-file paths. Sets input_file basename on failures.
YAML file type support and ostream renderers
src/openms/include/OpenMS/FORMAT/FileTypes.h, src/openms/source/FORMAT/FileTypes.cpp, src/tests/class_tests/openms/source/FileTypes_test.cpp, src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
Adds YAML to FileTypes enum and type-binding mappings as a writeable format. Implements renderModificationSummary (delta-mass/PTM bins), renderRunSummary (config recap, database/index metrics, FDR/target-decoy counts, histograms, tolerance estimates, and per-phase timing), and renderRunSummaryYaml (machine-readable YAML serialization) as public static methods.
ProSE TOPP: CLI options, output tracking, and end-of-search report
src/topp/ProSE.cpp, src/tests/topp/CMakeLists.txt, CHANGELOG
Adds -summary_out/-no_summary CLI options; total-runtime StopWatch; per-input psm_fdr_applied tracking; post-Percolator updateFinalStats calls; written_idxml/written_pin manifest tracking; and the full end-of-search reporting block that prints a formatted console report and optionally writes YAML. Two CTest entries verify YAML artifact production and integrity.

Possibly Related PRs

  • OpenMS/OpenMS#9620: Both PRs modify ProSEAlgorithm's MS2 deisotoping path—updateMembers_/preprocessSpectra_ logic to gate or control Deisotoper calls based on tolerance support—so the changes overlap directly in the same code flow.
  • OpenMS/OpenMS#9644: Main PR's new consolidated renderRunSummaryYaml end-of-search reporting depends on multi-file decoy metadata (MultiFileSearchResult decoy marker/orientation) and marker-aware FDR/protein-FDR handling.

Suggested reviewers

  • jpfeuffer

Poem

🐇 Hop hop, the search is done,
A report blooms when FDR's run!
YAML files neatly tucked away,
-no_summary for the quiet day.
Stats and timing, histograms bright —
The rabbit checks each peptide right! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: ProSE now includes an extensive end-of-search command-line report plus YAML summary output, which is the primary feature across all modified files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (5)
src/topp/ProSE.cpp (2)

958-958: 💤 Low value

Prefer "\n" over endl per coding guidelines.

The guidelines state: "Avoid std::endl for performance; prefer \n". While the performance impact is negligible for one-time reporting, consistency with the codebase convention is preferred.

♻️ Suggested fix
-          OPENMS_LOG_INFO << r.str() << endl;
+          OPENMS_LOG_INFO << r.str() << "\n";
🤖 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 958, The OPENMS_LOG_INFO logging statement uses
`endl` instead of `"\n"`, which violates the project's coding guidelines that
prefer `"\n"` for performance consistency. Locate the line with `OPENMS_LOG_INFO
<< r.str() << endl;` and replace `endl` with `"\n"` to align with the
established codebase conventions.

Source: Coding guidelines


1037-1053: 💤 Low value

Consider checking file open status before writing.

The current flow writes to ofs and then checks !ofs.good(), which catches open failures but conflates them with write failures in the error message. For clearer diagnostics, check immediately after construction.

Also, per coding guidelines, prefer "\n" over std::endl for the single flush that's redundant when the stream closes immediately after.

♻️ Suggested improvement
         try
         {
           std::ofstream ofs(summary_out);
+          if (!ofs)
+          {
+            OPENMS_LOG_ERROR << "[ProSE] Failed to open summary JSON -> " << summary_out << "\n";
+            return CANNOT_WRITE_OUTPUT_FILE;
+          }
-          ofs << root.dump(2) << std::endl;
+          ofs << root.dump(2) << "\n";
           if (!ofs.good())
           {
             OPENMS_LOG_ERROR << "[ProSE] Failed to write summary JSON -> " << summary_out
-                             << " (stream error)." << endl;
+                             << " (stream error).\n";
             return CANNOT_WRITE_OUTPUT_FILE;
           }
-          OPENMS_LOG_INFO << "[ProSE] Wrote summary JSON -> " << summary_out << endl;
+          OPENMS_LOG_INFO << "[ProSE] Wrote summary JSON -> " << summary_out << "\n";
         }
         catch (const std::exception& e)
         {
-          OPENMS_LOG_ERROR << "[ProSE] Failed to write summary JSON -> " << summary_out << ": " << e.what() << endl;
+          OPENMS_LOG_ERROR << "[ProSE] Failed to write summary JSON -> " << summary_out << ": " << e.what() << "\n";
           return CANNOT_WRITE_OUTPUT_FILE;
         }
🤖 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 1037 - 1053, In the ofstream block for
writing the summary JSON, check if the file opened successfully immediately
after the ofstream construction using ofs.fail() or ofs.is_open() before
attempting any write operations, rather than only checking ofs.good() after
writing. This clarifies whether failures are due to open failures versus write
failures. Additionally, replace the std::endl with "\n" since the redundant
buffer flush is unnecessary when the stream closes immediately after the write
operation completes.

Source: Coding guidelines

src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h (1)

155-156: ⚡ Quick win

Add the required Doxygen @brief form.

This new public header accessor is documented, but not in the required OpenMS Doxygen shape.

Proposed documentation tweak
-    /// Number of theoretical fragments stored in the index (0 before build()).
+    /// `@brief` Number of theoretical fragments stored in the index.
+    ///
+    /// Returns 0 before build().
     Size getNumFragments() const noexcept { return fi_fragments_.size(); }

As per coding guidelines, **/*.{h,.doxygen} requires Doxygen documentation with @brief plus a blank line before details.

🤖 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/include/OpenMS/ANALYSIS/ID/FragmentIndex.h` around lines 155 -
156, The getNumFragments() method documentation needs to follow OpenMS Doxygen
guidelines. Refactor the documentation comment to include a `@brief` tag on the
first line, followed by a blank line (///) separating it from additional
details. The current single-line comment format should be expanded to use the
proper Doxygen `@brief` structure as required by the coding guidelines for public
header accessors in *.h files.

Source: Coding guidelines

src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h (1)

741-769: ⚡ Quick win

Use @brief for the new public reporting API docs.

These public methods are documented, but the header guideline requires the Doxygen @brief form.

Proposed documentation shape
-    /// Recompute result-level statistics (matched count, unique peptide/protein
+    /// `@brief` Recompute result-level statistics.
+    ///
+    /// Recomputes matched count, unique peptide/protein
     /// counts, charge & missed-cleavage histograms, target/decoy counts and
...
-    /// Render a human-readable single-run summary block (configuration recap,
+    /// `@brief` Render a human-readable single-run summary block.
+    ///
+    /// Includes configuration recap,
     /// database/index stats, identification results, tolerance estimate, timing
...
-    /// Render the modification-discovery section (top PTMs, unknown delta masses)
-    /// to `@p` os. Shared by the per-file and aggregate report blocks.
+    /// `@brief` Render the modification-discovery section.
+    ///
+    /// Includes top PTMs and unknown delta masses. Shared by the per-file and
+    /// aggregate report blocks.

As per coding guidelines, **/*.{h,.doxygen} requires Doxygen documentation with @brief plus a blank line before details.

🤖 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/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h` around lines 741 -
769, Update the Doxygen documentation for the three public methods
updateFinalStats, renderRunSummary, and renderModificationSummary to conform to
the coding guidelines. Each method's documentation comment should use the `@brief`
tag for the initial summary, followed by a blank line before the detailed
description. Convert the current multi-line comments starting with /// to use
the proper `@brief` format, ensuring the first sentence after `@brief` is a concise
summary, then a blank line, then the remaining detailed documentation.

Source: Coding guidelines

src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp (1)

2892-2917: ⚡ Quick win

Use OpenMS Size for local container indices/ranks.

These loops/ranks are driven by OpenMS container sizes; keep them on Size rather than size_t to match the project convention.

Proposed type cleanup
-      size_t rank = 1;
+      Size rank = 1;
...
-      size_t rank = 1;
+      Size rank = 1;
...
-      for (size_t i = 0; i < v.size(); ++i) { out += (i ? ", " : "") + v[i]; }
+      for (Size i = 0; i < v.size(); ++i) { out += (i ? ", " : "") + v[i]; }
...
-      for (size_t i = 0; i < v.size(); ++i) { out += (i ? "," : "") + v[i]; }
+      for (Size i = 0; i < v.size(); ++i) { out += (i ? "," : "") + v[i]; }

As per coding guidelines, **/*.{h,cpp} requires using Size/SignedSize for STL .size() values.

Also applies to: 2936-2945

🤖 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/ANALYSIS/ID/ProSEAlgorithm.cpp` around lines 2892 - 2917,
Replace the `size_t` type with OpenMS `Size` type for rank variables in the PTM
statistics output loops. In the first loop where rank is initialized before the
PTM entries iteration and in the second loop where rank is initialized before
the unknown_dm iteration, change `size_t rank = 1;` to `Size rank = 1;` to
comply with OpenMS coding guidelines that require using `Size` for values driven
by container sizes, and apply the same change to the additional code sections
mentioned at lines 2936-2945.

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/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h`:
- Around line 77-80: The fields target_psms and decoy_psms in the struct are
documented as "BEFORE FDR" (pre-FDR values) on lines 77-78, but the
updateFinalStats() method (around lines 742-754) recomputes these same fields
from the final post-processed list, creating a semantic inconsistency. To fix
this, either create separate fields to distinguish pre-FDR counts from final
counts (keeping the original target_psms and decoy_psms for one type and adding
new fields for the other), or refactor all code paths to consistently store only
final post-FDR counts in target_psms and decoy_psms while using a different
field (such as HyperScore-related metrics) to capture pre-FDR statistics. Ensure
the documentation comments accurately reflect which counts are stored in each
field and that all callers and consumers of these fields are updated
accordingly.

In `@src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp`:
- Line 1364: The collectRunStatistics_ method call is not populating timing
fields for chunked runs, leaving seconds_search and calibration timing at zero.
Ensure that when collectRunStatistics_ is invoked for chunked execution paths,
the timing statistics structures are properly initialized and populated with
actual measured timing values instead of defaulting to zero. Additionally,
review and update the related code around lines 2173-2176 that explicitly sets
per-file search time to zero, and replace it with logic that captures and
assigns the actual search duration for chunked single-file and chunk-major runs
so that console reports and JSON output correctly reflect per-phase timing
information.
- Around line 2488-2499: The matched_spectra counter in the stats object is
being set to the total size of peptide_ids without accounting for the fact that
empty PeptideIdentifications are skipped in the loop (those with
pid.getHits().empty() returning true). This inflates the matched spectra count.
Instead of setting stats.matched_spectra = peptide_ids.size() upfront,
initialize it to zero and increment the counter only when processing non-empty
peptide identifications (after checking that pid.getHits().empty() is false).
This ensures matched_spectra accurately reflects only the identifications that
contribute to the statistics. Apply the same fix to the second location
mentioned in the comment range (2546-2562).

---

Nitpick comments:
In `@src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h`:
- Around line 155-156: The getNumFragments() method documentation needs to
follow OpenMS Doxygen guidelines. Refactor the documentation comment to include
a `@brief` tag on the first line, followed by a blank line (///) separating it
from additional details. The current single-line comment format should be
expanded to use the proper Doxygen `@brief` structure as required by the coding
guidelines for public header accessors in *.h files.

In `@src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h`:
- Around line 741-769: Update the Doxygen documentation for the three public
methods updateFinalStats, renderRunSummary, and renderModificationSummary to
conform to the coding guidelines. Each method's documentation comment should use
the `@brief` tag for the initial summary, followed by a blank line before the
detailed description. Convert the current multi-line comments starting with ///
to use the proper `@brief` format, ensuring the first sentence after `@brief` is a
concise summary, then a blank line, then the remaining detailed documentation.

In `@src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp`:
- Around line 2892-2917: Replace the `size_t` type with OpenMS `Size` type for
rank variables in the PTM statistics output loops. In the first loop where rank
is initialized before the PTM entries iteration and in the second loop where
rank is initialized before the unknown_dm iteration, change `size_t rank = 1;`
to `Size rank = 1;` to comply with OpenMS coding guidelines that require using
`Size` for values driven by container sizes, and apply the same change to the
additional code sections mentioned at lines 2936-2945.

In `@src/topp/ProSE.cpp`:
- Line 958: The OPENMS_LOG_INFO logging statement uses `endl` instead of `"\n"`,
which violates the project's coding guidelines that prefer `"\n"` for
performance consistency. Locate the line with `OPENMS_LOG_INFO << r.str() <<
endl;` and replace `endl` with `"\n"` to align with the established codebase
conventions.
- Around line 1037-1053: In the ofstream block for writing the summary JSON,
check if the file opened successfully immediately after the ofstream
construction using ofs.fail() or ofs.is_open() before attempting any write
operations, rather than only checking ofs.good() after writing. This clarifies
whether failures are due to open failures versus write failures. Additionally,
replace the std::endl with "\n" since the redundant buffer flush is unnecessary
when the stream closes immediately after the write operation completes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 02b0bf81-aa32-4370-99d7-cb7f9b3db23e

📥 Commits

Reviewing files that changed from the base of the PR and between f001f12 and ed195f6.

📒 Files selected for processing (6)
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProSE.cpp

Copy link
Copy Markdown
Contributor Author

CI failure root cause: 'nlohmann/json.hpp' file not found on macOS and Windows.

nlohmann_json::nlohmann_json is linked as a PRIVATE dependency of the OpenMS library (src/openms/CMakeLists.txt line 93), so its include directories are not propagated to TOPP executables. On Ubuntu 24.04 the header is found because nlohmann/json is available system-wide; on macOS and Windows only the vendored CMake target provides it, and TOPP executables don't see it.

Fix: add one line to src/topp/CMakeLists.txt (after the other per-tool target_link_libraries entries at the bottom):

target_link_libraries(ProSE nlohmann_json::nlohmann_json)

This is consistent with how IsobaricWorkflow and MetaProSIP pick up extra private dependencies (Eigen3::Eigen) that aren't transitively exposed by OpenMS.


Generated by Claude Code

timosachsenberg and others added 3 commits June 21, 2026 22:55
Print a consolidated "Search Report" when a ProSE run completes, covering all
run modes: configuration recap, database/fragment-index stats, per-file
identification results (matched/ID-rate, unique peptides+proteins,
target/decoy counts, achieved PSM FDR, charge & missed-cleavage histograms,
HyperScore distribution), per-run tolerance estimation, per-phase timing,
open-search modification discovery, and an output-file manifest. Multi-file
runs render a per-file table with totals.

New -summary_out writes the same data as machine-readable JSON; -no_summary
suppresses the console block. Per-run stats are exposed on
ProSEAlgorithm::SearchResult::stats / MultiFileSearchResult::shared, with
static renderRunSummary()/renderModificationSummary() helpers; the algorithm
no longer auto-prints the old diagnostic/modification-summary log blocks
(rendering moved to the TOPP tool). Stats are recomputed after
Percolator/deferred-FDR so the report reflects the final identifications.

Adds FragmentIndex::getNumFragments() and a TOPP_ProSE_6_summary test.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… the library

The end-of-search JSON summary included <nlohmann/json.hpp> directly in the ProSE
TOPP tool. nlohmann_json is linked PRIVATE on the OpenMS library, so its include
directory is not propagated to consumers: the tool compiled only on Linux (where
Arrow's transitive CMake config leaks the path) and failed on macOS/Windows with
"'nlohmann/json.hpp' file not found".

Move the serialization into the new static ProSEAlgorithm::renderRunSummaryJson()
in the OpenMS library (which links nlohmann), returning the JSON string; the TOPP
tool just writes it. Mirrors the existing in-library JSON pattern (ProFormaDataJson.h)
and keeps nlohmann an implementation detail. No change to the JSON content.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…der self-containment

opus+codex review of the rebase found one report-only bug: the end-of-search report's
db_target_proteins/db_decoy_proteins counts used the hardcoded decoy_prefix_ (prefix-only)
instead of the resolved DecoyStrategy_. Generated decoys (always DECOY_ prefix) counted
correctly, but reused EXTERNAL decoys with a suffix or non-default marker (decoy_mode
"external") were all miscounted as targets -> a self-contradictory "N target proteins,
decoys: external" with db_decoy_proteins=0. Count by strategy.decoy_string/is_prefix
(guarded by have_decoys so target-only/ignore stays all-target). Report/JSON only; search,
PSM target/decoy classification (TARGET_DECOY meta) and FDR were unaffected.

Also add <string>/<utility> includes to ProSEAlgorithm.h for the new renderRunSummaryJson
signature (std::string / std::pair were only transitively available).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the feat/prose-search-report branch from ed195f6 to 91b5435 Compare June 21, 2026 21:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

Inline comments:
In `@src/topp/ProSE.cpp`:
- Line 167: Replace all instances of std::endl with '\n' in the OPENMS_LOG_ERROR
logging statements and other logging messages throughout the file to follow the
coding guidelines that avoid std::endl for performance reasons. This applies to
the error message about output specifications in the logging statement and all
other OPENMS_LOG_ERROR, OPENMS_LOG_WARN, or similar logging calls where
std::endl is currently used. Simply substitute '\n' in place of std::endl while
keeping all other text and message content unchanged.
- Around line 165-167: The output validation check at the condition on line 165
currently rejects runs that only specify -summary_out as output, even though
this is a valid output option introduced elsewhere in the file. Add the
summary_out output parameter (the variable that stores the -summary_out
command-line argument value) to the empty check condition alongside
out_idxml_list, out_pin_list, out_qpx_dir, out_parquet_dir, and out_merged so
that the error is only raised when all output options including summary_out are
empty.
- Around line 989-993: The comment at lines 989-993 in the ProSE.cpp file
incorrectly states that the tool does not need nlohmann on its include path
because it is not exported as a consumer library. This comment is inaccurate
because nlohmann_json is a header-only library, and even though OpenMS links it
as PRIVATE, the headers are transitively included during compilation on all
platforms. Update the comment to clarify that while the serialization logic
resides in the OpenMS library (ProSEAlgorithm::renderRunSummaryJson), the ProSE
TOPP tool still requires nlohmann_json availability at compile time due to its
header-only nature. Additionally, add explicit linkage of
nlohmann_json::nlohmann_json target to the ProSE target in
src/topp/CMakeLists.txt to ensure the include paths are reliably available
across macOS/Windows/Linux platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c822648a-f8d4-4e34-8def-c504f053e994

📥 Commits

Reviewing files that changed from the base of the PR and between ed195f6 and 91b5435.

📒 Files selected for processing (6)
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProSE.cpp
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

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

Inline comments:
In `@src/topp/ProSE.cpp`:
- Line 167: Replace all instances of std::endl with '\n' in the OPENMS_LOG_ERROR
logging statements and other logging messages throughout the file to follow the
coding guidelines that avoid std::endl for performance reasons. This applies to
the error message about output specifications in the logging statement and all
other OPENMS_LOG_ERROR, OPENMS_LOG_WARN, or similar logging calls where
std::endl is currently used. Simply substitute '\n' in place of std::endl while
keeping all other text and message content unchanged.
- Around line 165-167: The output validation check at the condition on line 165
currently rejects runs that only specify -summary_out as output, even though
this is a valid output option introduced elsewhere in the file. Add the
summary_out output parameter (the variable that stores the -summary_out
command-line argument value) to the empty check condition alongside
out_idxml_list, out_pin_list, out_qpx_dir, out_parquet_dir, and out_merged so
that the error is only raised when all output options including summary_out are
empty.
- Around line 989-993: The comment at lines 989-993 in the ProSE.cpp file
incorrectly states that the tool does not need nlohmann on its include path
because it is not exported as a consumer library. This comment is inaccurate
because nlohmann_json is a header-only library, and even though OpenMS links it
as PRIVATE, the headers are transitively included during compilation on all
platforms. Update the comment to clarify that while the serialization logic
resides in the OpenMS library (ProSEAlgorithm::renderRunSummaryJson), the ProSE
TOPP tool still requires nlohmann_json availability at compile time due to its
header-only nature. Additionally, add explicit linkage of
nlohmann_json::nlohmann_json target to the ProSE target in
src/topp/CMakeLists.txt to ensure the include paths are reliably available
across macOS/Windows/Linux platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c822648a-f8d4-4e34-8def-c504f053e994

📥 Commits

Reviewing files that changed from the base of the PR and between ed195f6 and 91b5435.

📒 Files selected for processing (6)
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProSE.cpp
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/openms/include/OpenMS/ANALYSIS/ID/FragmentIndex.h
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
🛑 Comments failed to post (3)
src/topp/ProSE.cpp (3)

165-167: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Allow -summary_out to satisfy the required-output guard.

Line 165 currently rejects runs that request only -summary_out, even though Line 127 introduces it as an output artifact. That blocks JSON-only report workflows.

💡 Proposed fix
-      if (out_idxml_list.empty() && out_pin_list.empty() && out_qpx_dir.empty() && out_parquet_dir.empty() && out_merged.empty())
+      const String summary_out = getStringOption_("summary_out");
+      if (out_idxml_list.empty() && out_pin_list.empty() && out_qpx_dir.empty() && out_parquet_dir.empty() && out_merged.empty() && summary_out.empty())
       {
-        OPENMS_LOG_ERROR << "No output specified. Provide at least one of -out_idxml, -out_pin, -out_qpx, -out_parquet, or -out_merged." << endl;
+        OPENMS_LOG_ERROR << "No output specified. Provide at least one of -out_idxml, -out_pin, -out_qpx, -out_parquet, -out_merged, or -summary_out.\n";
         return ILLEGAL_PARAMETERS;
       }

Also applies to: 127-131

🤖 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 165 - 167, The output validation check at
the condition on line 165 currently rejects runs that only specify -summary_out
as output, even though this is a valid output option introduced elsewhere in the
file. Add the summary_out output parameter (the variable that stores the
-summary_out command-line argument value) to the empty check condition alongside
out_idxml_list, out_pin_list, out_qpx_dir, out_parquet_dir, and out_merged so
that the error is only raised when all output options including summary_out are
empty.

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

Replace new std::endl usage with '\n'.

The newly added logging/output paths flush on every line via std::endl; use '\n' to avoid unnecessary flush overhead.

As per coding guidelines, **/*.{h,cpp} should avoid std::endl for performance and prefer \n.

Also applies to: 307-307, 338-339, 986-986, 998-998

🤖 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 167, Replace all instances of std::endl with '\n'
in the OPENMS_LOG_ERROR logging statements and other logging messages throughout
the file to follow the coding guidelines that avoid std::endl for performance
reasons. This applies to the error message about output specifications in the
logging statement and all other OPENMS_LOG_ERROR, OPENMS_LOG_WARN, or similar
logging calls where std::endl is currently used. Simply substitute '\n' in place
of std::endl while keeping all other text and message content unchanged.

Source: Coding guidelines


989-993: ⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether ProSE target links nlohmann_json directly and whether OpenMS keeps it PRIVATE.
rg -n -C2 'target_link_libraries\s*\(\s*OpenMS|nlohmann_json::nlohmann_json' src/openms/CMakeLists.txt
rg -n -C3 'add_executable\s*\(\s*ProSE|target_link_libraries\s*\(\s*ProSE|nlohmann_json::nlohmann_json' src/topp/CMakeLists.txt

Repository: OpenMS/OpenMS

Length of output: 462


🏁 Script executed:

#!/bin/bash
# Search for ProSE CMakeLists configuration more directly
fd -n CMakeLists.txt src/topp/ | head -5

Repository: OpenMS/OpenMS

Length of output: 288


🏁 Script executed:

#!/bin/bash
# Look at the actual topp CMakeLists.txt to find ProSE configuration
grep -n "ProSE\|prose" src/topp/CMakeLists.txt -i | head -20

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Search all topp CMakeLists for nlohmann references
rg -n "nlohmann" src/topp/

Repository: OpenMS/OpenMS

Length of output: 280


🏁 Script executed:

#!/bin/bash
# Search for ProSE in all CMakeLists and cmake files
rg -n "ProSE" src/ -g "*.cmake" -g "CMakeLists.txt"

Repository: OpenMS/OpenMS

Length of output: 14515


🏁 Script executed:

#!/bin/bash
# Check executables.cmake as mentioned in guidelines
cat src/topp/executables.cmake | grep -A5 -B5 "ProSE"

Repository: OpenMS/OpenMS

Length of output: 231


🏁 Script executed:

#!/bin/bash
# Look at the topp CMakeLists.txt to understand how executables are added
head -100 src/topp/CMakeLists.txt

Repository: OpenMS/OpenMS

Length of output: 2419


🏁 Script executed:

#!/bin/bash
# Look at the context around nlohmann_json linkage in OpenMS CMakeLists.txt
sed -n '70,100p' src/openms/CMakeLists.txt

Repository: OpenMS/OpenMS

Length of output: 842


🏁 Script executed:

#!/bin/bash
# Find where OPENMS_DEP_PRIVATE_LIBRARIES is defined
rg -n "OPENMS_DEP_PRIVATE_LIBRARIES" src/openms/CMakeLists.txt | head -20

Repository: OpenMS/OpenMS

Length of output: 698


🏁 Script executed:

#!/bin/bash
# Check if nlohmann_json is exposed in public headers
grep -r "nlohmann/json" src/openms/include/ | head -10

Repository: OpenMS/OpenMS

Length of output: 396


🏁 Script executed:

#!/bin/bash
# Check what headers ProSE.cpp includes
head -60 src/topp/ProSE.cpp | grep -E "^`#include`"

Repository: OpenMS/OpenMS

Length of output: 1122


🏁 Script executed:

#!/bin/bash
# Search for ProFormaDataJson in ProSE or related code
rg -n "ProFormaDataJson" src/topp/ src/openms/source/ANALYSIS/ID/

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Check if any included header in ProSE transitively includes nlohmann
rg -l "ProFormaDataJson|nlohmann" src/openms/include/OpenMS/ANALYSIS/ID/*.h | head -10

Repository: OpenMS/OpenMS

Length of output: 112


🏁 Script executed:

#!/bin/bash
# Check ProSEAlgorithm.h for nlohmann usage and what it actually includes
head -100 src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h

Repository: OpenMS/OpenMS

Length of output: 4618


🏁 Script executed:

#!/bin/bash
# Search for nlohmann includes in ProSEAlgorithm.h
grep -n "nlohmann\|ProFormaDataJson" src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h

Repository: OpenMS/OpenMS

Length of output: 250


🏁 Script executed:

#!/bin/bash
# Check if ProSEAlgorithm.h includes ProFormaDataJson indirectly
rg -A10 "`#include`.*ProFormaDataJson" src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Check which headers transitively include nlohmann by checking key ProSE dependencies
grep -r "nlohmann" src/openms/include/OpenMS/METADATA/ src/openms/include/OpenMS/FORMAT/ | grep -v "\.cpp" | head -20

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Specifically check ProteinIdentification.h which ProSE includes
grep -n "nlohmann\|ProFormaDataJson" src/openms/include/OpenMS/METADATA/ProteinIdentification.h

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Check if ProteinGroupArrowExport.h (included by ProSE) uses ProFormaDataJson
grep -n "nlohmann\|ProFormaDataJson" src/openms/include/OpenMS/FORMAT/ProteinGroupArrowExport.h

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Look at lines around the comment in ProSE.cpp to understand what it's doing with JSON
sed -n '985,1010p' src/topp/ProSE.cpp

Repository: OpenMS/OpenMS

Length of output: 1372


🏁 Script executed:

#!/bin/bash
# Check renderRunSummaryJson to see if it's truly self-contained in ProSEAlgorithm
grep -n "renderRunSummaryJson" src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h

Repository: OpenMS/OpenMS

Length of output: 259


🏁 Script executed:

#!/bin/bash
# Look for the implementation of renderRunSummaryJson
grep -n "renderRunSummaryJson" src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp | head -5

Repository: OpenMS/OpenMS

Length of output: 114


🏁 Script executed:

#!/bin/bash
# Check the actual implementation of renderRunSummaryJson - does it include nlohmann?
sed -n '3094,3150p' src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp

Repository: OpenMS/OpenMS

Length of output: 3061


🏁 Script executed:

#!/bin/bash
# Look for nlohmann includes at the top of ProSEAlgorithm.cpp
head -50 src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp | grep -E "^`#include`"

Repository: OpenMS/OpenMS

Length of output: 1873


🏁 Script executed:

#!/bin/bash
# Check if there's a special target_link_libraries for ProSE that was added
grep -B5 -A5 "ProSE" src/topp/CMakeLists.txt | tail -30

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

#!/bin/bash
# Check the entire topp CMakeLists.txt for any ProSE-specific linking after line 51
tail -20 src/topp/CMakeLists.txt

Repository: OpenMS/OpenMS

Length of output: 636


🏁 Script executed:

#!/bin/bash
# Look for any recent changes or TODOs about ProSE nlohmann linkage
rg -n "ProSE.*nlohmann|nlohmann.*ProSE" src/

Repository: OpenMS/OpenMS

Length of output: 39


Update comment to reflect actual nlohmann_json linkage requirement across all platforms.

The code comment is inaccurate: ProSE DOES require explicit nlohmann_json::nlohmann_json linkage on macOS/Windows. Although nlohmann_json is linked to OpenMS as PRIVATE, it is a header-only library. Since OpenMS's implementation headers (ProSEAlgorithm.cpp) directly use #include <nlohmann/json.hpp>, and these headers are transitively included during compilation of dependent targets, the nlohmann headers must be available. PRIVATE linkage of header-only libraries does not propagate include paths reliably across all platforms.

The CMake configuration in src/topp/CMakeLists.txt lacks an explicit linkage:

target_link_libraries(ProSE nlohmann_json::nlohmann_json)

should be added to the "special requirements" section (or equivalent location) to ensure ProSE compiles on macOS/Windows. Additionally, the code comment at lines 989–993 should be corrected to note that while the serialization logic lives in the library, the TOPP tool still requires nlohmann availability at compile time due to the header-only nature of the dependency.

🤖 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 989 - 993, The comment at lines 989-993 in
the ProSE.cpp file incorrectly states that the tool does not need nlohmann on
its include path because it is not exported as a consumer library. This comment
is inaccurate because nlohmann_json is a header-only library, and even though
OpenMS links it as PRIVATE, the headers are transitively included during
compilation on all platforms. Update the comment to clarify that while the
serialization logic resides in the OpenMS library
(ProSEAlgorithm::renderRunSummaryJson), the ProSE TOPP tool still requires
nlohmann_json availability at compile time due to its header-only nature.
Additionally, add explicit linkage of nlohmann_json::nlohmann_json target to the
ProSE target in src/topp/CMakeLists.txt to ensure the include paths are reliably
available across macOS/Windows/Linux platforms.

…hmann)

Replace the -summary_out JSON with hand-rolled YAML, removing the nlohmann/json
dependency from this feature entirely — which dissolves the macOS/Windows build
problem at its root (no library include-path to propagate) rather than working
around it. YAML is also more idiomatic for OpenMS (CWL tool descriptions are YAML).

- renderRunSummaryJson -> renderRunSummaryYaml (still in the library): a small
  emitter that double-quotes every string scalar and escapes all control chars as
  \xNN (so paths/accessions containing ':' , quotes or control bytes round-trip
  safely), emits non-finite numbers as null, forces the classic locale, and writes
  a mantissa dot on bare exponentials ("8e-05" -> "8.0e-05") so YAML 1.1 parsers
  read them as numbers. Same field set / structure as the previous JSON.
- ProSEAlgorithm.cpp no longer includes <nlohmann/json.hpp>.
- Register YAML as a first-class, WRITEABLE FileTypes entry so
  setValidFormats_("yaml") is valid (OpenMS already emits YAML for CWL).
- -summary_out description/format/log messages, the ProSE_9_summary test
  (.json -> .yaml) and the CHANGELOG updated accordingly.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg timosachsenberg changed the title [ProSE] Extensive end-of-search command-line report + JSON summary [ProSE] Extensive end-of-search command-line report + YAML summary Jun 22, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h (1)

846-856: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add the required @brief Doxygen shape for this new public API.

This is a public header method, but the new documentation block does not use the project-required @brief + blank-line + details layout.

Proposed documentation update
-    /// Serialize the complete end-of-search report to a machine-readable YAML string:
-    /// shared configuration/database/index facts, per-file identification statistics,
-    /// the output-file `@p` manifest (label -> written paths) and failed/total file counts.
-    /// Hand-rolled (no YAML library dependency); every string scalar is double-quoted so
-    /// values containing ':' (e.g. Windows paths) or other YAML metacharacters round-trip
-    /// safely, and non-finite numbers are emitted as null.
+    /**
+     * `@brief` Serialize the complete end-of-search report to a machine-readable YAML string.
+     *
+     * Includes shared configuration/database/index facts, per-file identification
+     * statistics, the output-file `@p` manifest (label -> written paths), and
+     * failed/total file counts. Hand-rolled (no YAML library dependency); every
+     * string scalar is double-quoted so values containing ':' (e.g. Windows paths)
+     * or other YAML metacharacters round-trip safely, and non-finite numbers are
+     * emitted as null.
+     */
     static std::string renderRunSummaryYaml(

As per coding guidelines, **/*.{h,.doxygen} must use Doxygen documentation with @brief required, followed by a blank line and details.

🤖 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/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h` around lines 846 -
856, The Doxygen documentation for the public method renderRunSummaryYaml is
missing the required `@brief` tag and proper documentation layout. Refactor the
documentation block to follow the project standard: start with a `@brief` tag
containing a concise one-line summary of the method's purpose, followed by a
blank line (/// with no text), and then the detailed description. The current
multi-line description should be reorganized so the first sentence or key idea
becomes the brief, and the remaining details follow after the blank line
separator.

Source: Coding guidelines

src/topp/ProSE.cpp (1)

996-998: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Avoid flushing the YAML file stream with std::endl.

Line 997 only needs a trailing newline; std::endl also flushes and violates the OpenMS C++ style guidance.

Proposed write tweak
-            ofs << ProSEAlgorithm::renderRunSummaryYaml(mfres, manifest, failed_count, in_list.size()) << std::endl;
+            ofs << ProSEAlgorithm::renderRunSummaryYaml(mfres, manifest, failed_count, in_list.size()) << '\n';

As per coding guidelines, **/*.{h,cpp} should avoid std::endl for performance and prefer \n.

🤖 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 996 - 998, Replace the std::endl with a
newline character \n in the line where ProSEAlgorithm::renderRunSummaryYaml
output is written to the ofs stream. The std::endl flushes the stream buffer
unnecessarily, which impacts performance. Using \n instead provides the same
trailing newline without the flush operation, aligning with OpenMS C++ coding
guidelines.

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.

Nitpick comments:
In `@src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h`:
- Around line 846-856: The Doxygen documentation for the public method
renderRunSummaryYaml is missing the required `@brief` tag and proper documentation
layout. Refactor the documentation block to follow the project standard: start
with a `@brief` tag containing a concise one-line summary of the method's purpose,
followed by a blank line (/// with no text), and then the detailed description.
The current multi-line description should be reorganized so the first sentence
or key idea becomes the brief, and the remaining details follow after the blank
line separator.

In `@src/topp/ProSE.cpp`:
- Around line 996-998: Replace the std::endl with a newline character \n in the
line where ProSEAlgorithm::renderRunSummaryYaml output is written to the ofs
stream. The std::endl flushes the stream buffer unnecessarily, which impacts
performance. Using \n instead provides the same trailing newline without the
flush operation, aligning with OpenMS C++ coding guidelines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26272cd9-3f2e-40ae-8b6c-9969e9d98926

📥 Commits

Reviewing files that changed from the base of the PR and between 91b5435 and 1945f9c.

📒 Files selected for processing (8)
  • CHANGELOG
  • src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.h
  • src/openms/include/OpenMS/FORMAT/FileTypes.h
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
  • src/openms/source/FORMAT/FileTypes.cpp
  • src/tests/class_tests/openms/source/FileTypes_test.cpp
  • src/tests/topp/CMakeLists.txt
  • src/topp/ProSE.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/tests/class_tests/openms/source/FileTypes_test.cpp
  • src/openms/source/FORMAT/FileTypes.cpp
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/tests/topp/CMakeLists.txt
  • CHANGELOG
  • src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp

timosachsenberg and others added 3 commits June 22, 2026 08:50
… docs

- matched_spectra: count only identifications that retained a hit, not
  peptide_ids.size(). ProSE pushes one PeptideIdentification per searched spectrum
  (incl. empty non-matches); a caller that collects stats before stripping empties
  (the single-file library path) would over-count matched spectra / ID rate.
  count_if(non-empty) is correct in every path (unchanged where empties were
  already absent, e.g. the multi-file TOPP path: 896/2789 stays 896/2789).
- Docs: target_psms/decoy_psms/matched_spectra are recomputed from the FINAL
  identifications (post-FDR) by collectRunStatistics_/updateFinalStats; the header
  said "BEFORE FDR". Corrected to "final IDs (after FDR, if applied)".

Not changed: CodeRabbit also flagged per-file seconds_search=0 on chunked runs.
That is intentional and documented (~ProSEAlgorithm.cpp:2387): chunk-major scores
one shared index against all files, so per-file search time is not separable; the
console omits the line rather than misreporting, and the cost shows under
index(shared) + the whole-run total.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…tics_; YAML scope doc

opus+codex final pre-merge review. Two fixes:
- collectRunStatistics_ now computes target_psms/decoy_psms from the (post-FDR) hits it
  is given. Previously only capturePreFdrStats_ (pre-FDR) and updateFinalStats (post-FDR)
  set them, so a library caller reading SearchResult::stats without calling
  updateFinalStats saw PRE-FDR counts despite the "final IDs" doc. The TOPP tool was
  already correct (it calls updateFinalStats); this makes every caller consistent.
- CHANGELOG: the YAML -summary_out omits the console-only modification-discovery section,
  so drop the "same information" claim and list the actual contents.

Confirmed correct by both reviewers (no change): matched_spectra count_if at both sites,
HyperScore pre-FDR capture not overwritten, db target/decoy by resolved marker, chunked
seconds_search=0 intentional + console-omitted, hand-rolled YAML valid across all shapes
(control-char escaping, YAML-1.1 floats), FileTypes WRITEABLE-only, OpenMS#9644 reconciliation intact.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ng gaps)

The FileType enum binding was non-exhaustive: it omitted YAML (added on this branch)
and 9 pre-existing types (ZIP, IDPARQUET, FEATUREPARQUET, CONSENSUSPARQUET,
CHROMPARQUET, MOBILPARQUET, OSWPQ, BRUKER_TDF, PEFF). Bind all of them so the Python
enum matches C++ (72 real values).

test_FileTypes.py: complete the expected list and add an exhaustiveness assertion
(len(real types) == int(SIZE_OF_TYPE)) so a future FileTypes::Type added in C++ forces
the binding + test to be updated. Verified directly: all 72 values accessible with
correct ints, typeToName(YAML) == 'yaml'.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@timosachsenberg
timosachsenberg merged commit 9a7cdde into OpenMS:develop Jun 22, 2026
38 checks passed
timosachsenberg added a commit that referenced this pull request Jun 24, 2026
…9650, #9651 (#9652)

- Add PR reference (#9650) to the error-message improvement entry (was issue #9636 only)
- Add PR reference (#9642) to ProSE end-of-search report entry
- Add PR reference (#9643) to PSMFeatureExtractor andes support entry
- Add PR reference (#9649) to UniPEFF new-tool entry
- Add Build System entry for #9648: Boost.Spirit → charconv, 30-40% faster build
- Add Build System entry for #9651: missing <thread> header fix for clang 21+


Claude-Session: https://claude.ai/code/session_01DdyZmN6J65umScGRherQ9W

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant