Skip to content

[FEATURE] OpenNuXL rescores in process with the built-in Percolator (Percolator::rescorePSMsAsExecutable) - #10837

Closed
timosachsenberg wants to merge 1 commit into
developfrom
feature/nuxl-inprocess-percolator
Closed

timosachsenberg wants to merge 1 commit into
developfrom
feature/nuxl-inprocess-percolator

Conversation

@timosachsenberg

Copy link
Copy Markdown
Contributor

Description

With -percolator_backend builtin (the default), OpenNuXL ran PercolatorAdapter as a subprocess, and the adapter rescored the PSMs in process with the Percolator built into OpenMS. Two times per search, the autotune and the final rescoring: OpenNuXL wrote an idXML, the adapter read it, rescored, wrote an idXML, and OpenNuXL read that back. OpenNuXL now rescores the PSMs itself. The part PercolatorAdapter's in-process backend did is moved into the library, so that both share it.

Library: Percolator::rescorePSMsAsExecutable(peptide_ids, feature_set, enzyme, min_charge, max_charge, ExecutableOptions)

  • ExecutableOptions are the percolator executable's options, with PercolatorAdapter's defaults: c_pos 0 (by cross-validation, instead of the class's 0.1), subset_max_train 0, TDC and train_best_positive off, plus the score type, the threads and an optional .pin file.
  • The function writes the .pin file (optional), sets the parameters from the options as the adapter set them (nonparametric PEPs, at most 3 threads, 0 or less: 3), and calls rescorePSMs(). That is the adapter's former in-process block, unchanged.
  • PercolatorAdapter's in-process backend calls it. Its behavior does not change: same parameters, same order, and the weights and error handling stay where they were. Its TOPP tests therefore also cover what OpenNuXL now uses.
  • Percolator_test: a section compares it with rescorePSMs() and the parameters set by hand (scores and q-values of all 600 PSMs). It also checks the parameters (c_pos 0, 8 threads → 3, 0 → 3, uni, nonparametric) and the .pin file (header and 600 rows).

OpenNuXL

  • recalibration_() chooses the backend as before. 'executable' with the percolator executable found runs PercolatorAdapter exactly as before; 'builtin', or 'executable' with the executable not found, now rescores in process (rescoreInProcess_()).
  • rescoreInProcess_() does what PercolatorAdapter did around its rescoring:
    • hits without target/decoy annotation count as targets; without a decoy, nothing is rescored;
    • the feature set: the standard .pin features for the hits' charge range, the search's extra_features, Peptide, Proteins;
    • the enzyme as OpenNuXL passed it (lys-c for Lys-C, else trypsin);
    • the model weights (.weights, _sse_perc.weights);
    • the PSMs refer to the run, and the runs are marked as post-processed by Percolator (search engine "Percolator", "3.08-vendored", meta value percolator = "OpenNuXL", Percolator:* search parameters, as ProSE marks its in-process rescoring).
  • Autotune: rescores copies of the PSMs. The files _sse_perc_in.idXML and _sse_perc_out.idXML were only the adapter's input and output, and are no longer written.
  • Final rescoring: rescores the PSMs of -out with all their hits, as the adapter read them (protein_ids/peptide_ids are filtered by that point). It still writes _perc.idXML (the rescored PSMs) and the .pin file (.tsv).
  • The log lines "Running percolator." and "done." stay; a failure gives the same warnings as before and keeps the original results.

So OpenNuXL's default rescoring needs no PercolatorAdapter beside it (the NuXL desktop app bundles it only for this), and no second process.

Trade-off: a hard crash inside Percolator now ends the search, where before only the adapter process died and OpenNuXL went on without rescoring. Exceptions are caught as before.

Testing

  • Not built locally (no OpenMS build here). The three changed sources and Percolator_test.cpp pass g++-13 -std=c++23 -fsyntax-only, against the source tree's headers with stand-in generated headers (OpenNuXL.cpp also with -Wall -Wextra, without warnings).
  • PercolatorAdapter's TOPP tests check that its output is unchanged.
  • The TOPP_OpenNuXL tests have fewer than 1000 PSMs, so they do not reach the rescoring. The in-process path is covered by Percolator_test (the shared function), and will be checked end to end with a larger .raw search in the NuXL desktop app's CI once its OpenMS pin includes this.

Checklist

  • Make sure that you are listed in the AUTHORS file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes (not built locally, see Testing)
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.) (none needed: the new method is for C++ tools; pyOpenMS binds rescorePSMs as before)

Generated by Claude Code

…::rescorePSMsAsExecutable)

With -percolator_backend builtin (the default), OpenNuXL ran PercolatorAdapter as a subprocess, which
rescored the PSMs in process with the Percolator built into OpenMS: idXML written, read by the adapter,
written again and read back. OpenNuXL now does that itself, through what PercolatorAdapter's in-process
backend does, moved into the library:

- Percolator::rescorePSMsAsExecutable(peptide_ids, feature_set, enzyme, min_charge, max_charge,
  ExecutableOptions): the .pin file (optional), the parameters from the percolator executable's options
  with PercolatorAdapter's defaults (c_pos 0 by cross-validation, nonparametric PEPs, at most 3
  threads, ...) and rescorePSMs(). PercolatorAdapter's in-process backend calls it (no change in
  behavior); Percolator_test checks it against rescorePSMs() with the parameters set by hand.
- OpenNuXL::rescoreInProcess_: what PercolatorAdapter does around it (target/decoy annotations, a
  decoy, the feature set of the hits' charges and the search's extra_features, the enzyme as OpenNuXL
  passed it, the weights, the run identifier, the runs marked as post-processed by Percolator).
  The autotune rescoring works on copies of the PSMs (no _sse_perc_in/_out.idXML any more); the final
  one on the PSMs of -out, as PercolatorAdapter read them, and still writes _perc.idXML and the .pin
  file (.tsv). -percolator_backend executable runs PercolatorAdapter as before.

So OpenNuXL's builtin rescoring needs no PercolatorAdapter beside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmXPcqYYZEuE4GfN2xA
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 247edd66-8954-4b0f-81b6-176b8f61465b
Commits

Reviewing files that changed from the base of the PR and between 05518e6 and aec598d.

Files selected for processing: 5

  • src/openms/include/OpenMS/ANALYSIS/ID/Percolator.h
  • src/openms/source/ANALYSIS/ID/Percolator.cpp
  • src/tests/class_tests/openms/source/Percolator_test.cpp
  • src/topp/OpenNuXL/OpenNuXL.cpp
  • src/topp/PercolatorAdapter.cpp
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

timosachsenberg added a commit that referenced this pull request Nov 7, 2026
…OpenNuXL share the feature set and run marking (#10843)

* Share the feature set and run marking of Percolator rescoring (PercolatorAdapter, ProSE)

PercolatorAdapter and ProSE each assembled the .pin feature set of a search run and marked
the rescored runs as post-processed by Percolator with their own copy of the code. Two library
helpers replace those copies, so that a third tool (OpenNuXL) can rescore in process without
another copy and without a second set of Percolator options:

- PercolatorInfile::getFeatureSet(search_parameters, min_charge, max_charge): the standard
  features, the run's 'extra_features' (without them: "score"), Peptide, Proteins.
- Percolator::markRescoredRuns(runs, tool, settings, version): search engine "Percolator"
  (Percolator::VENDORED_VERSION by default), meta value 'percolator' = tool, and the
  'Percolator:<name>' search parameters in the order given (an empty value removes one).

Percolator itself is still configured only through its Param. Both tools pass their settings
in the existing order and with the existing value types (the adapter's flags as int, ProSE's
as "true"/"false"), so their output does not change. pyOpenMS binds both helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmYcaEWwX7EQyVSrp2b

* OpenNuXL rescores in process with the built-in Percolator

With '-percolator_backend builtin' (the default), OpenNuXL ran PercolatorAdapter as a
subprocess (idXML out, idXML back), which then rescored in process. OpenNuXL now rescores the
PSMs itself: it sets Percolator's Param where PercolatorAdapter's defaults differ from the
class's (c_pos 0 by cross-validation, subset_max_train 0, nonparametric PEPs, unitnorm for the
final rescoring, at most 3 threads), builds the feature set with
PercolatorInfile::getFeatureSet(), calls rescorePSMs(), writes the weights (and the .pin of the
final rescoring), and marks the runs with Percolator::markRescoredRuns(). '-percolator_backend
executable' still runs the executable through PercolatorAdapter.

Based on the OpenNuXL part of #10837, without its Percolator::rescorePSMsAsExecutable() and
ExecutableOptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmYcaEWwX7EQyVSrp2b

* Percolator::markRescoredRuns docs: escape <name> for Doxygen

Doxygen read 'Percolator:<name>' as an unsupported HTML tag (Doxygen_Warning_test).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmYcaEWwX7EQyVSrp2b

* OpenNuXL in-process rescoring: merge the run as PercolatorAdapter merges its input

PercolatorAdapter reads its input through PercolatorFeatureSetHelper::mergeMULTISEProteinIds(), which
keeps the original search engine and its settings as the search parameters 'SE:OpenNuXL' and
'OpenNuXL:...' (read by ProteinIdentification::getOriginalSearchEngineName() and the mzTab export) and
sorts the protein hits by accession. The in-process rescoring did not, so its runs lost that
provenance. On a PXD048145 run, the rescored output now equals the former PercolatorAdapter output
apart from the Percolator settings and the 'percolator' marker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0149aXmYcaEWwX7EQyVSrp2b

---------

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.

2 participants