Repository navigation
[ProSE] Default tolerances + auto decoy mode (prefix/suffix), reconciled with FDR decoupling - #9644
Conversation
…tion 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 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]>
…uto-land # Conflicts: # src/openms/source/ANALYSIS/ID/ProSEAlgorithm.cpp # src/topp/ProSE.cpp
…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]>
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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughProSE's boolean ChangesProSE Decoy Strategy Refactor
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
…ostics 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]>
- ProSE (#9633, #9644): fix entry for protein-level FDR now applied for single-file runs; was previously silently skipped unless -out_merged was used in multi-file mode - pyOpenMS (#9629): fix entry for 6 docutils ERROR-level warnings in nanobind binding docstrings resolved Claude-Session: https://claude.ai/code/session_01XUrYEuLbeCJznCzV51iJjk Co-authored-by: Claude <[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]>
…9642) * [ProSE] Extensive end-of-search command-line report + JSON summary 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]> * [ProSE] Fix macOS/Windows build: move summary-JSON serialization into 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]> * [ProSE] review fixes: count report decoys by the resolved marker; header 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]> * [ProSE] Emit the end-of-search summary as YAML (hand-rolled, drop nlohmann) 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]> * [ProSE] address CodeRabbit review: matched_spectra count + stat-field 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]> * [ProSE] final review fixes: post-FDR target/decoy in collectRunStatistics_; 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, #9644 reconciliation intact. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [pyOpenMS] expose all FileTypes::Type values (add YAML + 9 pre-existing 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]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Brings the
feat/prose-default-tolerances-suffix-decoyslineage (new default tolerances + auto decoy mode, #9634) ontodevelop, reconciled with the already-merged ProSE FDR/decoy decoupling (#9633).What lands
decoysis now an enum{auto, generate, ignore}(defaultauto) — replaces the old boolean.autoreuses decoys already in the FASTA (marker auto-detected, prefix or suffix, viaDecoyHelper::findDecoyString) or generates them when absent;generatealways (re)builds from targets;ignoresearches target-only. Fixes latent bugs where a hardcodeddecoy_prefixposition was assumed.Reconciliation with #9633 (the new work in this PR vs. the feature branch)
#9634 predates #9633's FDR/decoy decoupling, so landing it required unifying the two decoy models:
decoy_string+is_prefix) through [FIX] ProSE: apply protein FDR for single-file runs; never per-file in multi-file #9633's FDR finalization —applyCompleteSetProteinFDRis now marker-aware (prefix/suffix), not hardcodedDECOY_.add_decoy_peptides; categorical decoy removal only at protein-FDR finalization), and its dangling-reference cleanup.FDR:protein>0), and both single-file/merged finalizers guard against running picked-protein FDR on a target-only set.Design note:
decoys=autoalways generates when absent (not FDR-gated)Decoys are generated whenever the FASTA lacks them, even with no ProSE-level FDR — because ProSE's external/downstream-FDR workflows are first-class and tested (
ProSE → FalseDiscoveryRateon idXML;ProSE → Percolator), and ProSE can't detect a coming external FDR step. (FDR-gating was prototyped and rejected:FalseDiscoveryRateon a decoy-free idXML silently assigns target q=0.) The ~2× cost of always-generating only affects a pure no-FDR search, which opts out withdecoys=ignore— an INFO hint points this out.Review
Thorough opus + codex review (verdict: ship-with-fixes, no blockers). Verified: decoupling preserved, marker threading correct (incl. suffix) through PeptideIndexing / picked-protein FDR / chunked / multi-file / merged, FragmentIndex boolean
decoysforced false on every build path, merged-path gating correct, tolerances coherent. Applied all agreed fixes:applyCompleteSetProteinFDRskip +buildDecoyAugmentedDB_throw on emptydecoy_prefixwhen generating);-out_merged-alone no longer rejected as "no output";decoysvalues;decoys=autoend-to-end TOPP test (ProSE_8_auto).Deferred as pre-existing follow-ups: the library
searchWithModificationAnalysisoverload not finalizing protein FDR;.pin/Percolator guards using DB-level vs PSM-level decoy labels.Tests
Unit
ProSEAlgorithm_test(incl. new suffix case) + all 38 TOPP tests pass locally —ProSE_1–8, the three Bruker.dDDA-PASEF tests, and the externalFalseDiscoveryRate_ProSEDDA/SimpleSearchEngineDDAworkflows.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
auto,generate,ignore) instead of boolean-style settings, including automatic reuse of existing decoys in input FASTA or controlled generation.Improvements
Bug Fixes
Other