Repository navigation
fix(ProSE): honor ions:add_* parameters in scoring path - #9167
Conversation
ProSE declared ions:add_a/b/c/x/y/z_ions parameters in its constructor but updateMembers_() never read them. FragmentIndex received and used them correctly (via setParameters in prepareContext), but TheoreticalSpectrumGenerator in the scoring loop always used its defaults (b/y only) — making the index and scorer inconsistent. Fix: read the 6 ion toggles in updateMembers_() and forward them to TheoreticalSpectrumGenerator alongside the existing add_first_prefix_ion and add_metainfo settings. Users can now configure ETD-style searches with -Search:ions:add_c_ions true -Search:ions:add_z_ions true -Search:ions:add_b_ions false -Search:ions:add_y_ions false and have both the index and scoring honor the setting. Closes item 12 in #9108. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📝 WalkthroughWalkthroughAdded six configurable boolean member variables to Changes
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp (2)
1552-1556:⚠️ Potential issue | 🟡 MinorCalibration-pass TSG also hardcoded to b/y defaults.
Same downstream concern as
postProcessHits_: when non-default ion series are enabled, calibration scoring here will use only b/y theoretical ions, which for ETD/EThcD spectra yields fewer matches and noisier shift/spread estimates than the main scoring pass (which now correctly honors the toggles). Forwarding the sixadd_*_ions_members here would keep the calibration pass consistent with the main search.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp` around lines 1552 - 1556, The calibration-pass TSG is hardcoded to b/y defaults; update the setup for TheoreticalSpectrumGenerator (tsg) in ProSEAlgorithm::... so it forwards the algorithm's six add_*_ions_ toggles instead of fixed defaults: read the class members (e.g. add_b_ions_, add_y_ions_, add_a_ions_, add_c_ions_, add_x_ions_, add_z_ions_ — or the actual six add_*_ions_ member names present) and set the corresponding Param keys on tsg_param (e.g. "add_b_ions", "add_y_ions", "add_a_ions", "add_c_ions", "add_x_ions", "add_z_ions") before calling tsg.setParameters(tsg_param) so the calibration scoring honors the same ion-series configuration as the main search.
430-434:⚠️ Potential issue | 🟡 MinorAnnotation-path TSG still hardcoded to defaults (b/y only) — same-class-of-bug as the scoring-path fix.
The scoring TSG now honors
ions:add_*, but the TSG used here for alignment-based annotations (fragment_error_median_ppm,fragment_annotations,longest_peptide_ion_sequence, and theb/yordinal extraction at lines 511-521) is still constructed with library defaults — i.e. b/y only. For ETD/EThcD runs withadd_c_ions/add_z_ions=true, c/z peaks won't participate in alignment, so the annotations will under-report matches and fragment-error medians will be biased toward the subset of ions that happen to overlap b/y masses.Consider forwarding the same six toggles here (and, if desired, re-scoping the b/y ordinal extraction at lines 511-524 to also collect c/z ordinals for the longest-run computation when those series are enabled). If intentionally out of scope for this PR, a TODO would help.
Suggested minimal forward of the toggles
TheoreticalSpectrumGenerator tsg; Param tsg_param(tsg.getParameters()); tsg_param.setValue("add_metainfo", "true"); tsg_param.setValue("add_first_prefix_ion", "true"); + tsg_param.setValue("add_a_ions", add_a_ions_ ? "true" : "false"); + tsg_param.setValue("add_b_ions", add_b_ions_ ? "true" : "false"); + tsg_param.setValue("add_c_ions", add_c_ions_ ? "true" : "false"); + tsg_param.setValue("add_x_ions", add_x_ions_ ? "true" : "false"); + tsg_param.setValue("add_y_ions", add_y_ions_ ? "true" : "false"); + tsg_param.setValue("add_z_ions", add_z_ions_ ? "true" : "false"); tsg.setParameters(tsg_param);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp` around lines 430 - 434, The TheoreticalSpectrumGenerator used for annotation (TheoreticalSpectrumGenerator instance "tsg" and its Param "tsg_param") is still using library defaults (b/y only); forward the same six ions toggles from the scoring path by reading/setting the "ions:add_*" parameters (e.g. "ions:add_b_ions", "ions:add_y_ions", "ions:add_c_ions", "ions:add_z_ions", "ions:add_a_ions", "ions:add_x_ions") into tsg_param before calling tsg.setParameters so fragment-based features (fragment_error_median_ppm, fragment_annotations, longest_peptide_ion_sequence) include the same ion series as scoring; additionally, when c/z series are enabled, extend the b/y ordinal-collection logic (the b/y ordinal extraction block used to compute longest-run) to also collect c/z ordinals, or add a TODO comment if you prefer to defer that change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp`:
- Around line 1552-1556: The calibration-pass TSG is hardcoded to b/y defaults;
update the setup for TheoreticalSpectrumGenerator (tsg) in ProSEAlgorithm::...
so it forwards the algorithm's six add_*_ions_ toggles instead of fixed
defaults: read the class members (e.g. add_b_ions_, add_y_ions_, add_a_ions_,
add_c_ions_, add_x_ions_, add_z_ions_ — or the actual six add_*_ions_ member
names present) and set the corresponding Param keys on tsg_param (e.g.
"add_b_ions", "add_y_ions", "add_a_ions", "add_c_ions", "add_x_ions",
"add_z_ions") before calling tsg.setParameters(tsg_param) so the calibration
scoring honors the same ion-series configuration as the main search.
- Around line 430-434: The TheoreticalSpectrumGenerator used for annotation
(TheoreticalSpectrumGenerator instance "tsg" and its Param "tsg_param") is still
using library defaults (b/y only); forward the same six ions toggles from the
scoring path by reading/setting the "ions:add_*" parameters (e.g.
"ions:add_b_ions", "ions:add_y_ions", "ions:add_c_ions", "ions:add_z_ions",
"ions:add_a_ions", "ions:add_x_ions") into tsg_param before calling
tsg.setParameters so fragment-based features (fragment_error_median_ppm,
fragment_annotations, longest_peptide_ion_sequence) include the same ion series
as scoring; additionally, when c/z series are enabled, extend the b/y
ordinal-collection logic (the b/y ordinal extraction block used to compute
longest-run) to also collect c/z ordinals, or add a TODO comment if you prefer
to defer that change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fdf2a731-1046-4896-8a7d-d7f9bb167424
📒 Files selected for processing (2)
src/openms/include/OpenMS/ANALYSIS/ID/ProSEAlgorithm.hsrc/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp
…tures Three changes bundled because they touch the same code paths: 1. Rename matched_b_ions / matched_y_ions → matched_prefix_ions / matched_suffix_ions across HyperScore, ProSE, SSE, and Constants.h. With PR #9167 enabling c/z/a/x ions, the old names were misleading — these counters track ALL prefix (a/b/c) and suffix (x/y/z) ions, not just b/y. MetaValue strings also renamed (no backward compat needed — ProSE is unreleased). 2. Fix HyperScore::computeWithDetail to count all prefix/suffix ion types in the factorial terms, not just b/y. Previously c/z ions contributed to the dot_product (intensity matching) but NOT to the ion-count factorial boost — penalizing ETD/EThcD searches. The fast path (first-char check, O(1) per ion) handles a/b/c/x/y/z; the XL-MS $-prefix fallback (single find('$'), O(N) on name length) is preserved for NuXL compatibility. 3. Add delta_score: score difference between best and second-best PSM per spectrum. Computed in a single O(N) pass over candidates BEFORE partial_sort — zero change to the existing sort (still k=top_hits). When only one candidate exists, delta = full score (same convention as Sage/MSFragger: no competition = maximum delta). Wired into extra_features for Percolator. Also wires longest_peptide_ion_sequence and matched_prefix/suffix_ions into extra_features (already computed but previously not passed to Percolator). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…tures Three changes bundled because they touch the same code paths: 1. Rename matched_b_ions / matched_y_ions → matched_prefix_ions / matched_suffix_ions across HyperScore, ProSE, SSE, and Constants.h. With PR #9167 enabling c/z/a/x ions, the old names were misleading — these counters track ALL prefix (a/b/c) and suffix (x/y/z) ions, not just b/y. MetaValue strings also renamed (no backward compat needed — ProSE is unreleased). 2. Fix HyperScore::computeWithDetail to count all prefix/suffix ion types in the factorial terms, not just b/y. Previously c/z ions contributed to the dot_product (intensity matching) but NOT to the ion-count factorial boost — penalizing ETD/EThcD searches. The fast path (first-char check, O(1) per ion) handles a/b/c/x/y/z; the XL-MS $-prefix fallback (single find('$'), O(N) on name length) is preserved for NuXL compatibility. 3. Add delta_score: score difference between best and second-best PSM per spectrum. Computed in a single O(N) pass over candidates BEFORE partial_sort — zero change to the existing sort (still k=top_hits). When only one candidate exists, delta = full score (same convention as Sage/MSFragger: no competition = maximum delta). Wired into extra_features for Percolator. Also wires longest_peptide_ion_sequence and matched_prefix/suffix_ions into extra_features (already computed but previously not passed to Percolator). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…tures Three changes bundled because they touch the same code paths: 1. Rename matched_b_ions / matched_y_ions → matched_prefix_ions / matched_suffix_ions across HyperScore, ProSE, SSE, and Constants.h. With PR #9167 enabling c/z/a/x ions, the old names were misleading — these counters track ALL prefix (a/b/c) and suffix (x/y/z) ions, not just b/y. MetaValue strings also renamed (no backward compat needed — ProSE is unreleased). 2. Fix HyperScore::computeWithDetail to count all prefix/suffix ion types in the factorial terms, not just b/y. Previously c/z ions contributed to the dot_product (intensity matching) but NOT to the ion-count factorial boost — penalizing ETD/EThcD searches. The fast path (first-char check, O(1) per ion) handles a/b/c/x/y/z; the XL-MS $-prefix fallback (single find('$'), O(N) on name length) is preserved for NuXL compatibility. 3. Add delta_score: score difference between best and second-best PSM per spectrum. Computed in a single O(N) pass over candidates BEFORE partial_sort — zero change to the existing sort (still k=top_hits). When only one candidate exists, delta = full score (same convention as Sage/MSFragger: no competition = maximum delta). Wired into extra_features for Percolator. Also wires longest_peptide_ion_sequence and matched_prefix/suffix_ions into extra_features (already computed but previously not passed to Percolator). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…atures (#9175) * feat(ProSE): delta score, renamed ion counts, expanded Percolator features Three changes bundled because they touch the same code paths: 1. Rename matched_b_ions / matched_y_ions → matched_prefix_ions / matched_suffix_ions across HyperScore, ProSE, SSE, and Constants.h. With PR #9167 enabling c/z/a/x ions, the old names were misleading — these counters track ALL prefix (a/b/c) and suffix (x/y/z) ions, not just b/y. MetaValue strings also renamed (no backward compat needed — ProSE is unreleased). 2. Fix HyperScore::computeWithDetail to count all prefix/suffix ion types in the factorial terms, not just b/y. Previously c/z ions contributed to the dot_product (intensity matching) but NOT to the ion-count factorial boost — penalizing ETD/EThcD searches. The fast path (first-char check, O(1) per ion) handles a/b/c/x/y/z; the XL-MS $-prefix fallback (single find('$'), O(N) on name length) is preserved for NuXL compatibility. 3. Add delta_score: score difference between best and second-best PSM per spectrum. Computed in a single O(N) pass over candidates BEFORE partial_sort — zero change to the existing sort (still k=top_hits). When only one candidate exists, delta = full score (same convention as Sage/MSFragger: no competition = maximum delta). Wired into extra_features for Percolator. Also wires longest_peptide_ion_sequence and matched_prefix/suffix_ions into extra_features (already computed but previously not passed to Percolator). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(ProSE): address CR feedback + add matched_ion_current CodeRabbit feedback on fdafb4a: - #4: LONGEST_PEPTIDE_ION_SEQUENCE only counted b/y ordinals but was newly exported to Percolator, systematically biasing ETD/EThcD. Generalized the classifier to a/b/c (prefix) / x/y/z (suffix) in both ProSEAlgorithm and SSE. Ordinals merged via existing std::unique, so a3 and b3 collapse to one backbone position. - #5: test coverage. Added DELTA_SCORE and MATCHED_ION_CURRENT assertions in the existing PSM-annotations section. - #3 (init-with-0.0 vs negative scores): pushback. HyperScore output is log1p + non-negative factorial terms, and score == 0 is already filtered at the scoring site, so 0.0 init is safe. New feature — matched_ion_current (MIC): Sum of experimental intensities over matched peaks. Computed in the existing postProcessHits_ alignment loop (no HyperScore changes), emitted as UserParam, and added to Percolator extra_features (ProSE only, matching how longest_peptide_ion_sequence is handled). SSE annotates but does not export. Safe today because SpectrumAlignment's default Da path produces 1-to-1 matches; documented inline. Reference idXML files regenerated — they were already stale before this branch due to float-precision drift from #9117 (matched_*_ions stored as float since 2026-04-09). The regeneration also absorbs the new delta_score and matched_ion_current UserParams. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs: update ion-series doc comments to prefix/suffix terminology Stale ///< doc comments on `prefix_fraction`/`suffix_fraction` and `matched_prefix_ions`/`matched_suffix_ions` (in ProSEAlgorithm.h and SimpleSearchEngineAlgorithm.h) and on `LONGEST_PEPTIDE_ION_SEQUENCE` (Constants.h) still referred to "b-ions"/"y-ions" after the rename. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Add missing entries for commits since the 2026-04-17 sync: - CometAdapter #9168: Bruker native-ID rewrite covers mzML inputs too - ProSE #9166: new -out_pin parameter for Percolator input file output - ProSE #9167: fix ions:add_* parameters honored in scoring path - ProSE #9175: BREAKING rename matched_b/y_ions → matched_prefix/suffix_ions; delta_score and matched_ion_current added; HyperScore ETD/EThcD fix - ProSE #9177: database chunking (-Search:database:chunk_size); Percolator feature and calibration fixes Co-authored-by: Copilot <[email protected]>
Add missing entries for commits since the 2026-04-17 sync: - CometAdapter #9168: Bruker native-ID rewrite covers mzML inputs too - ProSE #9166: new -out_pin parameter for Percolator input file output - ProSE #9167: fix ions:add_* parameters honored in scoring path - ProSE #9175: BREAKING rename matched_b/y_ions → matched_prefix/suffix_ions; delta_score and matched_ion_current added; HyperScore ETD/EThcD fix - ProSE #9177: database chunking (-Search:database:chunk_size); Percolator feature and calibration fixes Co-authored-by: GitHub Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
Summary
Fix a silent bug where ProSE's
ions:add_a/b/c/x/y/z_ionsparameters were declared but never read — making the index and scoring paths inconsistent for non-default ion types (ETD, EThcD).Closes item 12 in #9108.
The bug
ProSEAlgorithmconstructor (line 185-196) declares 6 ion-series toggle parameters with defaults (b/y on, a/c/x/z off). However:updateMembers_()never reads them — noparam_.getValue("ions:add_*")callsFragmentIndexreceives the params viasetParameters()and correctly builds the index with the user's ion selection ✅TheoreticalSpectrumGeneratorin the scoring loop (line 828-832) only setsadd_first_prefix_ionandadd_metainfo— always generates b/y regardless of user config ❌Result: User sets
-Search:ions:add_c_ions truefor ETD data → index contains c-ion fragments → scorer generates b/y theoretical peaks → c-ions in the index never match → worse scores than expected. Silent data-quality issue.The fix
boolmembers toProSEAlgorithm(header)updateMembers_()(6 lines)TheoreticalSpectrumGeneratorinsearch()(6 lines)Total: +23 lines, 2 files.
Usage after fix
Test plan
ProSE --helphelpshows all 6ions:add_*params under-Search:ions:subsection🤖 Generated with Claude Code
Summary by CodeRabbit