Skip to content

Conversation

@ypriverol
Copy link
Member

@ypriverol ypriverol commented Mar 12, 2025

Summary by CodeRabbit

  • Tests
    • Enhanced the automated testing pipeline by integrating new validation scenarios.
    • Now downloads necessary test data and executes two sets of tests to ensure robust package performance.
    • Added a new job to download specific test files for improved testing accuracy.
    • Updated the instantiation of the MS1FeatureDetector class in tests to use default parameters.
  • Bug Fixes
    • Corrected the instantiation of the MS1FeatureDetector class to use default values instead of specified parameters.
  • Chores
    • Improved syntax in the constants import list for better code clarity.
    • Removed an unnecessary newline character in the extract_scan_id function.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2025

Walkthrough

The changes modify the GitHub Actions workflow for the Python package. A new job titled "Download test files" is introduced that uses wget to fetch two specific .mzML files from a remote server. Following this, two testing steps, "Test package online TMT" and "Test package online DIA," are added to execute the quantmsutilsc mzmlstats command with designated parameters using the downloaded files. Additionally, the MS1FeatureDetector class has been updated to remove percentile TIC parameters, affecting its instantiation and feature extraction logic. No changes were made to exported or public entities.

Changes

File Change Summary
.github/workflows/python-package.yml Added a job "Download test files" to fetch two .mzML files via wget; Integrated "Test package online TMT" and "Test package online DIA" steps to run tests.
quantmsutils/mzml/ms1_feature_finder.py Updated MS1FeatureDetector constructor by removing min_ptic and max_ptic; Simplified _extract_features method to append all features unconditionally.
quantmsutils/mzml/mzml_statistics.py Modified instantiation of MS1FeatureDetector to remove min_ptic and max_ptic parameters; Added a comma to the import statement for constants.
tests/test_commands.py Updated instantiation of MS1FeatureDetector in test_feature_finder to remove min_ptic and max_ptic parameters.
quantmsutils/openms.py Removed a newline character at the end of the extract_scan_id function; No change in functional logic.

Possibly related PRs

  • MS1Feature Finder output to parquet.  #49: The changes in the main PR are related to the modifications in the instantiation of the MS1FeatureDetector class in both PRs, as they both involve removing the parameters min_ptic and max_ptic during instantiation.

Suggested reviewers

  • jpfeuffer
  • timosachsenberg

Poem

In the workflow's vibrant code, I hop along,
Downloading files to keep it strong.
Two test steps dance in a neat refrain,
Checking each byte with precision and gain.
I'm a bunny, thrilled with every new song!
🐇💻🌟

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

@ypriverol ypriverol changed the title Dev Update github actions with more examples Mar 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (4)
.github/workflows/python-package.yml (4)

47-50: Enhance Download Step Robustness
The new "Download test files" step uses wget to fetch remote files. Consider adding error handling flags (for example, --fail to exit on HTTP errors and --quiet for less verbose output) or a set -e at the start of the run block. This ensures that the workflow fails fast if a download issue occurs.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 47-47: trailing spaces

(trailing-spaces)


54-56: Typo in Step Name
The step is currently labeled "Text package online DIA," which appears to be a typographical error. It likely should read "Test package online DIA" to remain consistent with the naming in the previous step.


47-47: Remove Trailing Space
Line 47 contains trailing spaces. Removing them will help pass YAML linting without warnings.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 47-47: trailing spaces

(trailing-spaces)


57-58: Remove Trailing Spaces
The empty lines (57 and 58) include trailing spaces. Cleaning these up will improve the file's adherence to YAML formatting guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between df13276 and 4f3d1ca.

📒 Files selected for processing (1)
  • .github/workflows/python-package.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/python-package.yml

[error] 47-47: trailing spaces

(trailing-spaces)


[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build
🔇 Additional comments (1)
.github/workflows/python-package.yml (1)

51-53: Verify Tool Naming Consistency
There is an inconsistency between the tool names used in the CLI steps. Earlier, the "Test commandline tool" step invokes quantmsutilsc --help, whereas this step calls quantmsutils mzmlstats. Please verify and standardize the CLI tool name to avoid potential issues.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (3)
.github/workflows/python-package.yml (3)

47-50: Improve External File Download Reliability.

The "Download test files." step uses wget without extra options to handle failures or retries. Consider adding flags such as --fail, --quiet, and a retry limit (--tries=3) to ensure that the workflow fails if the download is unsuccessful.


54-56: Correct Typo in Step Name.

The step name "Text package online DIA" appears to contain a typo. It should likely be "Test package online DIA" to remain consistent with the naming convention.


57-58: Remove Trailing Spaces.

Static analysis indicates there are trailing spaces on these lines. Removing them will improve file cleanliness and maintain compliance with YAML linting standards.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4f3d1ca and 4280884.

📒 Files selected for processing (1)
  • .github/workflows/python-package.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/python-package.yml

[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: build
  • GitHub Check: build (3.9)
  • GitHub Check: build (3.10)
  • GitHub Check: build
🔇 Additional comments (1)
.github/workflows/python-package.yml (1)

51-53: Verify Command Line Options for TMT Test.

The "Test package online TMT" step invokes quantmsutilsc mzmlstats with the flags --ms_path, --ms2_file, and --feature_detection. Please verify that the --ms2_file flag is intended to be used without an argument (i.e., as a boolean flag) or if it needs a file path or value.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
quantmsutils/mzml/ms1_feature_finder.py (2)

37-41: Documentation inconsistency: Parameters remain in docstring but not in signature

The docstring still mentions min_ptic and max_ptic parameters even though they've been removed from the method signature.

 Parameters
 ----------
-min_ptic : float, optional
-    Minimum percentile TIC to include features, by default 0.05
-max_ptic : float, optional
-    Maximum percentile TIC to include features, by default 0.95
 ms_level : int, optional
     MS level to analyze, by default 1

149-164: Update method docstring to reflect removal of filtering functionality

The docstring for _extract_features should be updated to reflect that features are no longer filtered by pTIC.

 """
-Extract feature information and filter by pTIC.
+Extract feature information.

 Parameters
 ----------
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4280884 and b453cd8.

📒 Files selected for processing (4)
  • quantmsutils/mzml/ms1_feature_finder.py (3 hunks)
  • quantmsutils/mzml/mzml_statistics.py (2 hunks)
  • quantmsutils/openms.py (1 hunks)
  • tests/test_commands.py (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • quantmsutils/openms.py
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.9)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (5)
quantmsutils/mzml/ms1_feature_finder.py (2)

31-31: Signature changed to remove percentile TIC parameters

The constructor has been updated to remove the min_ptic and max_ptic parameters. This is part of a larger change that removes filtering based on percentile TIC from the feature detection process.


186-202: Feature filtering based on percentile TIC removed

The conditional filtering of features based on min_ptic and max_ptic has been removed, so all features are now appended to the feature list regardless of their percentile TIC values. This change will likely result in more features being detected.

I recommend validating that this change is intentional and aligns with the team's expectations regarding feature detection behavior.

quantmsutils/mzml/mzml_statistics.py (1)

610-611: Updated to match new MS1FeatureDetector constructor signature

The instantiation of MS1FeatureDetector has been modified to match the updated constructor signature which no longer includes min_ptic and max_ptic parameters.

tests/test_commands.py (2)

207-207: Updated to match new MS1FeatureDetector constructor signature

The initialization of MS1FeatureDetector in the test has been updated to match the modified constructor signature, removing the min_ptic=0.05 and max_ptic=0.95 parameters.


207-208:

Details

❓ Verification inconclusive

Verify if test coverage is maintained with new feature detection behavior

Since the feature detector now includes all features regardless of percentile TIC values, it would be valuable to verify that the test still adequately validates the feature detection functionality.


🏁 Script executed:

#!/bin/bash
# Check if the test still validates features with the updated behavior

# Look for any assertions related to feature count or filtering
rg -A 5 -B 5 "assert.*feature" tests/test_commands.py

# Check expected feature counts or conditions
rg -A 3 "len\(.*feature.*\)" tests/test_commands.py

Length of output: 109


Action Required: Verify Test Assertions for Updated Feature Detection
It appears that the current test in tests/test_commands.py does not include explicit assertions related to feature counts or the filtering behavior after updating MS1FeatureDetector to include all features regardless of percentile TIC values. No output was found from the grep searches for assertions involving "feature" or "len(...feature...)". Please manually verify that the test (or additional tests) explicitly checks the detector’s functionality with the new behavior. If necessary, add assertions to confirm the expected feature count and validate that changes in filtering do not lead to unintended side effects.

  • Verify that the output (stored in TMT_MS1_FEAURES) is checked against expectations reflecting the inclusion of all features.
  • Consider updating or adding tests with explicit assertions on feature counts or other properties relevant to the new behavior.

@ypriverol ypriverol changed the title Update github actions with more examples Update github actions, more examples added, remove filtering of features based on percentile tic. Mar 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
quantmsutils/mzml/ms1_feature_finder.py (2)

34-34: Method signature updated, but docstring needs alignment

The __init__ method signature has been updated to remove the min_ptic and max_ptic parameters, but the docstring (lines 40-43) still references these parameters.

- def __init__(self, ms_level: int = 1):
+ def __init__(self, ms_level: int = 1):
     """
     Initialize the MS1 feature detector.

     Parameters
     ----------
-    min_ptic : float, optional
-        Minimum percentile TIC to include features, by default 0.05
-    max_ptic : float, optional
-        Maximum percentile TIC to include features, by default 0.95
     ms_level : int, optional
         MS level to analyze, by default 1
     """

152-152: Update method docstring to reflect removal of pTIC filtering

The docstring for _extract_features still mentions filtering by pTIC, but the code no longer performs this filtering.

- Extract feature information and filter by pTIC.
+ Extract feature information.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b453cd8 and b29962b.

📒 Files selected for processing (1)
  • quantmsutils/mzml/ms1_feature_finder.py (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
quantmsutils/mzml/ms1_feature_finder.py (3)

7-13: Docstring correctly reflects the algorithmic improvements

The updated docstring accurately explains the key improvements including the removal of percentile TIC filtering, which aligns with the actual code changes made in this PR.


144-150: Parameter formatting improved

The parameter formatting in the _extract_features method has been improved for better readability.


189-205: Feature extraction logic simplified by removing pTIC filtering

The code now unconditionally adds all features to the feature list, which aligns with the intention to "remove the filtering of percentile TIC" as stated in the updated documentation. This is a good simplification that allows downstream tools to perform any necessary filtering.

@ypriverol ypriverol merged commit c4ad90b into main Mar 12, 2025
7 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