Skip to content

[FIX,FEATUREFINDER,TEST] FeatureFinderIdentification: initialise the peptide counters - #9993

Merged
timosachsenberg merged 1 commit into
developfrom
fix/ffid-uninitialized-peptide-counters
Aug 29, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
fix/ffid-uninitialized-peptide-counters

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

The bug

FeatureFinderIdentification and ProteomicsLFQ print a garbage external-peptide count in the run summary:

12 peptides identified (12 internal, 140724733953152 additional external)
4 peptides without features (4 internal, 130499712 external)

runSingleGroup_() assigns n_external_peps_ only inside if (with_external_ids), but statistics_() reads it unconditionally. A run given no external identifications therefore formats an uninitialised member — undefined behaviour. n_missing_external is derived from the same value, so the third line of the summary is wrong too.

This is not an edge case: it happens on every ProteomicsLFQ run, and on every FeatureFinderIdentification run without -id_ext.

The fix

Both counters get in-class initialisers, and n_external_peps_ is reset next to n_internal_peps_ rather than only inside that branch. An initialiser alone would fix the first run but leave a reused algorithm object reporting the previous run's count.

After:

12 peptides identified (12 internal, 0 additional external)
4 peptides without features (4 internal, 0 external)

Why nothing caught it

TOPP_FeatureFinderIdentification_2 is the only test that passes -id_ext, and it has been commented out for producing different results across platforms — so the external-ID bookkeeping has no coverage at all.

Added TOPP_FeatureFinderIdentification_no_ext_count, which asserts the summary reports a real count. Matched as , 0 additional external — anchored on the comma and space so a genuine count of 10 or 20 cannot satisfy it — and given its own invocation rather than a property on the existing test, since PASS_REGULAR_EXPRESSION makes ctest ignore the exit code and would have weakened that test's check that the tool succeeded.

One honest caveat: because the old behaviour was UB, uninitialised memory could in principle happen to be 0 on some platform, and the test would then pass spuriously against the unfixed code. It still pins the contract going forward.

Found while reviewing #9989; unrelated to that PR's changes, hence separate.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Corrected FeatureFinderIdentification run summaries to report zero additional external peptides when no external identifications are provided.
    • Prevented external peptide counts from carrying over between consecutive runs.
  • Tests

    • Added coverage verifying accurate reporting when external identifications are omitted.
  • Documentation

    • Updated the development changelog with details of the reporting correction.

…peptide counters

The run summary reported a garbage number of external peptides:

  12 peptides identified (12 internal, 140724733953152 additional external)

runSingleGroup_() assigns n_external_peps_ only inside 'if (with_external_ids)', but
statistics_() reads it unconditionally, so a run given no external identifications
formatted an uninitialised member. That is undefined behaviour, and it shows up in
every ProteomicsLFQ run and every FeatureFinderIdentification run without -id_ext --
which is to say, the common case. n_missing_external is derived from the same value,
so the third line of the summary was wrong too.

Both counters now have in-class initialisers, and n_external_peps_ is reset next to
n_internal_peps_ rather than only inside that branch: an initialiser alone would leave
a reused algorithm object reporting the previous run's count.

The path had no test to catch it -- TOPP_FeatureFinderIdentification_2 is the only case
passing -id_ext and it has been commented out for producing different results per
platform. Added a check that the summary reports a real count, matched with the leading
comma and space so a genuine count of 10 cannot satisfy it, as its own invocation
because PASS_REGULAR_EXPRESSION makes ctest ignore the exit code.

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

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b8ac9a25-4eaa-4d68-b78c-40331a5c53d8

📥 Commits

Reviewing files that changed from the base of the PR and between 5fb1c20 and 2f83ae4.

📒 Files selected for processing (4)
  • CHANGELOG
  • src/openms/include/OpenMS/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.h
  • src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
  • src/tests/topp/CMakeLists.txt

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Changes

The change initializes peptide counters, resets the external counter for each run, adds a TOPP regression test, and documents the fix.

External peptide count handling

Layer / File(s) Summary
Counter initialization and per-run reset
src/openms/include/OpenMS/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.h, src/openms/source/FEATUREFINDER/FeatureFinderIdentificationAlgorithm.cpp
Both counters default to zero. The external counter resets before each run without external identifications.
Regression coverage and changelog
src/tests/topp/CMakeLists.txt, CHANGELOG
A TOPP test checks for 0 additional external. The changelog documents the fix.

Suggested reviewers: cbielow, claude

Poem

A rabbit counts the peptides bright
No stray numbers hop in sight
Zero waits when none are found
Each new run clears the ground
The changelog thumps with cheer

Merge Risk: ⚪ Minimal · up to 2f83a

The change makes peptide summary counts deterministic when external identifications are absent and prevents stale counts across reused runs, with regression coverage for the corrected output. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the affected component and the main change: initializing the peptide counters. The scope tags are relevant, and the title is concise.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ffid-uninitialized-peptide-counters

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.

@timosachsenberg
timosachsenberg merged commit b273e2b into develop Aug 29, 2026
13 checks passed
@timosachsenberg
timosachsenberg deleted the fix/ffid-uninitialized-peptide-counters branch August 29, 2026 09:09
timosachsenberg pushed a commit that referenced this pull request Aug 29, 2026
…de ID path

The "external" ID path was dead in practice: the only in-tree callers
(ProteomicsLFQ, OpenNuXL) always passed empty external ID lists, and the
only test exercising -id_ext (TOPP_FeatureFinderIdentification_2) had
been commented out because it produced platform-dependent results.

Removed:
- TOPP FeatureFinderIdentification: -id_ext input and its loading
- FeatureFinderIdentificationAlgorithm::run()/runSingleGroup_():
  peptides_ext / proteins_ext arguments
- Internal::FFIDAlgoExternalIDHandler (header + source), which held the
  SVM classifier, the SVM-based FDR estimation, the internal/external RT
  alignment and the classified-feature filtering
- the 'svm:*' parameter section and 'extract:rt_quantile' (both only fed
  the external path), plus the corresponding members
- the internal/external RTMap pairs: ChargeMap is now map<Int, RTMap> and
  PeptideRefRTMap map<string, RTMap>
- the "unknown" feature class, the "implied" FFId_category dummy IDs and
  the 'rt_delta' / 'predicted_class' / 'FDR_probabilities' meta values

The two peptide counters collapse into a single initialised n_peptides_,
so the uninitialised-member fix from #9993 is preserved; its regression
test is kept as TOPP_FeatureFinderIdentification_summary_count, matched
against the new summary line.

Behaviour of the remaining (internal-ID) path is unchanged: without
external IDs the RT uncertainty was always 0, the SVM never ran, and
feature filtering already took the non-classified branch.

Callers, the pyOpenMS binding, the QualityControl TOPPAS example and the
CHANGELOG are updated accordingly.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KG8a8ypEv66BWWq6Dy8HGh
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