Skip to content

MSGFPlusAdapter: add -allow_dense_centroided_peaks flag - #9461

Merged
timosachsenberg merged 1 commit into
developfrom
msgf-allow_dense_centroided_peaks
Jun 9, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
msgf-allow_dense_centroided_peaks

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Exposes MS-GF+'s -allowDenseCentroidedPeaks option in MSGFPlusAdapter. When set, high-resolution centroided MS2 spectra whose median consecutive-peak distance is below ~50 ppm are searched instead of being misclassified by MS-GF+ as profile spectra and silently skipped.

This revives and finishes #6606 (originally by @bernt-matthias), rebased onto current develop and squashed to a single clean commit. It also fixes two defects that were latent in the original PR:

  • Argument passing: the flag/value is now emitted as two separate tokens ("-allowDenseCentroidedPeaks", "1") instead of one space-joined string. process_params is an argv vector (boost::process::args), so each element becomes one argv entry with no whitespace splitting — the original "-allowDenseCentroidedPeaks 1" would have reached MS-GF+ as a single unparseable argument.
  • Test reference: every registered parameter is written into the idXML SearchParameters (via writeParametersToMetaValues, in registration order). Because FuzzyDiff compares lines positionally, the new UserParam line is added to the reference MSGFPlusAdapter_1_out.idXML rather than merely whitelisted (a whitelist cannot absorb an inserted line).

Changes

  • Register allow_dense_centroided_peaks flag in MSGFPlusAdapter.
  • Pass -allowDenseCentroidedPeaks 1 to MS-GF+ when the flag is set.
  • Record the new parameter in the MSGFPlusAdapter_1 reference idXML.
  • Add TOPP_MSGFPlusAdapter_2: runs the adapter with the flag enabled.

Testing

Verified locally against a real MS-GF+ run (MSGFPlus.jar, Java 21): the adapter runs succeed with the flag, the parameter is recorded as true/false, and direct diffs of the produced idXML/mzid against the references differ only in already-whitelisted lines (out / mzid_out / allow_dense_centroided_peaks / date / paths).

Remaining / follow-up

  • CHANGELOG entry
  • AUTHORS (original author already credited via co-author trailer on the commit)
  • The new test only verifies the flag is accepted and recorded. A dedicated dense-centroided MS2 fixture that fails without the flag (as requested in add MSGF+ allowDenseCentroidedPeaks parameter #6606) is still TODO.

Closes #6606

Summary by CodeRabbit

  • New Features

    • Added an option to allow searching dense (centroided) spectra so they are not skipped during analysis.
  • Tests

    • Added and updated tests to verify dense-centroided-peak handling; test outputs now record the chosen option value for verification.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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

  • Timo Sachsenberg

Please consider applying the following patch:

--- AUTHORS	2026-06-08 14:54:30.556526724 +0000
+++ AUTHORS.new	2026-06-08 14:54:35.938424885 +0000
@@ -22,8 +22,8 @@
  - Chirag Dave
  - Chris Bauer
  - Chris Bielow
- - Christie Mathews
  - Christian Ehrlich
+ - Christie Mathews
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 703a643a-b5cf-4f24-b79b-654122859598

📥 Commits

Reviewing files that changed from the base of the PR and between 01c99db and cb0656d.

📒 Files selected for processing (6)
  • src/tests/topp/PSMFeatureExtractor_1_out.idXML
  • src/tests/topp/PSMFeatureExtractor_2_out.mzid
  • src/tests/topp/PSMFeatureExtractor_3_out.idXML
  • src/tests/topp/THIRDPARTY/MSGFPlusAdapter_1_out.idXML
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake
  • src/topp/MSGFPlusAdapter.cpp
✅ Files skipped from review due to trivial changes (3)
  • src/tests/topp/PSMFeatureExtractor_3_out.idXML
  • src/tests/topp/PSMFeatureExtractor_1_out.idXML
  • src/tests/topp/THIRDPARTY/MSGFPlusAdapter_1_out.idXML
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/topp/MSGFPlusAdapter.cpp
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake

📝 Walkthrough

Walkthrough

MSGFPlusAdapter adds a boolean CLI flag allow_dense_centroided_peaks that, when set, appends -allowDenseCentroidedPeaks 1 to the MSGF+ invocation. Tests and expected outputs are updated to include the new parameter value.

Changes

MSGF+ Dense Centroided Peaks Feature

Layer / File(s) Summary
Dense centroided peaks parameter in adapter
src/topp/MSGFPlusAdapter.cpp
Registers allow_dense_centroided_peaks boolean CLI flag and conditionally appends -allowDenseCentroidedPeaks 1 to process arguments.
Test configuration and expected output for dense centroided peaks
src/tests/topp/THIRDPARTY/third_party_tests.cmake, src/tests/topp/THIRDPARTY/MSGFPlusAdapter_1_out.idXML, src/tests/topp/PSMFeatureExtractor_1_out.idXML, src/tests/topp/PSMFeatureExtractor_2_out.mzid, src/tests/topp/PSMFeatureExtractor_3_out.idXML
Adds test case TOPP_MSGFPlusAdapter_2 and dependent diff checks; updates expected-output files to record MSGFPlusAdapter:1:allow_dense_centroided_peaks set to false, with the parameter whitelisted in diffs.

Suggested labels: Review effort 2/5

Suggested reviewers:

  • jpfeuffer

"A rabbit hops, I code and peep,
Flags set true or set to sleep,
MSGF+ will hear,
Dense peaks now draw near,
Hooray — the tests shall keep!" 🐇

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive The PR addresses the primary coding requirement from issue #6606 (add -allowDenseCentroidedPeaks parameter and test), but the CHANGELOG and AUTHORS updates mentioned in the checklist are not yet completed per the PR summary. Confirm whether CHANGELOG and AUTHORS updates are expected as part of this PR or deferred to follow-up work, and verify all required coding objectives from #6606 are fully implemented.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'MSGFPlusAdapter: add -allow_dense_centroided_peaks flag' clearly describes the main change: adding a new flag parameter to MSGFPlusAdapter.
Out of Scope Changes check ✅ Passed All changes are directly related to adding the -allow_dense_centroided_peaks flag to MSGFPlusAdapter and updating corresponding test references and fixtures.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch msgf-allow_dense_centroided_peaks

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

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/tests/topp/THIRDPARTY/third_party_tests.cmake (1)

116-116: ⚡ Quick win

Whitelist patterns are inconsistent with established convention.

The whitelist entries on line 116 use shortened patterns that differ from the convention established in line 103:

  • "MSGFPlusAdapter:1:out\"" and "MSGFPlusAdapter:1:mzid_out\"" include a trailing quote but omit the full attribute pattern
  • "MSGFPlusAdapter:1:allow_dense_centroided_peaks" is a bare substring

The established pattern from line 103 is:

"UserParam type=\"string\" name=\"MSGFPlusAdapter:1:database\" value="

While substring matching may work, the shortened patterns are less precise and could match unintended lines. For consistency and maintainability, consider using the full pattern:

♻️ Suggested patterns matching established convention
-add_test("TOPP_MSGFPlusAdapter_2_out1" ${DIFF} -in1 MSGFPlusAdapter_2_out1.tmp.idXML -in2 ${DATA_DIR_TOPP}/THIRDPARTY/MSGFPlusAdapter_1_out.idXML -whitelist "IdentificationRun date" "SearchParameters id=\"SP_0\" db=" "UserParam type=\"stringList\" name=\"spectra_data\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:in\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:executable\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:database\" value=" "MSGFPlusAdapter:1:out\"" "MSGFPlusAdapter:1:mzid_out\"" "MSGFPlusAdapter:1:allow_dense_centroided_peaks")
+add_test("TOPP_MSGFPlusAdapter_2_out1" ${DIFF} -in1 MSGFPlusAdapter_2_out1.tmp.idXML -in2 ${DATA_DIR_TOPP}/THIRDPARTY/MSGFPlusAdapter_1_out.idXML -whitelist "IdentificationRun date" "SearchParameters id=\"SP_0\" db=" "UserParam type=\"stringList\" name=\"spectra_data\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:in\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:executable\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:database\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:out\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:mzid_out\" value=" "UserParam type=\"string\" name=\"MSGFPlusAdapter:1:allow_dense_centroided_peaks\" value=")
🤖 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/topp/THIRDPARTY/third_party_tests.cmake` at line 116, The whitelist
for the test "TOPP_MSGFPlusAdapter_2_out1" uses shortened/ambiguous substrings;
update the three entries ("MSGFPlusAdapter:1:out\"",
"MSGFPlusAdapter:1:mzid_out\"", and
"MSGFPlusAdapter:1:allow_dense_centroided_peaks") to the full attribute-style
patterns consistent with the existing convention (e.g. use the same form as
"UserParam type=\"string\" name=\"MSGFPlusAdapter:1:database\" value="), so
replace those shortened substrings with fully qualified UserParam patterns that
include type, name and value= (properly escaped) for MSGFPlusAdapter:1:out,
MSGFPlusAdapter:1:mzid_out and MSGFPlusAdapter:1:allow_dense_centroided_peaks.
🤖 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/tests/topp/THIRDPARTY/third_party_tests.cmake`:
- Line 116: The whitelist for the test "TOPP_MSGFPlusAdapter_2_out1" uses
shortened/ambiguous substrings; update the three entries
("MSGFPlusAdapter:1:out\"", "MSGFPlusAdapter:1:mzid_out\"", and
"MSGFPlusAdapter:1:allow_dense_centroided_peaks") to the full attribute-style
patterns consistent with the existing convention (e.g. use the same form as
"UserParam type=\"string\" name=\"MSGFPlusAdapter:1:database\" value="), so
replace those shortened substrings with fully qualified UserParam patterns that
include type, name and value= (properly escaped) for MSGFPlusAdapter:1:out,
MSGFPlusAdapter:1:mzid_out and MSGFPlusAdapter:1:allow_dense_centroided_peaks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3a476170-7ff5-432f-9bcd-cb0e87d747f2

📥 Commits

Reviewing files that changed from the base of the PR and between 1a585a1 and 01c99db.

📒 Files selected for processing (3)
  • src/tests/topp/THIRDPARTY/MSGFPlusAdapter_1_out.idXML
  • src/tests/topp/THIRDPARTY/third_party_tests.cmake
  • src/topp/MSGFPlusAdapter.cpp

Expose MS-GF+'s -allowDenseCentroidedPeaks option so that high-resolution
centroided MS2 spectra whose median consecutive-peak distance is below
~50 ppm are searched instead of being misclassified as profile spectra and
silently skipped.

Squashed/rebased revival of PR #6606 (originally by Matthias Bernt), ported
onto the refactored std::vector<String> process_params. The flag is passed
as two separate argv tokens ("-allowDenseCentroidedPeaks" "1") rather than a
single space-joined token, so MS-GF+ actually parses it (boost::process maps
each vector element to one argv entry, with no whitespace splitting).

- register the flag in MSGFPlusAdapter
- record the new parameter in the MSGFPlusAdapter_1 reference idXML (it is
  written to SearchParameters for every run via writeParametersToMetaValues)
- add TOPP_MSGFPlusAdapter_2 smoke test that enables the flag
- update the PSMFeatureExtractor_1/2/3 references, which consume
  MSGFPlusAdapter_1_out.idXML as input fixture, so the new (positionally
  significant) UserParam line stays aligned in their idXML/mzid output

Note: the new MSGFPlus test only verifies the flag is accepted and recorded;
a dedicated dense-centroided fixture that fails without the flag is still TODO.

Co-authored-by: Matthias Bernt <[email protected]>
Co-authored-by: Julianus Pfeuffer <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg force-pushed the msgf-allow_dense_centroided_peaks branch from 01c99db to cb0656d Compare June 9, 2026 05:19
@timosachsenberg
timosachsenberg merged commit 6028ec1 into develop Jun 9, 2026
40 checks passed
@timosachsenberg
timosachsenberg deleted the msgf-allow_dense_centroided_peaks branch June 9, 2026 07:25
timosachsenberg added a commit that referenced this pull request Jun 12, 2026
Two issues addressed:

1. Serialize TOPP_MSGFPlusAdapter_2 after TOPP_MSGFPlusAdapter_1 in
   CTest (DEPENDS). Both tests share the same proteins.fasta and
   spectra.mzML; MSGF+ creates temp/cache files alongside those inputs,
   causing file-access conflicts on Windows when the two tests run in
   parallel. Parallel execution was never safe for these tests — they were
   just never co-scheduled until test 2 was added in #9461.

2. Fix scan-number extraction from SpecID in the legacy TSV fallback path
   (MSGFPlusAdapter.cpp). PR #9450 changed elements[1] from OpenMS::String
   to std::string and replaced `elements[1].suffix('=').toInt()` with
   `StringUtils::toInt32(elements[1])`. For SpecIDs of the form
   "controllerType=0 controllerNumber=1 scan=17" the old call extracted
   the integer after the last '='; the new call tries to convert the whole
   string and throws ConversionError. Restore the correct behaviour with
   rfind('=') + substr.

https://claude.ai/code/session_01RjUeua8ecNatvyBSSjfeGe

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