Repository navigation
feat(ProSE): add -out_pin for Percolator input file output - #9166
Conversation
Registers -out_pin <files> (per-input, like -out_idxml) that writes Percolator .pin/.tsv files via PercolatorInfile::store(). Works independently of -percolator_executable — users can produce .pin files for external rescoring without running Percolator from within ProSE. The search algorithm already populates the extra_features metavalue on ProteinIdentification::SearchParameters with the correct feature set (score, fragment_error_median_ppm, matched_prefix/suffix_ions_ fraction). This commit just wires it through the TOPP tool's CLI and output loop. Closes item 4 in #9108. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[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 (1)
📝 WalkthroughWalkthroughAdds a per-input output mode Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as "User/CLI"
participant ProSE as "ProSE (TOPP tool)"
participant Percolator as "PercolatorInfile"
participant FS as "Filesystem / Logger"
CLI->>ProSE: invoke with `-in` files + `-out_pin` list
ProSE->>ProSE: validate outputs & counts
loop per input file
ProSE->>ProSE: build feature list (score, extra_features, Peptide, Proteins)
ProSE->>ProSE: derive enzyme, min/max charge
ProSE->>Percolator: PercolatorInfile::store(feature_list, params)
Percolator->>FS: write .pin/.tsv file
alt write error
Percolator->>FS: log error for that input
FS->>ProSE: return failure for input (continue)
end
end
ProSE->>CLI: exit status (with per-input failures logged)
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)
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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/topp/ProSE.cpp`:
- Line 456: The code uses result.protein_ids.front() without ensuring the vector
is non-empty; update the ProSE.cpp logic around the line with
result.protein_ids.front().getSearchParameters() to first check
!result.protein_ids.empty() (the same guard used in the test-mode branch) and
handle the empty case explicitly (e.g., log an error via the same logger,
set/return an appropriate exit_code or throw a clear exception) before
attempting to call getSearchParameters(); this prevents undefined behavior and
matches the existing handling pattern.
- Around line 466-471: The min_charge parsing currently calls
String(sp.charges).toInt() on the full "min:max" string which throws; change
min_charge to extract the substring before ':' (like max_charge does for the
part after ':') and then convert that substring with String::toInt() (use
sp.charges.find(':') and substr(0,pos) or fall back to the whole string if no
colon). Update the code around the min_charge and max_charge computation in
ProSE.cpp where min_charge, max_charge and sp.charges are handled so both use
the same colon-splitting logic and avoid ConversionError.
- Around line 457-464: The .pin header is duplicating "score" because ProSE.cpp
builds feature_set with a hardcoded "score" then appends extra_features from the
SearchParameters (which already include "score" from ProSEAlgorithm); update the
block in ProSE.cpp around the feature_set construction to either remove the
hardcoded insertion or guard it: when populating feature_set (the variable
created in ProSE.cpp that uses sp.getMetaValue("extra_features")), check if
"score" is already present in the parsed extra_features before inserting "score"
(or simply rely exclusively on extra_features and drop the initial hardcoded
"score"); adjust the logic that does feature_set.insert / push_back so "score"
appears only once in the Percolator .pin header.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Three bugs found by CodeRabbit, all in the .pin output block: 1. (Critical) min_charge parsed via String(sp.charges).toInt() on the full "2:5" string — throws ConversionError, silently preventing .pin output on every run. Fixed: split on ':' for both min and max. 2. (Major) Duplicate "score" column — hardcoded "score" + extra_features (which already contains "score") → malformed .pin header. Fixed: only insert "score" if not already present in extra_features. 3. (Minor) result.protein_ids.front() without empty guard. Fixed: check empty and log error before accessing. 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
Add
-out_pin <files>option to ProSE for writing Percolator input (.pin/.tsv) files. Works independently of-percolator_executable— users can produce .pin files for external rescoring without running Percolator from within ProSE.Closes item 4 in #9108 ("Quick wins — low effort, high impact").
Implementation
-out_pinasOutputFileListwithtsvformat validation (matches-out_idxmlsemantics: one output per input, count validated)extra_featuresfromProteinIdentification::SearchParameters(already populated byProSEAlgorithmwithscore,fragment_error_median_ppm,matched_prefix/suffix_ions_fraction)PercolatorInfile::store(out_pin_list[i], result.peptide_ids, feature_set, enzyme, min_charge, max_charge)-out_pincounts as a valid output for the "at least one output required" checkDiff
1 file changed, 47 insertions, 2 deletions. All in
src/topp/ProSE.cpp.Test Plan
ProSE --helphelpshows-out_pinwith correct description and format validationProSE -in test.mzML -database test.fasta -out_pin test.tsvproduces a valid .pin file readable by Percolator (manual verification — no .pin-specific test fixture in CI)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements