Repository navigation
Spectrum native id parser moved to individual class - #8637
Conversation
Extract native ID parsing functionality from SpectrumLookup into a new NativeIDParser class for better discoverability and maintainability. The new class provides static methods for: - extractScanNumber(): Extract scan numbers using regex or CV accession - getRegExFromNativeID(): Generate regex patterns for native ID formats - isNativeID(): Check if a string is a native ID from vendor files Supported native ID formats include Thermo (MS:1000768), Waters (MS:1000769), WIFF (MS:1000770), Bruker (MS:1000771-73, MS:1000775-76), Agilent (MS:1001508), and generic formats (MS:1000774, MS:1000777, MS:1001530). SpectrumLookup methods now delegate to NativeIDParser, maintaining backward compatibility while guiding users to the new class via @deprecated/@see documentation. Includes comprehensive unit tests covering all supported formats and edge cases, plus PyOpenMS bindings for Python accessibility. Fixes #8633
Rename the class to follow the existing naming convention in METADATA (SpectrumLookup, SpectrumMetaDataLookup, SpectrumSettings) for better discoverability when searching for Spectrum-related functionality. Also add Python tests for the new class covering all supported native ID formats and edge cases.
Add a "Native ID Parsing" section to the SpectrumLookup class documentation with usage examples showing how to use SpectrumNativeIDParser directly for standalone parsing without spectrum lookup.
Document the new SpectrumNativeIDParser class and its pyOpenMS bindings in the changelog for user discoverability.
|
Warning Rate limit exceeded@timosachsenberg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 59 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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. 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: 3
🤖 Fix all issues with AI agents
In @src/openms/include/OpenMS/METADATA/sources.cmake:
- Line 32: The sources.cmake entry lists a non-existent header NativeIDParser.h;
update that entry to the correct header name SpectrumNativeIDParser.h so it
matches the existing source SpectrumNativeIDParser.cpp and prevents CMake build
failures — locate the header list in
src/openms/include/OpenMS/METADATA/sources.cmake and replace NativeIDParser.h
with SpectrumNativeIDParser.h.
In @src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h:
- Around line 63-76: Update the Doxygen comment in SpectrumNativeIDParser (the
method documented in SpectrumNativeIDParser.h) to remove the incorrect
requirement for a named group "?<SCAN>" and instead state that the regular
expression must contain a capture group (the last matching subgroup is used) or
optionally a named group (the implementation currently uses subgroup index 1 via
boost::sregex_token_iterator). Ensure the description for the scan_regexp
parameter mentions the use of a capture group (or the subgroup index) and that
no_exception/no_error behavior and return value (-1) remain as documented.
In @src/openms/source/METADATA/SpectrumNativeIDParser.cpp:
- Around line 118-122: The regex assigned to regexp for the MS:1000777 branch
uses a plain capturing group with literal "<GROUP>" instead of a named capture;
update the pattern in the SpectrumNativeIDParser.cpp branch where
native_id_type_accession == "MS:1000777" to use a named group syntax
"(?<GROUP>\d+)" so extractScanNumber can find the GROUP capture; specifically
replace the current R"(...(<GROUP>\d+)...)" string with
R"(...(?<GROUP>\d+)...)".
🧹 Nitpick comments (4)
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py (1)
7-20: Consider using implicit boolean checks (optional style improvement).Ruff E712 flags explicit
== Trueand== Falsecomparisons. While this works correctly, Python convention prefers implicit checks:assert pyopenms.SpectrumNativeIDParser.isNativeID("scan=123") assert not pyopenms.SpectrumNativeIDParser.isNativeID("123")This is a minor style nit and not blocking.
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd (1)
6-11: Consider adding constructor declarations for completeness.Per pyOpenMS conventions,
.pxdfiles typically declare default and copy constructors. WhileSpectrumNativeIDParseris a utility class with only static methods (and thepassdeclaration works), adding explicit constructor declarations would be more consistent with the codebase pattern:cdef cppclass SpectrumNativeIDParser: SpectrumNativeIDParser() except + nogil SpectrumNativeIDParser(SpectrumNativeIDParser&) except + nogilThis is a minor stylistic point - the current implementation will work correctly.
src/openms/source/METADATA/SpectrumNativeIDParser.cpp (1)
140-143: Minor: Brace style inconsistency.Per OpenMS coding guidelines, braces should be on their own lines. Line 140 has the brace on the same line as the
ifstatement:if (matches.size() < subgroups.size()) {Should be:
if (matches.size() < subgroups.size()) {♻️ Proposed fix
- if (matches.size() < subgroups.size()) { - OPENMS_LOG_WARN << "native_id '" << native_id <<"' is invalid. Could not extract scan number." << std::endl; - return -1; - } + if (matches.size() < subgroups.size()) + { + OPENMS_LOG_WARN << "native_id '" << native_id <<"' is invalid. Could not extract scan number." << std::endl; + return -1; + }src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h (1)
124-126: Minor: Remove redundant blank line.Static analysis flagged the blank line at line 125 before the closing brace. Per style guidelines, this can be removed.
♻️ Proposed fix
static bool isNativeID(const String& id); - };
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
CHANGELOGsrc/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.hsrc/openms/include/OpenMS/METADATA/sources.cmakesrc/openms/source/METADATA/SpectrumLookup.cppsrc/openms/source/METADATA/SpectrumNativeIDParser.cppsrc/openms/source/METADATA/sources.cmakesrc/pyOpenMS/pxds/SpectrumNativeIDParser.pxdsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.pysrc/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
🧰 Additional context used
📓 Path-based instructions (13)
**
📄 CodeRabbit inference engine (AGENTS.md)
File extensions must be lowercase except for
ML,XML, andmzData
Files:
src/tests/class_tests/openms/executables.cmakesrc/pyOpenMS/pxds/SpectrumNativeIDParser.pxdsrc/openms/source/METADATA/sources.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cppCHANGELOGsrc/openms/source/METADATA/SpectrumNativeIDParser.cppsrc/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/sources.cmakesrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.hsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.pysrc/openms/source/METADATA/SpectrumLookup.cpp
src/tests/class_tests/openms/executables.cmake
📄 CodeRabbit inference engine (AGENTS.md)
Test files must be registered in
src/tests/class_tests/openms/executables.cmaketo be included in the build
Files:
src/tests/class_tests/openms/executables.cmake
**/*.{py,pyx,pxd}
📄 CodeRabbit inference engine (AGENTS.md)
Use 4-space indentation for Python and Cython files per PEP 8; no tabs; Unix line endings (LF)
Files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxdsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
src/pyOpenMS/pxds/*.pxd
📄 CodeRabbit inference engine (AGENTS.md)
src/pyOpenMS/pxds/*.pxd: pyOpenMS.pxdfiles must declare default and copy constructors; usecimportinstead of Pythonimport
pyOpenMS.pxdfiles must usecdef cppclass ClassName:for non-inheriting classes without a base class
pyOpenMS.pxdsignatures must stay synchronized with corresponding C++ API changes
pyOpenMSwrap-doc:formatting requires exactly#(hash + 2 spaces) for all documentation continuation lines; changing to#or#breaks parsing
Files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
src/pyOpenMS/**/*.{pyx,pxd,py}
📄 CodeRabbit inference engine (AGENTS.md)
Use snake_case for all Python-facing names and DataFrame column names in pyOpenMS
Files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxdsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
src/tests/class_tests/openms/**/*.cpp
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write unit tests for new functionality
Files:
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
**/*.{h,cpp}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{h,cpp}: Use 2-space indentation for C++ and header files; no tabs; Unix line endings (LF)
All non-template exported classes, structs, functions, and variables must useOPENMS_DLLAPImacro; templates are exempt
One class per file; class name must match file name exactly
Always pair.hheader files with.cppimplementation files
Class and type names must use PascalCase; methods must use lowerCamelCase; variables must use snake_case
Private and protected member variables must end with trailing underscore_
Enum names and macro definitions must use UPPER_SNAKE_CASE; preferenum classover C-style enums
Use OpenMS primitive types fromOpenMS/CONCEPT/Types.hinstead of standard C++ types
UseSize/SignedSizetypes for STL.size()values instead of standard integer types
Prefer references over pointers in C++ code
Use Rule-of-0 (no explicit copy/move) or Rule-of-6 (all copy/move/destroy); never use Rule-of-5
Accessor methods must use get/set pairs for protected/private members; do not return references to primitive types
All exceptions must derive fromException::Base; throw with file, line, andOPENMS_PRETTY_FUNCTION; catch by reference
Code comments must use//style; should comprise at least ~5% of code; describe the next few lines in plain English
Use.clang-formatconfiguration from repository root for code formatting; check withclang-format --dry-run -Werror
Use OpenMS logging macros andOpenMS::LogStream; avoidstd::coutandstd::cerr
Avoidstd::endl; prefer\nfor better performance
PreferOpenMS::Stringfor numeric formatting and parsing
Braces must be on their own lines and aligned; always use braces even for single-line blocks (trivial one-liners may remain single-line)
Space required after keywords (if,for,while) and around binary operators
Files:
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cppsrc/openms/source/METADATA/SpectrumNativeIDParser.cppsrc/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.hsrc/openms/source/METADATA/SpectrumLookup.cpp
src/tests/class_tests/openms/source/*_test.cpp
📄 CodeRabbit inference engine (AGENTS.md)
src/tests/class_tests/openms/source/*_test.cpp: Unit tests must be placed insrc/tests/class_tests/openms/source/with naming patternClassName_test.cpp
UseNEW_TMP_FILE(filename)macro for each output file in tests to avoid side effects
UseFuzzyDifffor numeric comparisons in tests instead of exact equality checks
UseSTART_SECTIONandEND_SECTIONmacros in unit tests; wrap template methods with 2+ arguments in parentheses
Files:
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
src/openms/**/*.{cpp,h,hpp,cc,cxx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/openms/**/*.{cpp,h,hpp,cc,cxx}: Follow the existing C++ coding conventions in the codebase
Use the established naming patterns for classes, methods, and variables
Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Follow the established error handling patterns
Utilize OpenMS logging mechanisms
Be mindful of memory usage when processing large datasets
Consider algorithmic complexity for data processing operations
Use appropriate OpenMS containers and algorithms
Files:
src/openms/source/METADATA/SpectrumNativeIDParser.cppsrc/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.hsrc/openms/source/METADATA/SpectrumLookup.cpp
src/openms/include/OpenMS/**/*.h
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Add Doxygen comments for new public methods and classes
Files:
src/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h
**/*.h
📄 CodeRabbit inference engine (AGENTS.md)
**/*.h: Do not addusing namespaceorusing std::...in header files; allowed only in.cppfiles
Prefer forward declarations in headers; include only base class headers, non-pointer members, and templates
Document possible exceptions in Doxygen comments using@throwsor@exceptiontags
Use Doxygen/** */block comments with@tags (not backslash\);@briefis required and must be followed by a blank line before details
All parameter documentation in Doxygen must include direction tags:[in],[out], or[in,out]
Use@ingroupand@defgroupDoxygen tags to organize classes and functions into categories
Use@todotags with assignee name (e.g.,@todo JohnDoe fix this) in Doxygen comments
Every.hfile must include a file preamble with$Maintainer:$marker
Files:
src/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h
src/pyOpenMS/tests/**/*.py
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write pyOpenMS tests for new Python bindings
Files:
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
src/pyOpenMS/**/*.{pyx,py}
📄 CodeRabbit inference engine (AGENTS.md)
pyOpenMS DataFrame pattern:
get_data_dict()in addon returns numpy arrays;get_df()in_dataframes.pywraps with pandas
Files:
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
🧠 Learnings (28)
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/executables.cmake : Test files must be registered in `src/tests/class_tests/openms/executables.cmake` to be included in the build
Applied to files:
src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-09-03T12:58:20.032Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8177
File: src/tests/topp/CMakeLists.txt:1857-1865
Timestamp: 2025-09-03T12:58:20.032Z
Learning: OpenMS tests: When adding new TOPP tests in src/tests/topp/CMakeLists.txt that compare outputs via FuzzyDiff, always add set_tests_properties("<tool>_<n>_out<m>" PROPERTIES DEPENDS "<tool>_<n>") to avoid flakiness under parallel CTest runs.
Applied to files:
src/tests/class_tests/openms/executables.cmake
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/**/*.cpp : Write unit tests for new functionality
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cppsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `FuzzyDiff` for numeric comparisons in tests instead of exact equality checks
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Unit tests must be placed in `src/tests/class_tests/openms/source/` with naming pattern `ClassName_test.cpp`
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cppsrc/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/tests/class_tests/openms/*Test.cpp : Follow naming convention: `ClassNameTest.cpp` for `ClassName`
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/topp/*.cpp : TOPP tool source files must be registered in `src/topp/executables.cmake` and added to `src/openms/source/APPLICATIONS/ToolHandler.cpp`
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/openms/source/METADATA/sources.cmake
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `NEW_TMP_FILE(filename)` macro for each output file in tests to avoid side effects
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/class_tests/openms/source/*_test.cpp : Use `START_SECTION` and `END_SECTION` macros in unit tests; wrap template methods with 2+ arguments in parentheses
Applied to files:
src/tests/class_tests/openms/executables.cmakesrc/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/tests/topp/** : TOPP tests must be registered in `src/tests/topp/CMakeLists.txt` and placed alongside test data
Applied to files:
src/tests/class_tests/openms/executables.cmake
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/pxds/*.pxd : pyOpenMS `.pxd` signatures must stay synchronized with corresponding C++ API changes
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/**/*.h : Add Doxygen comments for new public methods and classes in pyOpenMS bindings
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxdCHANGELOG
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/pxds/*.pxd : pyOpenMS `.pxd` files must declare default and copy constructors; use `cimport` instead of Python `import`
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/pxds/*.pxd : pyOpenMS `wrap-doc:` formatting requires exactly `# ` (hash + 2 spaces) for all documentation continuation lines; changing to `#` or `# ` breaks parsing
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2025-06-16T15:48:09.667Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:4-4
Timestamp: 2025-06-16T15:48:09.667Z
Learning: In OpenMS .pxd files, the established pattern for extern from statements is to include angle brackets inside the string literal, like `cdef extern from "<OpenMS/PATH/TO/FILE.h>" namespace "OpenMS":`. This is consistent across all existing quantitation method .pxd files and other .pxd files in the OpenMS codebase.
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/pxds/*.pxd : pyOpenMS `.pxd` files must use `cdef cppclass ClassName:` for non-inheriting classes without a base class
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/addons/*.pyx : Python addon methods must not be added to `.pxd` files; use `src/pyOpenMS/addons/` or `_dataframes.py` wrappers instead
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2025-11-18T20:08:08.900Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8374
File: src/pyOpenMS/pxds/SimpleSVM.pxd:0-0
Timestamp: 2025-11-18T20:08:08.900Z
Learning: In pyOpenMS .pxd files, copy constructors should be declared for wrapped C++ classes (e.g., `ClassName(ClassName&) except + nogil`) even when the C++ class has a deleted copy constructor. This is a standard pyOpenMS/Cython convention required for proper wrapper generation and Python object semantics.
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2025-06-16T15:49:26.504Z
Learnt from: FreezB11
Repo: OpenMS/OpenMS PR: 7969
File: src/pyOpenMS/pxds/TMTThirtyTwoPlexQuantitationMethod.pxd:1-3
Timestamp: 2025-06-16T15:49:26.504Z
Learning: In OpenMS Python bindings (.pxd files), derived quantitation method classes like TMTThirtyTwoPlexQuantitationMethod only need to declare their constructors. All other public methods (getName, getChannelInformation, getNumberOfChannels, getIsotopeCorrectionMatrix, getReferenceChannel) are inherited from the base IsobaricQuantitationMethod class and don't need to be redeclared explicitly.
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to src/pyOpenMS/addons/*.pyx : Avoid `cdef` typed variables for autowrap return values inside `def` methods; use Python type checks instead
Applied to files:
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Use OpenMS data structures (e.g., MSExperiment, FeatureMap, PeptideIdentification)
Applied to files:
src/openms/source/METADATA/sources.cmakeCHANGELOGsrc/openms/source/METADATA/SpectrumNativeIDParser.cppsrc/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/sources.cmakesrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: PR checklist: update `AUTHORS` and `CHANGELOG`, run/extend tests, update pyOpenMS bindings when needed
Applied to files:
CHANGELOG
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Be aware of OpenMS dependencies and external libraries
Applied to files:
CHANGELOG
📚 Learning: 2026-01-10T13:35:09.486Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-10T13:35:09.486Z
Learning: Applies to **/*.{h,cpp} : Prefer `OpenMS::String` for numeric formatting and parsing
Applied to files:
src/openms/source/METADATA/SpectrumNativeIDParser.cpp
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/include/OpenMS/**/*.h : Add Doxygen comments for new public methods and classes
Applied to files:
src/openms/include/OpenMS/METADATA/SpectrumLookup.hsrc/openms/include/OpenMS/METADATA/sources.cmakesrc/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/openms/**/*.{cpp,h,hpp,cc,cxx} : Utilize OpenMS logging mechanisms
Applied to files:
src/openms/include/OpenMS/METADATA/SpectrumLookup.h
📚 Learning: 2025-08-05T12:43:11.681Z
Learnt from: CR
Repo: OpenMS/OpenMS PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-05T12:43:11.681Z
Learning: Applies to src/pyOpenMS/tests/**/*.py : Write pyOpenMS tests for new Python bindings
Applied to files:
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
📚 Learning: 2026-01-04T21:35:37.785Z
Learnt from: timosachsenberg
Repo: OpenMS/OpenMS PR: 8588
File: src/pyOpenMS/tests/unittests/test_TargetedQuantitation.py:1-456
Timestamp: 2026-01-04T21:35:37.785Z
Learning: For Python files in the repository, follow PEP 8: use 4-space indentation, avoid tabs, and ensure Unix LF line endings. The 2-space indentation and Unix line endings guideline applies to C/Cython in their respective languages; Python files should adhere to Python style (PEP 8) regardless of other language rules.
Applied to files:
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
🧬 Code graph analysis (6)
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp (2)
src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h (1)
OpenMS(16-128)src/openms/source/METADATA/SpectrumNativeIDParser.cpp (8)
isNativeID(20-25)isNativeID(20-20)getRegExFromNativeID(27-50)getRegExFromNativeID(27-27)extractScanNumber(52-78)extractScanNumber(52-54)extractScanNumber(80-197)extractScanNumber(80-81)
src/openms/source/METADATA/SpectrumNativeIDParser.cpp (1)
src/openms/source/METADATA/SpectrumLookup.cpp (8)
isNativeID(205-208)isNativeID(205-205)getRegExFromNativeID(210-213)getRegExFromNativeID(210-210)extractScanNumber(215-220)extractScanNumber(215-217)extractScanNumber(222-226)extractScanNumber(222-223)
src/openms/include/OpenMS/METADATA/SpectrumLookup.h (2)
src/openms/source/METADATA/SpectrumLookup.cpp (6)
extractScanNumber(215-220)extractScanNumber(215-217)extractScanNumber(222-226)extractScanNumber(222-223)getRegExFromNativeID(210-213)getRegExFromNativeID(210-210)src/openms/source/METADATA/SpectrumNativeIDParser.cpp (6)
extractScanNumber(52-78)extractScanNumber(52-54)extractScanNumber(80-197)extractScanNumber(80-81)getRegExFromNativeID(27-50)getRegExFromNativeID(27-27)
src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h (2)
src/openms/source/METADATA/SpectrumLookup.cpp (8)
extractScanNumber(215-220)extractScanNumber(215-217)extractScanNumber(222-226)extractScanNumber(222-223)getRegExFromNativeID(210-213)getRegExFromNativeID(210-210)isNativeID(205-208)isNativeID(205-205)src/openms/source/METADATA/SpectrumNativeIDParser.cpp (8)
extractScanNumber(52-78)extractScanNumber(52-54)extractScanNumber(80-197)extractScanNumber(80-81)getRegExFromNativeID(27-50)getRegExFromNativeID(27-27)isNativeID(20-25)isNativeID(20-20)
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py (1)
src/openms/source/METADATA/SpectrumNativeIDParser.cpp (8)
isNativeID(20-25)isNativeID(20-20)getRegExFromNativeID(27-50)getRegExFromNativeID(27-27)extractScanNumber(52-78)extractScanNumber(52-54)extractScanNumber(80-197)extractScanNumber(80-81)
src/openms/source/METADATA/SpectrumLookup.cpp (1)
src/openms/source/METADATA/SpectrumNativeIDParser.cpp (8)
isNativeID(20-25)isNativeID(20-20)getRegExFromNativeID(27-50)getRegExFromNativeID(27-27)extractScanNumber(52-78)extractScanNumber(52-54)extractScanNumber(80-197)extractScanNumber(80-81)
🪛 GitHub Check: CodeFactor
src/openms/source/METADATA/SpectrumNativeIDParser.cpp
[notice] 80-198: src/openms/source/METADATA/SpectrumNativeIDParser.cpp#L80-L198
Complex Method
src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h
[notice] 125-125: src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h#L125
Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
🪛 Ruff (0.14.10)
src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py
7-7: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
8-8: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
9-9: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
10-10: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
11-11: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
12-12: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
13-13: Avoid equality comparisons to True; use ...: for truth checks
Replace comparison
(E712)
16-16: Avoid equality comparisons to False; use not pyopenms.SpectrumNativeIDParser.isNativeID("123"): for false checks
Replace with not pyopenms.SpectrumNativeIDParser.isNativeID("123")
(E712)
17-17: Avoid equality comparisons to False; use not ...: for false checks
Replace comparison
(E712)
18-18: Avoid equality comparisons to False; use not pyopenms.SpectrumNativeIDParser.isNativeID(""): for false checks
Replace with not pyopenms.SpectrumNativeIDParser.isNativeID("")
(E712)
19-19: Avoid equality comparisons to False; use not ...: for false checks
Replace comparison
(E712)
20-20: Avoid equality comparisons to False; use not ...: for false checks
Replace comparison
(E712)
⏰ 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). (7)
- GitHub Check: build-and-test (ubuntu-24.04-arm, g++, 13)
- GitHub Check: build-and-test (ubuntu-24.04, g++, 13)
- GitHub Check: build-and-test (windows-2025, cl.exe, 14.44)
- GitHub Check: build-and-test (ubuntu-24.04, clang++, 17)
- GitHub Check: build-win
- GitHub Check: build-and-test (macos-14, xcode, 15.4)
- GitHub Check: build-macos-arm
🔇 Additional comments (17)
src/tests/class_tests/openms/executables.cmake (2)
108-108: LGTM!The test is correctly registered in
metadata_executables_list, following the alphabetical ordering convention.
658-658: LGTM!Correctly added to
Boost_dependent_testssince SpectrumNativeIDParser usesboost::regex. The placement follows the alphabetical ordering convention.src/openms/source/METADATA/sources.cmake (1)
31-31: LGTM!Source file correctly added to the build, following the alphabetical ordering convention. This pairs with the header file in the include directory.
src/openms/source/METADATA/SpectrumLookup.cpp (2)
10-10: LGTM!Include added for the new SpectrumNativeIDParser header to enable delegation.
205-226: LGTM!Clean delegation to
SpectrumNativeIDParserfor all native ID parsing methods. The public API is preserved while centralizing the implementation in the new parser class.src/pyOpenMS/tests/unittests/testSpectrumNativeIDParser.py (2)
3-80: Comprehensive test coverage - well done!The tests cover:
- All recognized native ID prefixes for
isNativeID- Edge cases (empty strings, unrecognized formats, case sensitivity)
- All CV accession formats for
extractScanNumber- Special cases like WIFF format (cycle*1000 + experiment) and index format (+1 behavior)
- Merged spectra handling (returns last scan number)
- Error cases returning -1
This provides good coverage of the SpectrumNativeIDParser functionality.
8-8: No action required. The different casing betweenscanID=andscanId=is intentional:scanID=is the Thermo format (supported byisNativeID), whilescanId=is the Agilent MassHunter format (MS:1001508, supported bygetRegExFromNativeID). The C++ implementation and tests confirm this is by design, not a typo.Likely an incorrect or invalid review comment.
src/tests/class_tests/openms/source/SpectrumNativeIDParser_test.cpp (2)
1-200: Comprehensive test coverage.The test file provides excellent coverage of:
- All recognized native ID prefixes for
isNativeID- All regex patterns from
getRegExFromNativeID- Both
extractScanNumberoverloads with multiple CV accessions- Edge cases including large numbers, whitespace handling, merged spectra
- Error handling with
no_errorflag and exception testingThe test structure follows OpenMS conventions with
START_SECTION/END_SECTIONmacros.
150-151: No issue found - the regex pattern is correct.The implementation in
SpectrumNativeIDParser.cppcontains the correct named group patternspectrum=(?<GROUP>\d+)for the MS:1000777 format. The test at line 151 expectsextractScanNumber("spectrum=42", "MS:1000777")to return 42, which will work correctly with this proper regex syntax. No action required.Likely an incorrect or invalid review comment.
CHANGELOG (1)
19-28: CHANGELOG entries are clear and informative.The entries properly document:
- The new
SpectrumNativeIDParserclass and its purpose- The backward compatibility story (SpectrumLookup methods remain available)
- The Python bindings with a usage example
- Reference to the issue (#8633)
src/pyOpenMS/pxds/SpectrumNativeIDParser.pxd (1)
1-53: Python bindings are well-structured.The bindings correctly:
- Expose the static methods at module level using the namespace pattern
- Use
except + nogilfor proper exception handling- Include comprehensive
wrap-docdocumentation with correct formatting (#prefix)- Only expose the CV accession-based
extractScanNumberoverload (appropriate since Python users typically don't work withboost::regexdirectly)src/openms/source/METADATA/SpectrumNativeIDParser.cpp (1)
52-78: Good error handling in regex-based extraction.The implementation correctly:
- Uses the last matching subgroup for merged spectra scenarios
- Catches
ConversionErrorexceptions gracefully- Throws
ParseErrorwith context whenno_erroris false- Returns -1 as the sentinel value on failure
src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h (1)
18-59: Excellent class documentation.The Doxygen documentation is comprehensive and well-structured:
- Clear explanation of the class purpose
- Complete table of supported CV accessions with vendor info and examples
- Usage examples with
@codeblocks- Proper cross-reference to
SpectrumLookupThis is exemplary documentation for a public API.
src/openms/include/OpenMS/METADATA/SpectrumLookup.h (4)
13-13: Appropriate include added.Adding the include for
SpectrumNativeIDParser.his necessary for the delegation pattern used in the implementation.
40-54: Good documentation update with usage guidance.The new "Native ID Parsing" section effectively guides users to the new
SpectrumNativeIDParserclass with a clear code example demonstrating the preferred API for standalone native ID parsing.
199-201: Deprecation notes are well-placed.The
@deprecatedand@seetags clearly guide users to useSpectrumNativeIDParserinstead, while maintaining backward compatibility by keeping the existing methods functional.Also applies to: 215-216, 228-229, 240-241
207-219: New overload declaration looks good.The new
extractScanNumberoverload taking a CV accession string provides a cleaner API for users who don't want to work withboost::regexdirectly. The documentation correctly indicates this delegates toSpectrumNativeIDParser.
- Fix CMake sources.cmake: NativeIDParser.h -> SpectrumNativeIDParser.h - Add file= prefix to isNativeID() for consistency with getRegExFromNativeID() - Support both scanId= and scanID= variants for backwards compatibility (original SpectrumLookup had scanID= in isNativeID, scanId= in getRegEx) - Update documentation and tests to reflect all supported prefixes - Use Pythonic boolean assertions in Python tests Co-Authored-By: Claude Opus 4.5 <[email protected]>
…rrect references (#8759) Add 22 missing PR entries across all sections (TOPP tools, PyOpenMS, OpenMS Library, Fixes, Build System) and fix two incorrect PR number references (#8633→#8637 for SpectrumNativeIDParser, #8725→#8737/#8738 for XICParquetFile). Co-authored-by: Claude Opus 4.6 <[email protected]>
Description
This pull request introduces a new
SpectrumNativeIDParserclass to centralize and modernize spectrum native ID parsing functionality. The parser provides static methods for extracting scan numbers, determining regex patterns, and checking native ID formats, and is now the recommended interface for these operations. The previous methods inSpectrumLookupremain available for backward compatibility but delegate to the new parser. Additionally, Python bindings are provided for the new parser, and documentation is updated accordingly.Native ID Parsing Improvements:
SpectrumNativeIDParserclass, which provides static methods for parsing spectrum native IDs, extracting scan numbers, determining regex patterns, and checking if a string is a native ID. This class supports various vendor formats and CV accessions, and is now the recommended interface for native ID parsing. (src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h, [1] [2]SpectrumLookupto delegate native ID parsing methods (extractScanNumber,getRegExFromNativeID,isNativeID) toSpectrumNativeIDParser, marking them as deprecated for direct use. (src/openms/include/OpenMS/METADATA/SpectrumLookup.h, [1] [2] [3];src/openms/source/METADATA/SpectrumLookup.cpp, [4] [5]Python Bindings:
SpectrumNativeIDParser, making its static methods available in PyOpenMS for native ID parsing. (CHANGELOG, CHANGELOGR19-R28)Documentation and Changelog:
SpectrumNativeIDParseras the primary interface for native ID parsing, and added usage examples. (src/openms/include/OpenMS/METADATA/SpectrumLookup.h, [1];src/openms/include/OpenMS/METADATA/SpectrumNativeIDParser.h, [2]CHANGELOG, CHANGELOGR19-R28)Build System:
SpectrumNativeIDParser.hin the build system for header installation. (src/openms/include/OpenMS/METADATA/sources.cmake, src/openms/include/OpenMS/METADATA/sources.cmakeR32)Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkinswill retrigger Jenkins-based CI buildsSummary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.