Repository navigation
[FIX,FEATUREFINDER,TEST] FeatureFinderIdentification: initialise the peptide counters - #9993
Conversation
…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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesThe change initializes peptide counters, resets the external counter for each run, adds a TOPP regression test, and documents the fix. External peptide count handling
Suggested reviewers: Poem
Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 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 |
…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
The bug
FeatureFinderIdentificationandProteomicsLFQprint a garbage external-peptide count in the run summary:runSingleGroup_()assignsn_external_peps_only insideif (with_external_ids), butstatistics_()reads it unconditionally. A run given no external identifications therefore formats an uninitialised member — undefined behaviour.n_missing_externalis 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
ProteomicsLFQrun, and on everyFeatureFinderIdentificationrun without-id_ext.The fix
Both counters get in-class initialisers, and
n_external_peps_is reset next ton_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:
Why nothing caught it
TOPP_FeatureFinderIdentification_2is 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, sincePASS_REGULAR_EXPRESSIONmakes 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
Tests
Documentation