Repository navigation
fix(ProSE): per-file output isolation, dangling decoy refs, FDR:PSM deferral (#9197) - #9201
timosachsenberg wants to merge 12 commits into
Conversation
Captures the brainstormed approach for accommodating bigbio/msgfplus PR #23 (pin-as-default output, no more mzid). Single PR, additive: variant probe at startup branches between the existing mzid path and a new pin path that reuses PercolatorInfile::load() (same as SageAdapter). Covers parameter surface, validation matrix, feature-set extension, redundancy analysis, testing, and risks. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Captures the brainstormed approach for: (1a) write-order isolation so merged-write failure doesn't discard per-file outputs, (1b) calling IDFilter::removeDanglingProteinReferences to fix the target+decoy peptide-evidence dangling-pointer crash that triggered the original issue, (3) extending the FDR:protein deferral pattern to FDR:PSM with post-Percolator re-application using q-values. Also moves -out_pin above Percolator so pin contains raw HyperScore as the "external rescoring input" semantic intends. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Sharpen item 1b mechanism: applyPickedProteinFDR drops decoy ProteinHits via setScoresAndRemoveDecoys_; filterHitsByScore drops below-cutoff targets. Net: decoy proteins gone from merged list. Note bug only triggers with FDR:protein > 0. - Sharpen item 3 mechanism: wrapper zeros FDR:protein but not FDR:PSM; ProSEAlgorithm's removeDecoyHits is conditional on fdr_protein_ == 0.0 and triggers because the wrapper zeroed it. - Add edge case: has_decoys_for_percolator == false + FDR:PSM > 0 → deferred FDR never applied. Add warning at decoy-check site. - Add edge case: -out_pin only + Percolator fails. - Reframe "some Percolator runs fail" as direct consequence of design, not pre-existing concern. Cross-reference #9198 for the long-term internal-PEP/FDR fallback. - Note that ProSE.cpp:NNN references are to pre-patch state.
Six tasks: extend FDR:PSM deferral (task 1), add removeDanglingProteinReferences (task 2), wrap+move merged-write block (task 3), restructure per-file loop with pin first + Percolator inlined + post-Percolator FDR re-apply (task 4), verification (task 5), CHANGELOG (task 6).
Mirror the existing FDR:protein deferral so PSM-level FDR doesn't strip decoys inside ProSEAlgorithm before Percolator can use them. The deferred cutoff is re-applied per-file after Percolator returns success (next commit).
Fixes 'Invalid protein reference DECOY_...' crash when merged path runs applyPickedProteinFDR (deletes decoy ProteinHits) and target+decoy PSMs remain (kept by removeDecoyHits's exact-match check on target_decoy=='decoy'). Refs OpenMS#9197 item 1b. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…catch Fixes data loss on merged-write failure: previously a merged-write exception aborted main_ and discarded per-file outputs even when per-file PSMs were already complete in memory. Per-file writes now complete first and the merged write is wrapped in try/catch so its failure becomes a logged error rather than a terminal exception. Refs OpenMS#9197 item 1a.
Don't claim per-file outputs were 'written successfully' — input_failed may be true for one or more files. Direct user to check per-file errors above.
… re-apply The standalone Percolator loop (previously between the Algorithm run and the per-file output writes) is removed. Per-file loop body order is now: 1. write -out_pin (raw HyperScore — matches 'external rescoring input' semantic) 2. run PercolatorAdapter (mutates result in place) 3. re-apply deferred FDR:PSM cutoff using Percolator q-values 4. write -out_idxml / -out_qpx / -out_parquet (rescored, FDR-filtered) The hoisted decoy check is preserved before the loop (whole-run decision). Skipped/failed Percolator paths now log explicitly that the deferred FDR:PSM cutoff was not applied. BREAKING (minor): -out_pin now contains raw HyperScore even when -percolator_executable is set. Use -out_idxml for Percolator-rescored output. Refs OpenMS#9197 items 1a (data loss eliminated by sibling-isolation) and 3 (FDR:PSM deferral implemented end-to-end).
If FileHandler::storeIdentifications threw before runExternalProcess_, tmp_in was created but never removed. Wrap the Percolator block in try/catch with unconditional File::remove cleanup outside the try. Also add a comment noting Percolator failure is intentionally a soft failure (raw HyperScore is acceptable fallback output). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Stage loadIdentifications/keepNBestHits into local temporaries; only swap into result.protein_ids/peptide_ids on full success. Previously, result was cleared before the reload, so a throwing loadIdentifications left result empty — silently losing per-file PSMs and dropping that file's contributions from the merged output. Fixes data-loss path flagged in final review.
📝 WalkthroughWalkthroughThis PR addresses ProSE/TOPP output generation and FDR rescoring for issue Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ProSE
participant OutputWriter as Per-File Output
participant Percolator
participant IDFilter
participant MergedWriter as Merged Output
User->>ProSE: Run with -percolator_executable
loop Per-file processing
ProSE->>OutputWriter: Write raw .pin (HyperScore PSMs)<br/>before rescoring
OutputWriter-->>ProSE: .pin written
ProSE->>Percolator: Run rescoring (FDR:PSM deferred)
alt Percolator succeeds
Percolator-->>ProSE: q-values returned
ProSE->>IDFilter: Re-apply FDR:PSM<br/>using Percolator q-values
IDFilter-->>ProSE: Filtered results
else Percolator fails
Percolator--X ProSE: Exception caught
ProSE-->>ProSE: Keep raw results,<br/>skip FDR:PSM re-application
end
ProSE->>OutputWriter: Write per-file idXML/qpx/parquet<br/>(with or without rescoring)
OutputWriter-->>ProSE: Per-file outputs written
end
ProSE->>MergedWriter: Attempt merged idXML write<br/>(with try/catch protection)
alt Merged write succeeds
rect rgba(100, 200, 100, 0.5)
MergedWriter->>IDFilter: Call removeDanglingProteinReferences
IDFilter-->>MergedWriter: References cleaned
end
MergedWriter-->>ProSE: Merged idXML written
else Merged write fails
rect rgba(200, 100, 100, 0.5)
MergedWriter--X ProSE: Exception caught & logged
end
ProSE-->>User: Per-file outputs preserved,<br/>merged output not produced
end
ProSE-->>User: Completed (per-file outputs guaranteed)
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 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)
⚔️ Resolve merge conflicts
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: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/topp/ProSE.cpp (1)
288-292:⚠️ Potential issue | 🔴 CriticalGuard empty protein identifications before indexing.
Line 291 indexes
pf.protein_ids[0]after only checkingexit_code. A successful empty/no-hit result can make the decoy prescreen crash before any per-file outputs are written.Proposed fix
for (const auto& pf : mfres.per_file) { - if (pf.exit_code != ProSEAlgorithm::ExitCodes::EXECUTION_OK) continue; + if (pf.exit_code != ProSEAlgorithm::ExitCodes::EXECUTION_OK || pf.protein_ids.empty()) + { + continue; + } for (const auto& ph : pf.protein_ids[0].getHits())🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/topp/ProSE.cpp` around lines 288 - 292, The loop indexes pf.protein_ids[0] without checking for empty protein identifications; update the loop over mfres.per_file so after confirming pf.exit_code == ProSEAlgorithm::ExitCodes::EXECUTION_OK you also guard that pf.protein_ids is non-empty and that pf.protein_ids[0] contains hits (e.g., check !pf.protein_ids.empty() and !pf.protein_ids[0].getHits().empty()) before iterating over pf.protein_ids[0].getHits(); place this check immediately before the inner for (const auto& ph : pf.protein_ids[0].getHits()) to avoid crashes when a successful result has no protein IDs.
🤖 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`:
- Around line 638-698: The catch block that handles failures writing out_merged
currently logs the error but doesn't update the merged_ok flag, allowing
EXECUTION_OK to be returned; modify the catch in ProSE.cpp (the catch(const
Exception::BaseException& e) after FileHandler().storeIdentifications for
out_merged) to set merged_ok = false (and optionally set any overall exit status
variable you use for merged outputs) immediately after logging, preserving the
existing comment about not propagating the exception so per-file outputs remain
written.
- Around line 477-485: After calling
IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr) and
IDFilter::removeEmptyIdentifications(result.peptide_ids) you must also remove
proteins that are no longer referenced by any remaining PSMs: invoke
IDFilter::removeUnreferencedProteins(result.protein_ids, result.peptide_ids) (or
the equivalent method that prunes protein_ids based on peptide_ids) to drop
orphaned proteins/groups so subsequent writers (idXML/QPX/parquet) do not see
stale protein-level entries; place this call immediately after
removeEmptyIdentifications and keep the existing INFO log.
---
Outside diff comments:
In `@src/topp/ProSE.cpp`:
- Around line 288-292: The loop indexes pf.protein_ids[0] without checking for
empty protein identifications; update the loop over mfres.per_file so after
confirming pf.exit_code == ProSEAlgorithm::ExitCodes::EXECUTION_OK you also
guard that pf.protein_ids is non-empty and that pf.protein_ids[0] contains hits
(e.g., check !pf.protein_ids.empty() and !pf.protein_ids[0].getHits().empty())
before iterating over pf.protein_ids[0].getHits(); place this check immediately
before the inner for (const auto& ph : pf.protein_ids[0].getHits()) to avoid
crashes when a successful result has no protein IDs.
🪄 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: 33a2edfb-41a9-4b9d-a482-5f751a637939
📒 Files selected for processing (5)
CHANGELOGdocs/superpowers/plans/2026-04-21-prose-9197-fixes.mddocs/superpowers/specs/2026-04-21-msgfplus-pin-support-design.mddocs/superpowers/specs/2026-04-21-prose-9197-fixes-design.mdsrc/topp/ProSE.cpp
| // -- Re-apply deferred PSM FDR using Percolator q-values (post-rescoring) -- | ||
| if (percolator_succeeded && user_psm_fdr > 0.0) | ||
| { | ||
| IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr); | ||
| IDFilter::removeEmptyIdentifications(result.peptide_ids); | ||
| OPENMS_LOG_INFO << "[ProSE] " << in_file | ||
| << ": applied deferred FDR:PSM=" << user_psm_fdr | ||
| << " using Percolator q-values." << endl; | ||
| } |
There was a problem hiding this comment.
Remove proteins orphaned by deferred PSM FDR.
After filterHitsByScore() and removeEmptyIdentifications(), result.protein_ids can still contain proteins/groups supported only by removed PSMs. The later idXML/QPX/parquet writers then see stale protein-level data for the per-file output.
Proposed fix
if (percolator_succeeded && user_psm_fdr > 0.0)
{
IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr);
IDFilter::removeEmptyIdentifications(result.peptide_ids);
+ IDFilter::removeUnreferencedProteins(result.protein_ids, result.peptide_ids);
OPENMS_LOG_INFO << "[ProSE] " << in_file
<< ": applied deferred FDR:PSM=" << user_psm_fdr
<< " using Percolator q-values." << endl;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // -- Re-apply deferred PSM FDR using Percolator q-values (post-rescoring) -- | |
| if (percolator_succeeded && user_psm_fdr > 0.0) | |
| { | |
| IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr); | |
| IDFilter::removeEmptyIdentifications(result.peptide_ids); | |
| OPENMS_LOG_INFO << "[ProSE] " << in_file | |
| << ": applied deferred FDR:PSM=" << user_psm_fdr | |
| << " using Percolator q-values." << endl; | |
| } | |
| // -- Re-apply deferred PSM FDR using Percolator q-values (post-rescoring) -- | |
| if (percolator_succeeded && user_psm_fdr > 0.0) | |
| { | |
| IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr); | |
| IDFilter::removeEmptyIdentifications(result.peptide_ids); | |
| IDFilter::removeUnreferencedProteins(result.protein_ids, result.peptide_ids); | |
| OPENMS_LOG_INFO << "[ProSE] " << in_file | |
| << ": applied deferred FDR:PSM=" << user_psm_fdr | |
| << " using Percolator q-values." << endl; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/topp/ProSE.cpp` around lines 477 - 485, After calling
IDFilter::filterHitsByScore(result.peptide_ids, user_psm_fdr) and
IDFilter::removeEmptyIdentifications(result.peptide_ids) you must also remove
proteins that are no longer referenced by any remaining PSMs: invoke
IDFilter::removeUnreferencedProteins(result.protein_ids, result.peptide_ids) (or
the equivalent method that prunes protein_ids based on peptide_ids) to drop
orphaned proteins/groups so subsequent writers (idXML/QPX/parquet) do not see
stale protein-level entries; place this call immediately after
removeEmptyIdentifications and keep the existing INFO log.
| if (!out_merged.empty() && in_list.size() > 1) | ||
| { | ||
| try | ||
| { | ||
| const String decoy_prefix = search_params.getValue("decoy_prefix").toString(); | ||
|
|
||
| // Merge per-file results via IDMergerAlgorithm (accession dedup + identifier remap) | ||
| IDMergerAlgorithm merger; | ||
| for (const auto& pf : mfres.per_file) | ||
| { | ||
| if (pf.exit_code != ProSEAlgorithm::ExitCodes::EXECUTION_OK) continue; | ||
| merger.insertRuns(pf.protein_ids, pf.peptide_ids); | ||
| } | ||
| ProteinIdentification merged_proteins; | ||
| PeptideIdentificationList merged_peptides; | ||
| merger.returnResultsAndClear(merged_proteins, merged_peptides); | ||
|
|
||
| vector<ProteinIdentification> merged_protein_ids = {std::move(merged_proteins)}; | ||
| merged_protein_ids[0].setPrimaryMSRunPath(in_list); | ||
|
|
||
| // Protein inference: aggregate best PSM score per peptide per protein | ||
| BasicProteinInferenceAlgorithm bpia; | ||
| bpia.run(merged_peptides, merged_protein_ids); | ||
|
|
||
| // Optional picked-protein FDR | ||
| if (user_protein_fdr > 0.0) | ||
| { | ||
| FalseDiscoveryRate fdr; | ||
| fdr.applyPickedProteinFDR(merged_protein_ids[0], decoy_prefix, true); | ||
| IDFilter::filterHitsByScore(merged_protein_ids, user_protein_fdr); | ||
|
|
||
| OPENMS_LOG_INFO << "[ProSE] Merged protein inference + FDR: " | ||
| << merged_protein_ids[0].getHits().size() << " proteins at " | ||
| << user_protein_fdr * 100 << "% FDR" << endl; | ||
| } | ||
|
|
||
| // Clean up decoys in merged output | ||
| IDFilter::removeDecoyHits(merged_peptides); | ||
| IDFilter::removeEmptyIdentifications(merged_peptides); | ||
| IDFilter::removeUnreferencedProteins(merged_protein_ids, merged_peptides); | ||
| // Strip PeptideEvidence entries pointing to proteins removed by decoy/FDR | ||
| // cleanup (target+decoy PSMs kept by removeDecoyHits would otherwise leave | ||
| // dangling refs that IdXMLFile::store rejects). | ||
| IDFilter::removeDanglingProteinReferences(merged_peptides, merged_protein_ids); | ||
|
|
||
| if (getFlag_("test") && !merged_protein_ids.empty()) | ||
| { | ||
| StringList basenames; | ||
| for (const auto& f : in_list) basenames.push_back("file://" + File::basename(f)); | ||
| merged_protein_ids[0].setPrimaryMSRunPath(basenames); | ||
| } | ||
|
|
||
| FileHandler().storeIdentifications(out_merged, merged_protein_ids, merged_peptides, {FileTypes::IDXML}); | ||
| } | ||
| catch (const Exception::BaseException& e) | ||
| { | ||
| OPENMS_LOG_ERROR << "Failed to write merged idXML output -> " << out_merged | ||
| << ": " << e.what() | ||
| << ". Per-file outputs were written (check above for any per-file errors)." << endl; | ||
| // Do NOT propagate; per-file outputs are already on disk. | ||
| } |
There was a problem hiding this comment.
Report merged idXML write failure in the final exit status.
The catch logs an error but leaves merged_ok unchanged, so ProSE can return EXECUTION_OK even when the requested -out_merged file was not produced. Keep the per-file preservation behavior, but mark the merged output as failed.
Proposed fix
catch (const Exception::BaseException& e)
{
OPENMS_LOG_ERROR << "Failed to write merged idXML output -> " << out_merged
<< ": " << e.what()
<< ". Per-file outputs were written (check above for any per-file errors)." << endl;
+ merged_ok = false;
// Do NOT propagate; per-file outputs are already on disk.
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (!out_merged.empty() && in_list.size() > 1) | |
| { | |
| try | |
| { | |
| const String decoy_prefix = search_params.getValue("decoy_prefix").toString(); | |
| // Merge per-file results via IDMergerAlgorithm (accession dedup + identifier remap) | |
| IDMergerAlgorithm merger; | |
| for (const auto& pf : mfres.per_file) | |
| { | |
| if (pf.exit_code != ProSEAlgorithm::ExitCodes::EXECUTION_OK) continue; | |
| merger.insertRuns(pf.protein_ids, pf.peptide_ids); | |
| } | |
| ProteinIdentification merged_proteins; | |
| PeptideIdentificationList merged_peptides; | |
| merger.returnResultsAndClear(merged_proteins, merged_peptides); | |
| vector<ProteinIdentification> merged_protein_ids = {std::move(merged_proteins)}; | |
| merged_protein_ids[0].setPrimaryMSRunPath(in_list); | |
| // Protein inference: aggregate best PSM score per peptide per protein | |
| BasicProteinInferenceAlgorithm bpia; | |
| bpia.run(merged_peptides, merged_protein_ids); | |
| // Optional picked-protein FDR | |
| if (user_protein_fdr > 0.0) | |
| { | |
| FalseDiscoveryRate fdr; | |
| fdr.applyPickedProteinFDR(merged_protein_ids[0], decoy_prefix, true); | |
| IDFilter::filterHitsByScore(merged_protein_ids, user_protein_fdr); | |
| OPENMS_LOG_INFO << "[ProSE] Merged protein inference + FDR: " | |
| << merged_protein_ids[0].getHits().size() << " proteins at " | |
| << user_protein_fdr * 100 << "% FDR" << endl; | |
| } | |
| // Clean up decoys in merged output | |
| IDFilter::removeDecoyHits(merged_peptides); | |
| IDFilter::removeEmptyIdentifications(merged_peptides); | |
| IDFilter::removeUnreferencedProteins(merged_protein_ids, merged_peptides); | |
| // Strip PeptideEvidence entries pointing to proteins removed by decoy/FDR | |
| // cleanup (target+decoy PSMs kept by removeDecoyHits would otherwise leave | |
| // dangling refs that IdXMLFile::store rejects). | |
| IDFilter::removeDanglingProteinReferences(merged_peptides, merged_protein_ids); | |
| if (getFlag_("test") && !merged_protein_ids.empty()) | |
| { | |
| StringList basenames; | |
| for (const auto& f : in_list) basenames.push_back("file://" + File::basename(f)); | |
| merged_protein_ids[0].setPrimaryMSRunPath(basenames); | |
| } | |
| FileHandler().storeIdentifications(out_merged, merged_protein_ids, merged_peptides, {FileTypes::IDXML}); | |
| } | |
| catch (const Exception::BaseException& e) | |
| { | |
| OPENMS_LOG_ERROR << "Failed to write merged idXML output -> " << out_merged | |
| << ": " << e.what() | |
| << ". Per-file outputs were written (check above for any per-file errors)." << endl; | |
| // Do NOT propagate; per-file outputs are already on disk. | |
| } | |
| if (!out_merged.empty() && in_list.size() > 1) | |
| { | |
| try | |
| { | |
| const String decoy_prefix = search_params.getValue("decoy_prefix").toString(); | |
| // Merge per-file results via IDMergerAlgorithm (accession dedup + identifier remap) | |
| IDMergerAlgorithm merger; | |
| for (const auto& pf : mfres.per_file) | |
| { | |
| if (pf.exit_code != ProSEAlgorithm::ExitCodes::EXECUTION_OK) continue; | |
| merger.insertRuns(pf.protein_ids, pf.peptide_ids); | |
| } | |
| ProteinIdentification merged_proteins; | |
| PeptideIdentificationList merged_peptides; | |
| merger.returnResultsAndClear(merged_proteins, merged_peptides); | |
| vector<ProteinIdentification> merged_protein_ids = {std::move(merged_proteins)}; | |
| merged_protein_ids[0].setPrimaryMSRunPath(in_list); | |
| // Protein inference: aggregate best PSM score per peptide per protein | |
| BasicProteinInferenceAlgorithm bpia; | |
| bpia.run(merged_peptides, merged_protein_ids); | |
| // Optional picked-protein FDR | |
| if (user_protein_fdr > 0.0) | |
| { | |
| FalseDiscoveryRate fdr; | |
| fdr.applyPickedProteinFDR(merged_protein_ids[0], decoy_prefix, true); | |
| IDFilter::filterHitsByScore(merged_protein_ids, user_protein_fdr); | |
| OPENMS_LOG_INFO << "[ProSE] Merged protein inference + FDR: " | |
| << merged_protein_ids[0].getHits().size() << " proteins at " | |
| << user_protein_fdr * 100 << "% FDR" << endl; | |
| } | |
| // Clean up decoys in merged output | |
| IDFilter::removeDecoyHits(merged_peptides); | |
| IDFilter::removeEmptyIdentifications(merged_peptides); | |
| IDFilter::removeUnreferencedProteins(merged_protein_ids, merged_peptides); | |
| // Strip PeptideEvidence entries pointing to proteins removed by decoy/FDR | |
| // cleanup (target+decoy PSMs kept by removeDecoyHits would otherwise leave | |
| // dangling refs that IdXMLFile::store rejects). | |
| IDFilter::removeDanglingProteinReferences(merged_peptides, merged_protein_ids); | |
| if (getFlag_("test") && !merged_protein_ids.empty()) | |
| { | |
| StringList basenames; | |
| for (const auto& f : in_list) basenames.push_back("file://" + File::basename(f)); | |
| merged_protein_ids[0].setPrimaryMSRunPath(basenames); | |
| } | |
| FileHandler().storeIdentifications(out_merged, merged_protein_ids, merged_peptides, {FileTypes::IDXML}); | |
| } | |
| catch (const Exception::BaseException& e) | |
| { | |
| OPENMS_LOG_ERROR << "Failed to write merged idXML output -> " << out_merged | |
| << ": " << e.what() | |
| << ". Per-file outputs were written (check above for any per-file errors)." << endl; | |
| merged_ok = false; | |
| // Do NOT propagate; per-file outputs are already on disk. | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/topp/ProSE.cpp` around lines 638 - 698, The catch block that handles
failures writing out_merged currently logs the error but doesn't update the
merged_ok flag, allowing EXECUTION_OK to be returned; modify the catch in
ProSE.cpp (the catch(const Exception::BaseException& e) after
FileHandler().storeIdentifications for out_merged) to set merged_ok = false (and
optionally set any overall exit status variable you use for merged outputs)
immediately after logging, preserving the existing comment about not propagating
the exception so per-file outputs remain written.
|
Superseded by #9205. After #9195 merged with a different approach for FDR:PSM deferral and the .pin column-set fix (items 3 + 4 of #9197), the remaining novel work in this PR is just items 1a (write-order isolation) and 1b (dangling decoy PeptideEvidence cleanup). Reopened as a tight 4-commit branch in #9205. |
Fixes items 1 and 3 of #9197.
Summary
-out_mergedwrite failure no longer discards per-file outputs. Per-file-out_idxml/-out_pin/-out_qpx/-out_parquetwrites now complete before the merged write is attempted, and the merged write is wrapped intry/catchso its failure becomes a logged error rather than a terminal exception.Invalid protein reference 'DECOY_...'whentarget+decoyshared peptides are present andFDR:protein > 0.applyPickedProteinFDRdeletes decoyProteinHits whileremoveDecoyHitskeepstarget+decoyPSMs (theirtarget_decoymeta istarget+decoy, notdecoy), so kept PSMs retainPeptideEvidenceentries pointing at deleted decoy proteins. AddedIDFilter::removeDanglingProteinReferencespass after decoy/protein cleanup.FDR:proteindeferral. With-percolator_executableset,FDR:PSMis now zeroed in the search params beforeProSEAlgorithm::run()and re-applied per-file using Percolator q-values. PreviouslyFDR:PSMstripped decoys pre-Percolator and the rescoring silently failed withNo decoys found.-out_pinnow contains raw HyperScore PSMs even when-percolator_executableis set, matching the parameter's "external rescoring input" semantic. Use-out_idxmlfor Percolator-rescored output.Architecture
Per-file output loop body order is now:
-out_pin(raw HyperScore — preserves "external rescoring input" semantic)PercolatorAdapter(mutatesresult.peptide_idsin place)FDR:PSMcutoff using Percolator q-values-out_idxml/-out_qpx/-out_parquet(rescored, FDR-filtered)The hoisted decoy check stays before the loop (whole-run decision). Skipped/failed Percolator paths log explicitly that the deferred
FDR:PSMcutoff was not applied. Percolator-success uses stage-then-swap so a throwingloadIdentificationsleaves the raw HyperScore result intact.The merged-write block moved AFTER the per-file loop and is wrapped in
try/catchso its failure does not propagate.Test Plan
TOPP_ProSE_*topp tests pass against the branch (existing fixtures don't exercise Percolator ortarget+decoypaths, so they're unchanged)FDR:PSM > 0,FDR:protein > 0, decoys present, sharedtarget+decoypeptides) — verify per-file outputs land on disk regardless of merged-write outcome AND verify merged write succeeds-out_pincontent check — confirm it contains raw HyperScore even when-percolator_executableis set-percolator_executablewithFDR:PSM=0.05— confirm Percolator runs successfully (decoys present at runtime) and per-file idXML is q-value filteredOut of scope (tracked separately)
OpenNuXL, not a ProSE-specific bug..pinmissing standardSpecId/Label/ScanNrcolumns) — independent fix.Spec & plan
Brainstormed design and implementation plan are checked into
docs/superpowers/specs/2026-04-21-prose-9197-fixes-design.mdanddocs/superpowers/plans/2026-04-21-prose-9197-fixes.md.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Updated Features
-out_pinoutput semantics updated: now contains raw PSM results for external Percolator rescoring workflows.