Skip to content

feat: protein-level FDR (picked-protein) in PeptideSearchEngineFI - #9123

Merged
timosachsenberg merged 9 commits into
developfrom
feat/fi-protein-fdr
Apr 10, 2026
Merged

timosachsenberg merged 9 commits into
developfrom
feat/fi-protein-fdr

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add FDR:protein parameter for picked-protein FDR (Savitski et al. 2015) via existing FalseDiscoveryRate::applyPickedProteinFDR()
  • Applied after PSM-level FDR in per-file search (protein scores derived from best PSM q-values)
  • In the multi-file aggregate path, protein FDR is applied on pooled PSMs across all files — proper cross-file protein inference, matching the ProteomicsLFQ pattern
  • Default: disabled (FDR:protein = 0.0), opt-in with e.g. FDR:protein 0.01

Usage

PeptideDataBaseSearchFI -in spectra.mzML -database db.fasta -out results.idXML \
  -Search:decoys -Search:FDR:PSM 0.01 -Search:FDR:protein 0.01

Addresses item #14 from #9108.

Test plan

  • All 13 existing tests pass (protein FDR disabled by default)
  • Validate on real-world data that protein FDR filtering produces expected protein counts

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added configurable protein-level FDR filtering via new "FDR:protein" parameter (0.0–1.0, default 0.0). When enabled, protein inference and picked-protein FDR are applied in single-file and pooled workflows; decoy/empty/unreferenced entries are pruned after protein-level filtering and resulting protein counts are logged.
  • Documentation

    • Clarified decoy behavior: decoys are generated with a fixed "DECOY_" prefix and input FASTA must be target-only when using internal decoy generation.

@coderabbitai

coderabbitai Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added a protein-level FDR parameter (FDR:protein) and fdr_protein_ to PeptideSearchEngineFIAlgorithm; when >0 and decoys enabled, protein inference and picked‑protein FDR are applied in single-file and pooled aggregate flows, with re-indexing and decoy/empty/unreferenced filtering deferred until after protein-FDR.

Changes

Cohort / File(s) Summary
Header
src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
Added non-public member double fdr_protein_ to store protein-level FDR.
Implementation & params
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
Added parameter FDR:protein (default 0.0, range 0.0–1.0) and logic: when fdr_protein_ > 0 with decoys enabled, run protein inference (BasicProteinInferenceAlgorithm::run), apply picked‑protein FDR (FalseDiscoveryRate::applyPickedProteinFDR), filter proteins by score, then remove decoys/empty/unreferenced identifications. In aggregate pooled mode, synchronize pooled PSMs to aggregate proteins, re-index pooled PSMs (PeptideIndexing::run) with decoy string/enzyme specificity, then run aggregate inference, picked‑protein FDR, and cleanup.
Docs
src/topp/PeptideDataBaseSearchFI.cpp
Clarified Doxygen: decoys are generated internally with "DECOY_" prefix; pre-existing decoys in FASTA not supported. No behavioral changes.

Sequence Diagram(s)

sequenceDiagram
    participant Search as SearchEngine
    participant Index as PeptideIndexing
    participant Infer as BasicProteinInferenceAlgorithm
    participant FDR as FalseDiscoveryRate
    participant Filter as IDFilter

    Search->>Search: run PSM search (optional PSM-level FDR)
    alt pooled/aggregate mode
        Search->>Index: re-index pooled PSMs vs aggregate proteins (with decoy string)
    end
    Search->>Infer: run protein inference (single or aggregate)
    Infer->>FDR: applyPickedProteinFDR(protein list, "DECOY_", true)
    FDR->>Filter: filter protein hits by score
    Filter->>Search: return filtered proteins
    Search->>Search: remove decoys/empty/unreferenced from PSMs & proteins
Loading

Possibly related PRs

  • experimental opentims integration #8975 — Modifies PeptideSearchEngineFIAlgorithm and FDR flows; likely related as prior work on PSM-level FDR integrates with this PR’s protein-level FDR additions.

Suggested reviewers

  • jpfeuffer
  • jcharkow

Poem

🐇
I hop through hits both near and far,
I infer the proteins, pick each star,
I filter decoys and tidy the view,
Protein FDR now guides what’s true,
A rabbit’s cheer for changes new!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.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 accurately summarizes the main change: adding protein-level FDR (picked-protein) functionality to PeptideSearchEngineFI, which is the primary focus across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fi-protein-fdr

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: 2

🤖 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/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp`:
- Around line 1169-1194: Aggregate protein FDR fails because pooled
mfres.aggregate.peptide_ids already had decoy PSMs removed by the per-file
search() FDR workflow, so PeptideIndexing against ctx.db can't map PSMs to decoy
proteins; to fix, when fdr_protein_ > 0.0 and using the multi-file aggregate
path, preserve decoy PSMs for pooling by disabling per-file PSM decoy removal
(adjust the per-file search() call to skip its IDFilter/PSM-level filtering) or
alternatively change the pooling to collect raw PSMs before any
IDFilter::filterHitsByScore is run, then run PeptideIndexing and
FalseDiscoveryRate::applyPickedProteinFDR on
mfres.aggregate.peptide_ids/protein_ids as shown (refer to search(),
IDFilter::filterHitsByScore, mfres.aggregate.peptide_ids, PeptideIndexing,
ctx.db, and FalseDiscoveryRate::applyPickedProteinFDR).
- Around line 895-908: The protein-level picked-protein FDR is being run after
decoys were removed, which breaks applyPickedProteinFDR; move the decoy-removal
steps (removeDecoyHits and removeUnreferencedProteins) so that
applyPickedProteinFDR(protein_ids[0], "DECOY_", true) runs while decoy proteins
still exist, then call IDFilter::filterHitsByScore(protein_ids, fdr_protein_)
and only afterwards remove decoys/unreferenced proteins and clean up PSMs
(ensure peptide_ids are synchronized by removing PSMs that reference removed
proteins or call removeUnreferencedProteins on peptide_ids), and drop the no-op
IDFilter::removeEmptyIdentifications(peptide_ids) here if it's redundant.
🪄 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: 1da6fd58-4476-4bba-9bd5-2b0f6cf9ccf9

📥 Commits

Reviewing files that changed from the base of the PR and between 248e51a and b94185d.

📒 Files selected for processing (2)
  • src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp

@timosachsenberg
timosachsenberg force-pushed the feat/fi-protein-fdr branch 2 times, most recently from 5a4ac56 to fdffe51 Compare April 9, 2026 21:39

@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: 2

🧹 Nitpick comments (1)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (1)

1197-1207: Consider checking PeptideIndexing::run() return value for robustness.

The return value of indexer.run() is ignored here, whereas the single-file path (line 862) checks and handles errors. While failures during aggregate re-indexing are unlikely (the same database was used successfully for per-file searches), checking the return value would maintain consistency and catch unexpected edge cases.

♻️ Proposed fix to check return value
       param_pi.setValue("missing_decoy_action", "silent");
       indexer.setParameters(param_pi);
-      indexer.run(ctx.db, mfres.aggregate.protein_ids, mfres.aggregate.peptide_ids);
+      PeptideIndexing::ExitCodes indexer_exit = indexer.run(ctx.db, mfres.aggregate.protein_ids, mfres.aggregate.peptide_ids);
+      if (indexer_exit != PeptideIndexing::ExitCodes::EXECUTION_OK &&
+          indexer_exit != PeptideIndexing::ExitCodes::PEPTIDE_IDS_EMPTY)
+      {
+        OPENMS_LOG_WARN << "[PDBS-FI] Aggregate PeptideIndexing returned non-OK exit code: "
+                        << static_cast<int>(indexer_exit) << std::endl;
+      }
 
       // Protein inference: aggregate best PSM score per peptide per protein.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp` around
lines 1197 - 1207, The call to PeptideIndexing::run on the pooled results
ignores its return value; update the code around the indexer.run(ctx.db,
mfres.aggregate.protein_ids, mfres.aggregate.peptide_ids) invocation to capture
and check the boolean return (as done for the single-file path), and on failure
log an error via the same logger/context and handle the error (e.g.,
return/throw or set appropriate error state) so aggregate re-indexing failures
are detected and handled consistently with the per-file path using the
PeptideIndexing indexer instance.
🤖 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/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp`:
- Around line 940-953: The protein-FDR branch silently skips when decoys are
disabled; add the same warning used in the PSM-level FDR check so users know
protein FDR is being ignored. Specifically, where fdr_protein_ is checked (the
block using BasicProteinInferenceAlgorithm,
FalseDiscoveryRate::applyPickedProteinFDR and IDFilter calls), add a conditional
warning when fdr_protein_ > 0.0 && !decoys_ that logs a clear message (e.g.
"FDR:protein set but decoys disabled — skipping protein-level FDR") using the
same logging mechanism as the PSM-level check so behavior is consistent. Ensure
this check references fdr_protein_ and decoys_ and is placed before running
BasicProteinInferenceAlgorithm or applying applyPickedProteinFDR.
- Around line 1185-1227: The code skips aggregate protein FDR when decoys are
disabled but doesn't warn the user; add a warning when fdr_protein_ > 0.0 and
decoys_ is false in the multi-file branch. Concretely, next to the existing
condition that starts with if (fdr_protein_ > 0.0 && decoys_ &&
!mfres.aggregate.protein_ids.empty()) add an else-if or separate check for
(fdr_protein_ > 0.0 && !decoys_) and emit a user-visible warning (e.g. via
OPENMS_LOG_WARN) stating that protein FDR is requested but decoys are disabled
so FDR will be skipped for mfres.aggregate (reference symbols: fdr_protein_,
decoys_, mfres.aggregate, OPENMS_LOG_WARN). Ensure message matches the
single-file path warning style.

---

Nitpick comments:
In `@src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp`:
- Around line 1197-1207: The call to PeptideIndexing::run on the pooled results
ignores its return value; update the code around the indexer.run(ctx.db,
mfres.aggregate.protein_ids, mfres.aggregate.peptide_ids) invocation to capture
and check the boolean return (as done for the single-file path), and on failure
log an error via the same logger/context and handle the error (e.g.,
return/throw or set appropriate error state) so aggregate re-indexing failures
are detected and handled consistently with the per-file path using the
PeptideIndexing indexer instance.
🪄 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: a5a95211-8aec-4a63-a4ba-5445ce06fd40

📥 Commits

Reviewing files that changed from the base of the PR and between fdffe51 and 6caf057.

📒 Files selected for processing (2)
  • src/openms/include/OpenMS/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.h
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp

@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.

♻️ Duplicate comments (2)
src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp (2)

940-953: ⚠️ Potential issue | 🟡 Minor

Add warning when protein FDR is set but decoys are disabled.

The PSM-level FDR block (lines 899-902) logs a warning when FDR:PSM is set without decoys. For consistency and user awareness, the protein FDR block should also warn when FDR:protein is silently skipped.

🛡️ Proposed fix to add the missing warning
       IDFilter::removeDecoyHits(peptide_ids);
       IDFilter::removeEmptyIdentifications(peptide_ids);
       IDFilter::removeUnreferencedProteins(protein_ids, peptide_ids);
     }
+    else if (fdr_protein_ > 0.0 && !decoys_)
+    {
+      OPENMS_LOG_WARN << "FDR:protein is set but decoys are disabled. Skipping protein FDR filtering." << endl;
+    }
 
     // patch file-specific metadata
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp` around
lines 940 - 953, The protein-FDR block silently skips when decoys are disabled;
add a warning similar to the PSM-level case: detect when fdr_protein_ > 0.0 and
!decoys_ and log a warning before the existing block. Modify the function
containing the shown snippet (referencing variables fdr_protein_ and decoys_) to
emit a processLogger.warn or LOG_WARN message indicating "FDR:protein set but
decoys disabled; protein-level FDR will be skipped" (or similar) to match the
PSM warning pattern, leaving the existing BasicProteinInferenceAlgorithm,
fdr.applyPickedProteinFDR, and IDFilter calls unchanged when decoys_ is true.

1185-1231: ⚠️ Potential issue | 🟡 Minor

Add warning when protein FDR is set but decoys are disabled in multi-file path.

Similar to the single-file path, users should be warned when FDR:protein is silently skipped due to disabled decoys.

🛡️ Proposed fix to add the missing warning
       OPENMS_LOG_INFO << "[PDBS-FI] Aggregate protein inference + FDR: "
                       << mfres.aggregate.protein_ids[0].getHits().size() << " proteins at "
                       << fdr_protein_ * 100 << "% FDR" << std::endl;
     }
+    else if (fdr_protein_ > 0.0 && !decoys_)
+    {
+      OPENMS_LOG_WARN << "FDR:protein is set but decoys are disabled. Skipping aggregate protein FDR filtering." << endl;
+    }
 
     // Aggregate modification analysis on the pooled PSM set.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp` around
lines 1185 - 1231, The multi-file branch doesn't warn when fdr_protein_>0.0 but
decoys_ is false; add a warning like in the single-file path: detect the case
(fdr_protein_ > 0.0 && !decoys_) and emit OPENMS_LOG_WARN with a clear message
that protein FDR will be skipped for aggregated results because decoys are
disabled (reference variables/symbols: fdr_protein_, decoys_,
mfres.aggregate.protein_ids), placed alongside the existing multi-file logic
before any re-indexing/inferring so users see the warning early.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp`:
- Around line 940-953: The protein-FDR block silently skips when decoys are
disabled; add a warning similar to the PSM-level case: detect when fdr_protein_
> 0.0 and !decoys_ and log a warning before the existing block. Modify the
function containing the shown snippet (referencing variables fdr_protein_ and
decoys_) to emit a processLogger.warn or LOG_WARN message indicating
"FDR:protein set but decoys disabled; protein-level FDR will be skipped" (or
similar) to match the PSM warning pattern, leaving the existing
BasicProteinInferenceAlgorithm, fdr.applyPickedProteinFDR, and IDFilter calls
unchanged when decoys_ is true.
- Around line 1185-1231: The multi-file branch doesn't warn when
fdr_protein_>0.0 but decoys_ is false; add a warning like in the single-file
path: detect the case (fdr_protein_ > 0.0 && !decoys_) and emit OPENMS_LOG_WARN
with a clear message that protein FDR will be skipped for aggregated results
because decoys are disabled (reference variables/symbols: fdr_protein_, decoys_,
mfres.aggregate.protein_ids), placed alongside the existing multi-file logic
before any re-indexing/inferring so users see the warning early.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 46c8f3af-47af-4204-9861-6f1ece424b35

📥 Commits

Reviewing files that changed from the base of the PR and between 6caf057 and 06b2546.

📒 Files selected for processing (2)
  • src/openms/source/ANALYSIS/ID/PeptideSearchEngineFIAlgorithm.cpp
  • src/topp/PeptideDataBaseSearchFI.cpp
✅ Files skipped from review due to trivial changes (1)
  • src/topp/PeptideDataBaseSearchFI.cpp

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.

This is exactly where layer ordered heaps would be very helpful as you will be dealing with potentially millions of IDs. See #8904

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true but not the bottleneck

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.

have you tried several millions psms yet? I agree, probably not, but while the TSG will stay constant and the scoring is super fast, the sorting overhead will grow and grow.

timosachsenberg and others added 6 commits April 10, 2026 11:24
Add FDR:protein parameter for protein-level FDR using
BasicProteinInferenceAlgorithm (score aggregation) followed by
picked-protein FDR (Savitski et al. 2015).

Design: protein FDR is NOT applied per-file in the core search() method.
Instead, it runs at the appropriate scope:

- Single-file path (file-based search()): BPIA + picked-protein FDR
  runs after PSM-level FDR but before decoy removal, so both target
  and decoy proteins receive aggregated scores.

- Multi-file path: per-file searches produce PSM-filtered results with
  decoys retained. The aggregate path synchronizes PSM identifiers,
  re-indexes pooled PSMs, runs BPIA on the full cross-file PSM set,
  then applies picked-protein FDR. This ensures protein inference sees
  all evidence across files (matching the ProteomicsLFQ pattern) rather
  than running conservatively per-file.

Addresses item #14 from #9108.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…requirement

- Add comment explaining why PeptideIndexing re-runs in multi-file
  aggregate path (aggregate protein_ids may not cover proteins found
  only in other files)
- Add TOPP tool doc note: external decoy databases are not supported,
  provide target-only FASTA and use -Search:decoys

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add advanced parameter 'decoy_prefix' (default "DECOY_") used everywhere
instead of hardcoded prefix. When decoy generation is disabled but the
FASTA contains proteins matching the prefix, FDR can still be applied.
This supports databases pre-processed with DecoyDatabase or external
tools using a custom decoy prefix.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add -percolator_executable parameter (advanced, optional). When set,
each per-file result is rescored with Percolator via PercolatorAdapter
before writing output, replacing HyperScore with Percolator q-values.

Follows the OpenNuXL pattern: writes temp idXML, calls
runExternalProcess_("PercolatorAdapter", ...), loads rescored results.

Safeguards:
- Empty executable (default) = skip rescoring entirely
- Minimum 100 PSMs required per file (SVM needs training data)
- Decoy check: skips rescoring if no decoy proteins found in results
- Graceful fallback: if Percolator fails, keeps original HyperScore
- Temp files cleaned up after use

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
When both -percolator_executable and FDR:protein are set, the built-in
protein FDR (which runs on raw HyperScores) is now deferred. Instead,
protein inference (BPIA) + picked-protein FDR runs in the TOPP tool
AFTER Percolator rescoring, so protein scores are derived from Percolator
q-values — the correct scores for downstream analysis.

Flow with Percolator:
  search (PSM FDR only, protein FDR deferred)
  → per-file Percolator rescoring (HyperScore → q-values)
  → pool rescored PSMs across files
  → protein inference (BPIA on q-values) + picked-protein FDR
  → write output

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Use `decoys_ || has_decoys_in_db` consistently in both single-file
  and multi-file paths. Previously single-file checked only external
  decoys (missed internal), multi-file checked only internal (missed
  external).
- Add in-class initializer for fdr_protein_{0.0} to prevent UB if
  updateMembers_() is not called before use.
- Also add initializer for fdr_psm_{0.0} for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
timosachsenberg and others added 2 commits April 10, 2026 11:49
… aggregate

Replace the PeptideIndexing re-run in the multi-file aggregate path with
IDMergerAlgorithm, which is the canonical OpenMS pattern for cross-file
protein inference (mirrors ConsensusMapMergerAlgorithm::mergeAllIDRuns
in ProteomicsLFQ).

IDMergerAlgorithm deduplicates ProteinHits by accession (union) and
remaps all PeptideIdentification identifiers to the merged run. No
PeptideIndexing re-run needed since per-file searches already linked
peptides to proteins.

Addresses review feedback from @jpfeuffer.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The aggregate protein inference + FDR was computed inside the algorithm
but never written to output — each per-file output kept its original
per-file protein list. Now when protein FDR is applied on the aggregate,
the filtered protein list is copied back to each per-file result before
writing output, so all output files reflect the cross-file protein
inference result.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@jpfeuffer Thanks for the review feedback — addressed both points:

  1. Replaced PeptideIndexing re-run with IDMergerAlgorithm (86a19a54fe): per-file PeptideIndexing already linked peptides to proteins, so the aggregate now uses IDMergerAlgorithm (accession-based ProteinHit dedup + identifier remap) — the same pattern as ConsensusMapMergerAlgorithm::mergeAllIDRuns in ProteomicsLFQ. No PeptideIndexing re-run needed.

  2. Propagated aggregate protein list to per-file outputs (d186c4bb57): when FDR:protein > 0, the cross-file protein inference result (from BPIA + picked-protein FDR on merged PSMs) is now copied back to each per-file output so the idXML files reflect the aggregate protein inference.

Question: Is this the correct approach for multi-file output? Specifically:

  • Each per-file idXML gets its own PSMs (from that file only) + the shared aggregate protein list (from cross-file inference)
  • This means proteins identified only in other files still appear in each file's protein list (with no supporting PSMs in that file)

Or should per-file outputs only contain the subset of aggregate proteins that have supporting PSMs in that specific file? (i.e., filter the aggregate protein list per-file using IDFilter::removeUnreferencedProteins)

@jpfeuffer

jpfeuffer commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

We can do it in any way. I often just create one huge protein run and map the peptides to it (like you did before) and you annotate with the id_file metavalue from which file_origin in the list of file_origins the ID came from. And delete all the single run protein runs (with their IDs).

But you could also keep them if you think you have a need to see which PROTEIN came from where. Although this is obviously inferable from the peptides mapping to it.

@jpfeuffer

jpfeuffer commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

I wouldnt write a per-file idXML. Do you want that?
It would be confusing but could be possible. You still have the same choice. You can keep the proteins per run or delete them because they are in the combined run.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

Here we do everything in the tool. But for some applications we want to defer these steps to a later part: if we merge everything, can we still easily do IDMapping, percolator , inference , protein fdr filtering outside of the tool in a later workflow step?

@jpfeuffer

Copy link
Copy Markdown
Contributor

And you want the same output for both modes?
You could write multifiles without inference and a combined file with inference.
But I think a combined file still would be compatible with (almost?) everything downstream.

@jpfeuffer

Copy link
Copy Markdown
Contributor

Hmm IDMapping would probably not be very efficient though. But the information is still there.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

the major issue I see is that it needs adaption of proteomicslfq and other workflows

@jpfeuffer

Copy link
Copy Markdown
Contributor

Those would use the multifile one without inference, no?

@jpfeuffer

Copy link
Copy Markdown
Contributor

Note there will be a difference between protein FDR on quantified proteins only vs FDR on identified proteins.
Not even speaking about protein grouping which you did not parameterize here.

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

@jpfeuffer maybe you can assist here.
this is the tricky part

Add -out_merged parameter to write a single merged idXML containing all
PSMs pooled across input files with cross-file protein inference (BPIA)
and optional picked-protein FDR. Per-file outputs (-out) are no longer
overwritten with aggregate protein lists — they retain run-level info.

The merged output uses IDMergerAlgorithm (accession dedup + identifier
remap) to combine per-file results, then runs BPIA + optional FDR on
the merged set. This cleanly separates:
  -out:        per-file PSMs + per-file proteins (run-level)
  -out_merged: pooled PSMs + inferred proteins (study-level)

Also removes the redundant aggregate protein FDR from the algorithm's
multi-file path — protein inference on the aggregate is now exclusively
handled by the TOPP tool via -out_merged, matching the ProteomicsLFQ
pattern where protein inference is a top-level operation.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@timosachsenberg
timosachsenberg merged commit 9c29275 into develop Apr 10, 2026
19 checks passed
@timosachsenberg
timosachsenberg deleted the feat/fi-protein-fdr branch April 10, 2026 12:26
github-actions Bot pushed a commit that referenced this pull request Apr 11, 2026
Add missing changelog entries for commits merged after the last sync:
- #9127: Fix LinearResampler right_index bounds clamping (intensity spike bug)
- #9126: CometAdapter Bruker .d DDA-PASEF input support
- #9121: PeptideDataBaseSearchFI runtime search diagnostics and tolerance estimation
- #9122: PeptideDataBaseSearchFI automatic mass accuracy calibration (two-pass search)
- #9123: PeptideDataBaseSearchFI protein-level FDR (picked-protein)
- #9129: OpenSwathWorkflow Bruker DIA MS2 frame aggregation, denoising, and streaming

Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Apr 11, 2026
Add missing changelog entries for commits merged after the last sync:
- #9127: Fix LinearResampler right_index bounds clamping (intensity spike bug)
- #9126: CometAdapter Bruker .d DDA-PASEF input support
- #9121: PeptideDataBaseSearchFI runtime search diagnostics and tolerance estimation
- #9122: PeptideDataBaseSearchFI automatic mass accuracy calibration (two-pass search)
- #9123: PeptideDataBaseSearchFI protein-level FDR (picked-protein)
- #9129: OpenSwathWorkflow Bruker DIA MS2 frame aggregation, denoising, and streaming

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot mentioned this pull request Apr 12, 2026
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