Skip to content

pyopenms: add string accessors for activationmethods - #7876

Merged
timosachsenberg merged 3 commits into
developfrom
py_AllActivationMethods
Mar 5, 2025
Merged

timosachsenberg merged 3 commits into
developfrom
py_AllActivationMethods

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Mar 4, 2025 •

Copy link
Copy Markdown
Contributor

Description

Provides stable string identifier for pyopenms. requested by @ypriverol

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

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.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features

    • Introduced enhanced functionality to retrieve activation method details in both complete and abbreviated formats, offering more descriptive options to users.
  • Tests

    • Expanded test coverage to ensure reliable and accurate behavior of the new activation method retrieval features.

@coderabbitai

coderabbitai Bot commented Mar 4, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes extend the Precursor class in both C++ and Python by adding four new methods. Two static methods return all activation method names in both full and short forms, while two instance methods provide the same for activation methods set on the instance. Corresponding implementations and declarations were added in header, source, and Python binding files. New unit tests in both C++ and Python verify the correctness of these methods.

Changes

File(s) Change Summary
src/openms/include/.../Precursor.h
src/openms/source/.../Precursor.cpp
Added new methods to the Precursor class: getAllNamesOfActivationMethods(), getAllShortNamesOfActivationMethods(), getActivationMethodsAsShortString(), and updated the comment for getActivationMethodsAsString().
src/pyOpenMS/pxds/Precursor.pxd Extended Python binding declarations with new methods: getActivationMethodsAsString(), getActivationMethodsAsShortString(), getAllNamesOfActivationMethods(), and getAllShortNamesOfActivationMethods() to mirror C++ functionality.
src/pyOpenMS/tests/unittests/test000.py
src/tests/class_tests/openms/source/Precursor_test.cpp
Introduced unit tests for the new instance and static methods, verifying output for both full and short string representations of activation methods, and ensuring the returned list sizes match the defined constant for activation methods.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Precursor
    participant DataStore

    User ->> Precursor: getActivationMethodsAsString()
    Precursor ->> DataStore: Retrieve full method names
    DataStore -->> Precursor: Return full names
    Precursor -->> User: Return full names StringList

    User ->> Precursor: getActivationMethodsAsShortString()
    Precursor ->> DataStore: Retrieve short method names
    DataStore -->> Precursor: Return short names
    Precursor -->> User: Return short names StringList

    User ->> Precursor: getAllNamesOfActivationMethods()
    Precursor ->> DataStore: Iterate over full names array
    DataStore -->> Precursor: Return full names
    Precursor -->> User: Return full names list

    User ->> Precursor: getAllShortNamesOfActivationMethods()
    Precursor ->> DataStore: Iterate over short names array
    DataStore -->> Precursor: Return short names
    Precursor -->> User: Return short names list
Loading

Poem

I’m a little rabbit, hopping near the code,
New methods sprouted along the data road.
Full names and short, side by side they play,
In C++ and Python, brightening the day.
With tests that check each twist and turn,
I celebrate the changes with a joyful churn!
🐇💻 Hop on, happy code, hop on!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0e174a and 489f382.

📒 Files selected for processing (1)
  • src/tests/class_tests/openms/source/Precursor_test.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/class_tests/openms/source/Precursor_test.cpp
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (windows-2022, cl.exe, default)
  • GitHub Check: cppcheck-test

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
src/pyOpenMS/tests/unittests/test000.py (2)

4479-4487: Add more robust assertions for static activation method accessors.

The current test checks only one activation method (CID) for each accessor. While this is valid, it would be more comprehensive to test multiple methods or verify all methods are correctly represented.

    # Test static methods for all activation methods
    all_names = pyopenms.Precursor.getNamesOfAllActivationMethods()
    assert len(all_names) == pyopenms.Precursor.ActivationMethod.SIZE_OF_ACTIVATIONMETHOD
    assert all_names[pyopenms.Precursor.ActivationMethod.CID].decode() == "Collision-induced dissociation"
+   assert all_names[pyopenms.Precursor.ActivationMethod.HCD].decode() == "beam-type collision-induced dissociation"
    
    all_short_names = pyopenms.Precursor.getShortNamesOfAllActivationMethods()
    assert len(all_short_names) == pyopenms.Precursor.ActivationMethod.SIZE_OF_ACTIVATIONMETHOD
    assert all_short_names[pyopenms.Precursor.ActivationMethod.CID].decode() == "CID"
+   assert all_short_names[pyopenms.Precursor.ActivationMethod.HCD].decode() == "HCD"

4462-4467: Consider using an enumeration approach for better test maintenance.

Since you're testing both the presence of activation methods and their string representations, consider using a dictionary mapping that connects the enum value, short name, and long name. This makes the test more maintainable if new activation methods are added.

-    methods = set([pyopenms.Precursor.ActivationMethod.CID, 
-                  pyopenms.Precursor.ActivationMethod.HCD])
-    methods_short = ["CID", "HCD"]
-    methods_long = ["Collision-induced dissociation", "beam-type collision-induced dissociation"]
+    # Define a mapping of activation methods to their expected string representations
+    activation_method_mapping = {
+        pyopenms.Precursor.ActivationMethod.CID: {
+            "short": "CID", 
+            "long": "Collision-induced dissociation"
+        },
+        pyopenms.Precursor.ActivationMethod.HCD: {
+            "short": "HCD", 
+            "long": "beam-type collision-induced dissociation"
+        }
+    }
+    methods = set(activation_method_mapping.keys())
+    methods_short = [info["short"] for info in activation_method_mapping.values()]
+    methods_long = [info["long"] for info in activation_method_mapping.values()]
src/openms/source/METADATA/Precursor.cpp (1)

151-152: Remove unnecessary blank lines.

There are two consecutive blank lines here that aren't needed.

  return am;
}

-

-
void Precursor::setActivationMethods(const set<Precursor::ActivationMethod> & activation_methods)
src/tests/class_tests/openms/source/Precursor_test.cpp (2)

108-109: Consider adding additional validation for method content.

While the size check is good, the test could be more robust by also verifying the contents of at least one element in the returned StringList. This would ensure the correctness of the values being returned, not just the count.

  StringList result = Precursor::getNamesOfAllActivationMethods();
  TEST_EQUAL(result.size(), Precursor::SIZE_OF_ACTIVATIONMETHOD);
+ // Verify the first element matches the expected value
+ TEST_EQUAL(result[0], "Collision-induced dissociation");

113-114: Consider adding additional validation for method content.

As with the previous test, consider verifying the content of at least one element in the returned StringList to ensure the values are correct.

  StringList result = Precursor::getShortNamesOfAllActivationMethods();
  TEST_EQUAL(result.size(), Precursor::SIZE_OF_ACTIVATIONMETHOD);
+ // Verify the first element matches the expected value
+ TEST_EQUAL(result[0], "CID");
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97553fb and 63e7f4c.

📒 Files selected for processing (5)
  • src/openms/include/OpenMS/METADATA/Precursor.h (1 hunks)
  • src/openms/source/METADATA/Precursor.cpp (1 hunks)
  • src/pyOpenMS/pxds/Precursor.pxd (1 hunks)
  • src/pyOpenMS/tests/unittests/test000.py (1 hunks)
  • src/tests/class_tests/openms/source/Precursor_test.cpp (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (windows-2022, cl.exe, default)
  • GitHub Check: cppcheck-test
🔇 Additional comments (12)
src/openms/include/OpenMS/METADATA/Precursor.h (1)

96-101: Well-structured method additions with clear naming

These new accessor methods are well-designed with clear intentions:

  • getActivationMethodsAsShortString() complements the existing string method with a shortened representation
  • The static methods provide comprehensive access to all available activation method names
  • Method signatures follow the established class conventions

The methods have appropriate modifiers (const, static) and return types that are consistent with the existing pattern.

src/pyOpenMS/pxds/Precursor.pxd (2)

26-27: Good implementation of Python string accessors

The Python bindings for these methods are well-implemented:

  • Return type libcpp_vector[String] is appropriate for exposing string collections to Python
  • Exception handling with except + nogil is correctly applied
  • Documentation comments clearly describe the purpose of each method

30-33: Well-implemented static methods for Python

The static accessor methods are correctly implemented:

  • @staticmethod decorator is properly applied
  • Method signatures match their C++ counterparts
  • Documentation comments clearly describe what these methods return
  • Empty line after the static methods maintains code organization

These will be useful for Python users who need to enumerate all possible activation methods.

src/pyOpenMS/tests/unittests/test000.py (2)

4464-4465: LGTM! String constant definitions for testing.

The string constants for short and long activation method names are correctly defined and will be used in assertions later.


4473-4478: LGTM! Thorough tests for activation method string accessors.

The test properly verifies that both short and long string representations of activation methods are correctly returned. The use of sorted() in the assertions is a good practice since it ensures the test is resilient to order changes.

src/openms/source/METADATA/Precursor.cpp (3)

118-127: LGTM! Implementation of getActivationMethodsAsShortString is clean and consistent.

The implementation mirrors the existing getActivationMethodsAsString() method but returns short names instead of full names. Good use of reserve() to avoid unnecessary reallocations.


129-138: LGTM! Well-implemented static method for retrieving all activation method names.

This static method properly iterates through all available activation methods and returns their full names in a StringList. The use of reserve() is a good performance optimization.


140-149: LGTM! Well-implemented static method for retrieving all short activation method names.

This static method follows the same pattern as getNamesOfAllActivationMethods() but returns the short names. Consistent implementation and good memory management with reserve().

src/tests/class_tests/openms/source/Precursor_test.cpp (4)

87-96: LGTM! Comprehensive test for getActivationMethodsAsString().

This test properly verifies that the method returns a StringList with the expected content. Good validation of both the size and the actual string value.


97-106: LGTM! Comprehensive test for getActivationMethodsAsShortString().

The test mirrors the previous one for getActivationMethodsAsString() but verifies the short form instead. Good consistency in testing approach.


107-111: LGTM! Appropriate test for getNamesOfAllActivationMethods().

The test confirms that the static method returns a StringList with the correct number of elements.


112-116: LGTM! Appropriate test for getShortNamesOfAllActivationMethods().

Similar to the previous test, this verifies that the static method returns a StringList with the correct number of elements.

Comment thread src/pyOpenMS/pxds/Precursor.pxd Outdated
Precursor(Precursor &) except + nogil

libcpp_set[ActivationMethod] getActivationMethods() except + nogil # wrap-doc:Returns the activation methods
libcpp_vector[String] getActivationMethodsAsString() except + nogil # wrap-doc:Returns the activation methods as strings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still confusing IMHO. What is the difference between this and "All"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each precursor can have multiple activation methods and that method already existed on the c++ side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I agree that it is a bit confusing. do you have a quick suggestion? I can implement

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was before "getAllActivationMethods" was added. I think now it needs additional clarification.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/pyOpenMS/pxds/Precursor.pxd (1)

25-34: Consider adding a usage example to further clarify the differences between methods.

While the documentation for each method is good individually, a short usage example in the class-level documentation (around line 21) might help users understand the relationship between these five related methods more easily:

  • getActivationMethods() - enum values
  • getActivationMethodsAsString() / getActivationMethodsAsShortString() - instance-specific strings
  • getAllNamesOfActivationMethods() / getAllShortNamesOfActivationMethods() - all possible strings

Example for class documentation:

# ...
# - selected ion (m/z, intensity, charge, possible charge states)
# - ion mobility drift time
+#
+# Example:
+# ```
+# precursor = Precursor()
+# precursor.setActivationMethods([Precursor.CID, Precursor.HCD])
+# 
+# # Get enum values for this instance
+# methods = precursor.getActivationMethods()  # Returns {CID, HCD}
+# 
+# # Get string representations for this instance
+# method_names = precursor.getActivationMethodsAsString()  # ["Collision-induced dissociation", "beam-type collision-induced dissociation"]
+# method_abbreviations = precursor.getActivationMethodsAsShortString()  # ["CID", "HCD"]
+# 
+# # Get ALL possible activation methods (static methods)
+# all_names = Precursor.getAllNamesOfActivationMethods()  # Returns all names including those not set on this instance
+# all_abbreviations = Precursor.getAllShortNamesOfActivationMethods()  # Returns all abbreviations
+# ```
src/openms/source/METADATA/Precursor.cpp (1)

150-152: Remove unnecessary blank lines.

There are two consecutive empty lines here that aren't necessary according to the coding style in the rest of the file, which typically uses only one blank line as a separator.

  return am;
}

-

-
void Precursor::setActivationMethods(const set<Precursor::ActivationMethod> & activation_methods)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63e7f4c and c0e174a.

📒 Files selected for processing (4)
  • src/openms/include/OpenMS/METADATA/Precursor.h (2 hunks)
  • src/openms/source/METADATA/Precursor.cpp (1 hunks)
  • src/pyOpenMS/pxds/Precursor.pxd (1 hunks)
  • src/pyOpenMS/tests/unittests/test000.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/openms/include/OpenMS/METADATA/Precursor.h
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (windows-2022, cl.exe, default)
  • GitHub Check: cppcheck-test
🔇 Additional comments (9)
src/pyOpenMS/pxds/Precursor.pxd (2)

26-27: Well-implemented instance methods with clear documentation.

These new methods provide a valuable way to get string representations of activation methods, making them more human-readable. The documentation clearly specifies that these return the methods set on this specific instance.


30-34: Good addition of static methods for accessing all possible activation methods.

These static methods are well-implemented and solve the confusion mentioned in previous review comments. The documentation now explicitly distinguishes between instance-specific methods and methods that return all possible values.

The naming convention and documentation directly address the confusion mentioned by @jpfeuffer in previous comments by making it clear these return ALL possible activation methods, not just the ones set on a specific instance.

src/pyOpenMS/tests/unittests/test000.py (3)

4464-4466: Good addition of test constants for expected values.

These constants provide expected values for both short and long forms of activation method names, making the subsequent assertions more maintainable and readable.


4473-4477: Well-structured test for string representation of activation methods.

This test verifies that the newly added methods getActivationMethodsAsShortString() and getActivationMethodsAsString() correctly return the expected string representations of activation methods. The test handles the byte strings returned from C++ appropriately by decoding them before comparison.


4479-4487: Comprehensive testing of static methods for activation method names.

This section thoroughly tests the new static methods getAllNamesOfActivationMethods() and getAllShortNamesOfActivationMethods(). It verifies both the length of the returned lists and the correctness of specific entries. The implementation correctly checks that the number of elements matches SIZE_OF_ACTIVATIONMETHOD and validates the actual string content with specific assertions.

src/openms/source/METADATA/Precursor.cpp (4)

118-127: Well-implemented accessor for activation method short names.

This method nicely parallels the existing getActivationMethodsAsString() method but returns short form identifiers instead of full names. The implementation correctly reserves memory for optimal performance and maintains consistency with the class's code style.


129-138:

Details

❓ Verification inconclusive

Static method implementation looks good.

This static utility method provides access to all possible activation method names, which is useful for clients that need to enumerate all available options. The implementation uses appropriate memory reservation for optimization.


🏁 Script executed:

#!/bin/bash
# Verify that this method is declared as static in the header file
rg "static\s+StringList\s+getAllNamesOfActivationMethods" include/OpenMS/METADATA/Precursor.h

Length of output: 171


Action Required: Please verify the correct header file path for the static declaration

  • The implementation in src/openms/source/METADATA/Precursor.cpp looks good, with optimal memory reservation for returning all activation method names.
  • The shell script checked for the static declaration in include/OpenMS/METADATA/Precursor.h, but it failed to locate the file. This suggests that either the header is in a different location or there's a path misconfiguration.
  • Please manually verify that getAllNamesOfActivationMethods() is declared as static in the proper header file. If the header file exists elsewhere (e.g., under src/openms/include/METADATA/Precursor.h), update the verification command accordingly.

16-58:

Details

❓ Verification inconclusive

Verify activation method arrays have consistent lengths.

The NamesOfActivationMethod and NamesOfActivationMethodShort arrays both need to have the same number of elements (equal to SIZE_OF_ACTIVATIONMETHOD). This ensures that the index-based lookups in the new methods will work correctly. Both arrays currently have 19 elements, which seems consistent.


🏁 Script executed:

#!/bin/bash
# Check the definition of SIZE_OF_ACTIVATIONMETHOD and verify it matches the array sizes
rg "SIZE_OF_ACTIVATIONMETHOD" include/OpenMS/METADATA/Precursor.h

Length of output: 141


Action Required: Verify SIZE_OF_ACTIVATIONMETHOD in the Header

Both arrays in src/openms/source/METADATA/Precursor.cpp contain 19 elements, ensuring consistency with each other. However, since the initial search for SIZE_OF_ACTIVATIONMETHOD in include/OpenMS/METADATA/Precursor.h did not yield any results, please manually verify that the header file (or the appropriate location where SIZE_OF_ACTIVATIONMETHOD is defined) sets this constant to 19. This manual check is necessary to ensure that the index-based lookups using these arrays remain valid.

  • Confirm the existence and location of the Precursor.h file (or equivalent) in the repository.
  • Ensure that SIZE_OF_ACTIVATIONMETHOD is defined and matches the expected value of 19.

140-149:

Details

✅ Verification successful

Static method properly returns all short names of activation methods.

This implementation correctly provides access to all short form identifiers. The code maintains consistency with the previous static method and follows good memory optimization practices.


🏁 Script executed:

#!/bin/bash
# Verify that this method is declared as static in the header file
rg "static\s+StringList\s+getAllShortNamesOfActivationMethods" include/OpenMS/METADATA/Precursor.h

Length of output: 176


Below is a new shell script to search the repository for any header files named “Precursor.h”. This will help us locate where the declaration for getAllShortNamesOfActivationMethods might reside:

Additionally, you can run the following command to search across all header files for the method declaration:

Review Update:
The implementation in src/openms/source/METADATA/Precursor.cpp correctly returns all short names of activation methods with good memory optimization. However, the initial verification for a static declaration in include/OpenMS/METADATA/Precursor.h did not yield any results—likely because either the header file is located elsewhere or the file path is outdated. Please verify the correct location of Precursor.h and ensure the declaration (including the static specifier) is present.


🏁 Script executed:

#!/bin/bash
# Find all files named Precursor.h in the repository
find . -type f -name "Precursor.h"

Length of output: 205


🏁 Script executed:

#!/bin/bash
rg "static\s+StringList\s+getAllShortNamesOfActivationMethods" -g "*.h"

Length of output: 303


Static method declaration and implementation verified

  • The header file was found at src/openms/include/OpenMS/METADATA/Precursor.h, and the declaration
    static StringList getAllShortNamesOfActivationMethods();
    is correctly present.
  • The implementation in src/openms/source/METADATA/Precursor.cpp is consistent with the header and follows good memory optimization practices.

@jpfeuffer

jpfeuffer commented Mar 5, 2025 •

Copy link
Copy Markdown
Contributor

Not really. getActivationMethodEnumPossibleValues? Extend docs? You know that docs do not need to fit into one line right?

Ideally the enums should be its own namespace. We have the thing with string values for enums so often that it might be worth it to write a wrapper around such things:
https://github.com/Neargye/magic_enum

@timosachsenberg

Copy link
Copy Markdown
Contributor Author

ok I updated the doc.
I think this PR is good to go. I will try the enum class approach again in the other PR

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.

2 participants