Skip to content

feat(ProSE): add -out_pin for Percolator input file output - #9166

Merged
timosachsenberg merged 3 commits into
developfrom
feat/prose-out-pin
Apr 17, 2026
Merged

timosachsenberg merged 3 commits into
developfrom
feat/prose-out-pin

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Register -out_pin as OutputFileList with tsv format validation (matches -out_idxml semantics: one output per input, count validated)
  • In the per-file output loop, extract extra_features from ProteinIdentification::SearchParameters (already populated by ProSEAlgorithm with score, fragment_error_median_ppm, matched_prefix/suffix_ions_fraction)
  • Call PercolatorInfile::store(out_pin_list[i], result.peptide_ids, feature_set, enzyme, min_charge, max_charge)
  • -out_pin counts as a valid output for the "at least one output required" check

Diff

1 file changed, 47 insertions, 2 deletions. All in src/topp/ProSE.cpp.

Test Plan

  • ProSE --helphelp shows -out_pin with correct description and format validation
  • Clean build on Linux
  • End-to-end: ProSE -in test.mzML -database test.fasta -out_pin test.tsv produces 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

    • Per-input export of Percolator-compatible .pin/.tsv files.
  • Improvements

    • Require at least one output format be specified; when per-input .pin export is enabled, output count must match inputs.
    • .pin generation now derives feature fields and charge/enzyme bounds from search parameters and logs per-file failures without stopping other outputs.

timosachsenberg and others added 2 commits April 17, 2026 08:28
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]>
@coderabbitai

coderabbitai Bot commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

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: 4c736182-9047-44a1-8d81-d1ab14d91d97

📥 Commits

Reviewing files that changed from the base of the PR and between 9affbd4 and 5bc4745.

📒 Files selected for processing (1)
  • src/topp/ProSE.cpp

📝 Walkthrough

Walkthrough

Adds a per-input output mode -out_pin to write Percolator-compatible .pin/.tsv files. Requires at least one output (-out_idxml, -out_pin, -out_qpx, -out_parquet) and enforces -out_pin count matches -in files. PIN files are generated per-input (features, enzyme, charge bounds); PIN generation errors are logged per-input.

Changes

Cohort / File(s) Summary
ProSE PIN Output Support
src/topp/ProSE.cpp
Added -out_pin CLI option and validation requiring at least one output and matching counts for PIN outputs. Implemented per-file PIN generation: build feature list from search params (score, optional extra_features, Peptide, Proteins), derive enzyme name and min/max charge, call PercolatorInfile::store(...). Exceptions during PIN generation are caught and logged, marking only that input as failed while allowing other outputs to proceed.

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)
Loading

Poem

🐰 I hop through searches, features in a bin,
I name the enzyme, count charges with a grin;
I write each PIN, one file per input,
If one should stumble, I skip without a stint,
Hooray — outputs pinned, success begins!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new -out_pin output option to the ProSE TOPP tool for generating Percolator input files.

✏️ 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 feat/prose-out-pin

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.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f58f40d-436a-4081-aada-dfc0be5c0aa9

📥 Commits

Reviewing files that changed from the base of the PR and between 016d3e0 and a2eac3d.

📒 Files selected for processing (1)
  • src/topp/ProSE.cpp

Comment thread src/topp/ProSE.cpp Resolved
Comment thread src/topp/ProSE.cpp Resolved
Comment thread src/topp/ProSE.cpp Resolved
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]>
@timosachsenberg
timosachsenberg merged commit 26c8613 into develop Apr 17, 2026
19 of 20 checks passed
@timosachsenberg
timosachsenberg deleted the feat/prose-out-pin branch April 17, 2026 08:24
github-actions Bot pushed a commit that referenced this pull request Apr 18, 2026
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]>
timosachsenberg pushed a commit that referenced this pull request Apr 18, 2026
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]>
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