Repository navigation
[ProSE] Auto decoy mode (detect-or-generate, prefix/suffix aware) - #9634
Merged
timosachsenberg merged 2 commits intoJun 19, 2026
Merged
timosachsenberg merged 2 commits into
timosachsenberg merged 2 commits into
Conversation
…port
Replace the boolean 'decoys' (true/false) with a three-way mode that lets
the user decide less:
- auto (default): ensure decoys are available for target-decoy FDR — reuse
decoys already present in the database (marker auto-detected via
DecoyHelper, prefix or suffix, falling back to decoy_prefix for custom
markers) or generate them from the targets if none are found.
- generate: always (re)build decoys from the targets; any pre-existing
decoys are stripped first to avoid decoy-of-decoy entries.
- ignore: search the targets only; any decoys in the database are removed.
A single resolveDecoyStrategy_() resolves the decoy handling once per input
database into a DecoyStrategy_ (generate / strip / effective marker+position
/ have_decoys). The result is threaded through every search path (in-memory,
chunked, single-context, file-based, multi-file) via the SearchContext and a
new searchChunked_ parameter, so PeptideIndexing and picked-protein FDR use
the same decoys that were searched. This fixes prior latent bugs where the
marker/position for external (non-DECOY_, or suffix) decoys was hardcoded.
The effective marker is also surfaced on MultiFileSearchResult so the ProSE
tool's -out_merged protein-FDR step recognises the right decoys.
FragmentIndex declares its own unused boolean 'decoys' flag; ProSE now hands
it FI-safe parameters (fragmentIndexParameters_) so the enum value never trips
FI's validation.
Supersedes the prefix/suffix helpers from the parent branch with the more
capable DecoyHelper-based detection. Updates the class test (auto/generate/
ignore + custom-marker fallback), the TOPP reference inis, and the DDA test
commands (the old valueless -Search:decoys flag now takes an explicit value).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
DecoyHelper::findDecoyString logged ERROR/WARN ("Unable to determine decoy
string...") whenever fewer than 40% of proteins carried a decoy marker. For
ProSE's auto/generate modes a target-only database is a normal case (decoys
are then synthesised), so the message was misleading noise.
Add an opt-in 'quiet' flag (default false → unchanged for all existing
callers such as PeptideIndexing) that suppresses these log lines, and pass
quiet=true from ProSE's resolveDecoyStrategy_, which handles the negative
result itself.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
timosachsenberg
merged commit Jun 19, 2026
84ad389
into
feat/prose-default-tolerances-suffix-decoys
1 check passed
timosachsenberg
added a commit
that referenced
this pull request
Jun 20, 2026
…o decoy mode) (#9637) Two recently merged PRs were missing from the 3.6.0 changelog: - #9521: MSImagingRegion + multi-region support in MSImagingGeometry/MSImagingExperiment - #9634: ProSE Search:decoys three-way enum (auto/generate/ignore) replacing the boolean Claude-Session: https://claude.ai/code/session_01Kd4QCxoucuh5b3U5gSQtH1 Co-authored-by: Claude <[email protected]>
This was referenced Jun 20, 2026
timosachsenberg
added a commit
that referenced
this pull request
Jun 21, 2026
…led with FDR decoupling (#9644) * [ProSE] New default tolerances (10/20 ppm) + suffix-aware decoy detection Change the ProSEAlgorithm defaults to a precursor mass tolerance of 10 ppm (lower/upper) and a fragment mass tolerance of 20 ppm, matching typical high-resolution Orbitrap settings. Recognise pre-existing decoys whether the configured decoy marker is a prefix or a suffix of the protein accession (e.g. "DECOY_PROT" or "PROT_DECOY"). No extra parameter: isDecoyAccession_() tests both orientations, and detectDecoyStringPosition_() picks the right "decoy_string_position" for PeptideIndexing from the database itself. Adds test coverage for the new defaults and the prefix/suffix detection. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [ProSE] Auto decoy mode (detect-or-generate, prefix/suffix aware) (#9634) * [ProSE] Auto decoy mode: detect existing or generate, with suffix support Replace the boolean 'decoys' (true/false) with a three-way mode that lets the user decide less: - auto (default): ensure decoys are available for target-decoy FDR — reuse decoys already present in the database (marker auto-detected via DecoyHelper, prefix or suffix, falling back to decoy_prefix for custom markers) or generate them from the targets if none are found. - generate: always (re)build decoys from the targets; any pre-existing decoys are stripped first to avoid decoy-of-decoy entries. - ignore: search the targets only; any decoys in the database are removed. A single resolveDecoyStrategy_() resolves the decoy handling once per input database into a DecoyStrategy_ (generate / strip / effective marker+position / have_decoys). The result is threaded through every search path (in-memory, chunked, single-context, file-based, multi-file) via the SearchContext and a new searchChunked_ parameter, so PeptideIndexing and picked-protein FDR use the same decoys that were searched. This fixes prior latent bugs where the marker/position for external (non-DECOY_, or suffix) decoys was hardcoded. The effective marker is also surfaced on MultiFileSearchResult so the ProSE tool's -out_merged protein-FDR step recognises the right decoys. FragmentIndex declares its own unused boolean 'decoys' flag; ProSE now hands it FI-safe parameters (fragmentIndexParameters_) so the enum value never trips FI's validation. Supersedes the prefix/suffix helpers from the parent branch with the more capable DecoyHelper-based detection. Updates the class test (auto/generate/ ignore + custom-marker fallback), the TOPP reference inis, and the DDA test commands (the old valueless -Search:decoys flag now takes an explicit value). Co-Authored-By: Claude Opus 4.8 <[email protected]> * [ProSE] Silence DecoyHelper noise on target-only databases DecoyHelper::findDecoyString logged ERROR/WARN ("Unable to determine decoy string...") whenever fewer than 40% of proteins carried a decoy marker. For ProSE's auto/generate modes a target-only database is a normal case (decoys are then synthesised), so the message was misleading noise. Add an opt-in 'quiet' flag (default false → unchanged for all existing callers such as PeptideIndexing) that suppresses these log lines, and pass quiet=true from ProSE's resolveDecoyStrategy_, which handles the negative result itself. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]> * [ProSE] decoys=auto: keep always-generate; add discoverability + out_pin guard Per the codex/opus design discussion: do NOT FDR-gate decoys=auto. ProSE's external/ downstream-FDR workflows (ProSE -> FalseDiscoveryRate on idXML, ProSE -> Percolator) and deferred/sharded FDR rely on auto producing target+decoy PSMs even when no ProSE-level FDR is requested; ProSE cannot detect that an external FDR step is coming, and FalseDiscoveryRate on a decoy-free idXML silently assigns q=0 rather than failing. So "generate whenever decoys are absent" is the correct, safe default. Two small hardenings: - INFO log when auto generates decoys with no ProSE FDR, pointing at decoys=ignore for a genuinely target-only search (discoverability for the ~2x index/scoring cost). - Warn when -out_pin is requested but the run is target-only (decoys=ignore): the .pin would contain no decoys and external Percolator cannot estimate FDR from it. Mirrors the existing in-process Percolator decoy guard. - Value-form wording in the in-process Percolator decoy warning. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [ProSE] decoy-auto landing: opus+codex review fixes Thorough opus+codex review of the #9634/#9633 reconciliation (verdict: ship-with-fixes, no blockers). Address the agreed in-scope items: - Empty-marker guards (both reviewers): applyCompleteSetProteinFDR early-returns with a warning on an empty decoy marker (hasPrefix(x,"") is always true -> would treat all proteins as decoys); buildDecoyAugmentedDB_ throws if asked to generate with an empty decoy_prefix (decoy accessions would equal their targets); the merged-path protein-FDR guard also skips on an empty marker. - TOPP -out_merged alone is no longer rejected as "no output specified". - pyOpenMS test_modification_discovery.py: decoys true/false -> generate/ignore (the old boolean values are invalid under the new {auto,generate,ignore} enum and would throw). - Coverage: a suffix-marker resolveDecoyStrategy_ unit case (the prefix-OR-suffix headline feature was prefix-only tested) and an unconditional TOPP_ProSE_8_auto end-to-end test (decoys=auto previously ran only under the WITH_OPENTIMS-gated Bruker tests). Deferred as pre-existing follow-ups (not #9634-introduced): the library searchWithModificationAnalysis overload not finalizing protein FDR; .pin/Percolator guards using DB-level vs PSM-level decoy labels. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [ProSE] review follow-ups: tolerance-default visibility + decoy diagnostics From the second opus+codex review of #9644 (keep the 10 ppm precursor default): - CHANGELOG: document the default tolerance change (precursor 20->10, fragment 10->20 ppm) that was otherwise bundled silently; note the calibration-drift caveat. - Fix stale member initializers precursor_mass_tolerance_lower_/upper_ {20.0} -> {10.0} so they match the param default (they are read in the const search() path). - decoys=auto now logs the auto-detected decoy marker when reusing existing decoys (prefix or suffix), so a rare DecoyHelper misdetection is diagnosable (previously reuse logged nothing). - decoys=generate warns when the database carries sub-threshold decoy-like accessions that are not stripped (would become decoys-of-decoys), pointing at -Search:decoy_prefix. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
This was referenced Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes ProSE's decoy handling decide-less: replaces the boolean
Search:decoys(true/false) with a three-way mode.auto(default)generateignoreautoalways ensures decoys are present for target-decoy FDR — the user typically just sets an FDR threshold and nothing else.ignoreis the explicit opt-out for a pure target-only search.How it works
A single
resolveDecoyStrategy_(db)resolves decoy handling once per input database into aDecoyStrategy_(generate / strip-existing / effective marker+position / have_decoys). Existing decoys are detected with the codebase'sDecoyHelper::findDecoyString(common-marker vocabulary, prefix or suffix), falling back to a literaldecoy_prefixscan for custom markers.The strategy is threaded through every search path (in-memory, chunked, single-context, file-based, multi-file) via
SearchContextand a newsearchChunked_parameter, soPeptideIndexingand picked-protein FDR use the same decoys that were searched. This fixes prior latent bugs where the decoy marker/position was hardcoded (decoy_prefix+prefix) for the protein-FDR and PeptideIndexing steps — wrong for external suffix/non-DECOY_decoys.The effective marker is also surfaced on
MultiFileSearchResultso the ProSE tool's-out_mergedcross-file protein-FDR recognises the right decoys.FragmentIndex param collision
FragmentIndexdeclares its own (unused) booleandecoysflag{true,false}. ProSE forwardsgetParameters()to it, so the new enum value would trip FI's validation. ProSE now hands FI sanitised params viafragmentIndexParameters_()(overridesdecoystofalse; ProSE manages decoys at the DB level).Relationship to #9632
Stacked on
feat/prose-default-tolerances-suffix-decoys(#9632). This supersedes that PR'sisDecoyAccession_/detectDecoyStringPosition_helpers with the more capableDecoyHelper-based detection. Base retargets todeveloponce #9632 merges.Behavior change
false(no decoys, FDR silently skipped on target-only DBs) toauto(decoys ensured). Strict improvement; concatenated target+decoy DBs are unchanged (existing decoys reused, never double-generated).decoysvalid-strings change bool→enum (no bool compat) — the three TOPP reference inis and the DDA test commands (old valueless-Search:decoysflag) are updated.Tests
ProSEAlgorithm_test: new section covering auto-reuse / auto-generate / ignore-strip / generate-strip-regenerate / custom-marker fallback.TOPP_ProSE*tests pass, including the DDA FDR PSM-count floors (≥4350 / 4650 / 4400) on real Bruker data — confirming auto-mode generates decoys with equivalent FDR yields.🤖 Generated with Claude Code