Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Summary: Add Algorithm Selection Options to Hardcoded Methods

Problem Statement

The codebase had several methods with hardcoded algorithms. This PR adds flexibility to choose different algorithms while maintaining backward compatibility.

Changes Implemented

1. Feature Grouping Algorithms ✅

Files Modified:

  • openms_python/py_consensusmap.py
  • openms_python/workflows.py

New Functionality:

  • Py_ConsensusMap.align_and_link(): Added grouping_method and grouping_params parameters
  • link_features(): Added grouping_method parameter
  • Supported algorithms: "qt" (default), "kd", "labeled", "unlabeled"

Example Usage:

# Use KD-tree based grouping
consensus = Py_ConsensusMap.align_and_link(
    feature_maps,
    alignment_method="identity",
    grouping_method="kd"
)

# Use QT clustering with custom parameters
consensus = link_features(
    feature_maps,
    grouping_method="qt",
    params={"distance_RT:max_difference": 100.0}
)

2. Peak Picking Algorithms ✅

Files Modified:

  • openms_python/py_msexperiment.py

New Functionality:

  • Added "iterative" to PEAK_PICKER_REGISTRY
  • Now supports: "hires" (default), "cwt", "iterative"

Example Usage:

# Use iterative peak picker
picked = exp.pick_peaks(method="iterative", ms_levels=1)

3. Documentation ✅

Files Modified:

  • README.md

Updates:

  • Updated consensus alignment section to show grouping algorithm options
  • Updated peak picking section to show all available algorithms
  • Updated workflow helpers section to demonstrate parameter usage

Testing & Quality Assurance

  • Added 5 new tests covering all new functionality
  • All 83 tests pass
  • No security vulnerabilities detected (CodeQL scan)
  • No breaking changes to existing API
  • README updated with usage examples

Backward Compatibility

All changes are fully backward compatible:

  • Default values maintain existing behavior
  • All existing tests pass without modification
  • New parameters are optional and keyword-only

Files Changed

  1. openms_python/py_consensusmap.py (+39/-2)
  2. openms_python/py_msexperiment.py (+1)
  3. openms_python/workflows.py (+38/-3)
  4. tests/test_consensus_map.py (+42)
  5. tests/test_py_msexperiment.py (+12)
  6. tests/test_workflows.py (+47)
  7. README.md (+16/-4) - documentation updates

Total: 190 insertions, 9 deletions

Security Summary

CodeQL security scan completed successfully with 0 alerts. No security vulnerabilities introduced.

Original prompt
  • some of the methods have a lot of hardcoded algorithms in there. Decide were it makes sense to add an option to choose the algorithm and pass parameters

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link

coderabbitai bot commented Nov 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits November 19, 2025 11:41
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to choose algorithms and pass parameters Add algorithm selection to feature grouping and peak picking methods Nov 19, 2025
@timosachsenberg
Copy link
Contributor

@copilot test it if not already done and update readme

Co-authored-by: timosachsenberg <5803621+timosachsenberg@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot test it if not already done and update readme

Tests completed successfully - all 83 tests pass. README updated with documentation for the new algorithm selection options in commit 2f42d7f.

The documentation now covers:

  • Feature grouping algorithm options (qt, kd, labeled, unlabeled) in align_and_link() and link_features()
  • Peak picking algorithm options (hires, cwt, iterative) in pick_peaks()
  • Example usage with parameters in the workflow helpers section

@timosachsenberg timosachsenberg marked this pull request as ready for review November 19, 2025 11:55
@timosachsenberg timosachsenberg merged commit 72ef880 into master Nov 19, 2025
3 checks passed
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