Repository navigation
Simplify IDFilter by eliminating code duplication - #8662
Conversation
Apply KISS principle to reduce redundancy in IDFilter class: - Unify HasMatchingAccession and HasMatchingAccessionUnordered into a single template HasMatchingAccessionImpl with type aliases for backward API compatibility - Extract duplicated accession collection logic into helper functions (collectReferencedAccessions, collectProteinAccessions) - Extract duplicated evidence filtering into filterPeptideReferences - Simplify removeUnreferencedProteins and removeDanglingProteinReferences overloads using the new helpers Net reduction of ~65 lines while preserving the public API. Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughThe pull request refactors the IDFilter module by introducing a generic template Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (8)src/openms/**/*.{cpp,h,hpp,cc,cxx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/openms/**/*.cpp📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/openms/source/**/*.cpp📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/openms/**/*.{h,cpp}📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/openms/include/OpenMS/**/*.h📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
src/openms/**/*.h📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/openms/include/**/*.h📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (4)📚 Learning: 2025-08-05T12:43:11.681ZApplied to files:
📚 Learning: 2025-08-05T12:43:11.681ZApplied to files:
📚 Learning: 2026-01-14T18:52:46.327ZApplied to files:
📚 Learning: 2026-01-14T18:51:46.097ZApplied to files:
🧬 Code graph analysis (2)src/openms/source/PROCESSING/ID/IDFilter.cpp (1)
src/openms/include/OpenMS/PROCESSING/ID/IDFilter.h (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
🔇 Additional comments (9)
✏️ Tip: You can disable this entire section by setting 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.
Pull request overview
This PR simplifies the IDFilter implementation by eliminating code duplication through template unification and helper function extraction. The refactoring reduces the codebase by approximately 65 lines while maintaining full backward API compatibility.
Changes:
- Unified
HasMatchingAccessionandHasMatchingAccessionUnorderedinto a single templateHasMatchingAccessionImplwith type aliases for backward compatibility - Extracted duplicated accession collection logic into
collectReferencedAccessionsandcollectProteinAccessionshelper functions - Created
filterEvidencesByAccessionsandfilterPeptideReferenceshelpers to consolidate evidence filtering logic - Simplified multiple overloads of
removeUnreferencedProteinsandremoveDanglingProteinReferencesusing the new helper functions - Removed unnecessary
structkeyword from template instantiations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/openms/include/OpenMS/PROCESSING/ID/IDFilter.h |
Unified duplicate predicate structs into template with type aliases; removed redundant struct keywords |
src/openms/source/PROCESSING/ID/IDFilter.cpp |
Added anonymous namespace helpers for accession collection and filtering; simplified function implementations using helpers |
timosachsenberg
left a comment
There was a problem hiding this comment.
looks good
Added 19 missing PRs to OpenMS 3.6.0 changelog: PyOpenMS: - #8530: Build system modernization with py-build-cmake - #8633: SpectrumNativeIDParser wrapper - #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames) - #8661: Build dependency docs - #8664: Biosaur2Algorithm wrap-inherits - #8668: wrap-doc documentation - #8674: Docstring validation tests TOPP tools: - #8643: FileInfo FASTA stats - #8650: FileConverter MSP support - #8649: PeakPickerHiRes parameter OpenMS Library: - #8633: SpectrumNativeIDParser class - #8655: ArrowExport helper - #8651, #8656, #8659, #8660, #8662: Performance optimizations Fixes: - #8645: DataArray handling in filters - #8672: Test file correction - #8678: UniqueIdGenerator seed collision fix Build System: - #8675, #8676: Claude CI workflows Also reorganized misplaced entries from lines 122-129. Co-authored-by: Timo Sachsenberg <[email protected]>
* Add comprehensive changelog for OpenMS 3.6.0 Includes changes from 96 merged PRs since version 3.5.0: - General: macOS Intel discontinued, Ubuntu 24.04, notarization in CI - Dependencies: Autowrap >= 0.26.0, Eigen minimum 3.4.0 - PyOpenMS: Pythonic methods (__len__, __str__, __repr__, __hash__), DataFrame support, new wrappers, string handling improvements - TOPP tools: MapAligner spectra transformation, FileInfo improvements, IsobaricWorkflow fixes, SageAdapter thread handling - OpenMS Library: PeakFileOptions, ParamIterator, SpectrumAnnotator - Breaking changes: Matrix<T> Eigen decoupling, API renames, FileWatcher move - Bug fixes: NucleicAcidSearchEngine, LogConfigHandler, decoy generation - Documentation: Targeted Quantitation, parameter annotations, AGENTS.md - Build: macOS notarization, Parquet support, pytest fixtures Co-Authored-By: Claude Opus 4.5 <[email protected]> * Add missing changelog entries for recently merged PRs Added 19 missing PRs to OpenMS 3.6.0 changelog: PyOpenMS: - #8530: Build system modernization with py-build-cmake - #8633: SpectrumNativeIDParser wrapper - #8655: Arrow/Parquet export with DataFrame methods (BREAKING: method renames) - #8661: Build dependency docs - #8664: Biosaur2Algorithm wrap-inherits - #8668: wrap-doc documentation - #8674: Docstring validation tests TOPP tools: - #8643: FileInfo FASTA stats - #8650: FileConverter MSP support - #8649: PeakPickerHiRes parameter OpenMS Library: - #8633: SpectrumNativeIDParser class - #8655: ArrowExport helper - #8651, #8656, #8659, #8660, #8662: Performance optimizations Fixes: - #8645: DataArray handling in filters - #8672: Test file correction - #8678: UniqueIdGenerator seed collision fix Build System: - #8675, #8676: Claude CI workflows Also reorganized misplaced entries from lines 122-129. Co-authored-by: Timo Sachsenberg <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Timo Sachsenberg <[email protected]>
Summary
HasMatchingAccessionandHasMatchingAccessionUnorderedpredicates into a single templateHasMatchingAccessionImplwith type aliases for backward API compatibilitycollectReferencedAccessions,collectProteinAccessions)filterPeptideReferenceshelperremoveUnreferencedProteinsandremoveDanglingProteinReferencesoverloads using the new helpersNet reduction of ~65 lines while preserving the public API.
Test plan
IDFilter_test)TOPP_IDFilter_*tests)🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.