Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add wrappers for ROOT rootcp CLI tool #3251

Merged
merged 6 commits into from
Sep 17, 2024

Conversation

GoodingJamie
Copy link
Contributor

@GoodingJamie GoodingJamie commented Sep 17, 2024

Adds Snakemake wrappers for the ROOT command line tool rootcp.

QC

While the contributions guidelines are more extensive, please particularly ensure that:

  • test.py was updated to call any added or updated example rules in a Snakefile
  • input: and output: file paths in the rules can be chosen arbitrarily
  • wherever possible, command line arguments are inferred and set automatically (e.g. based on file extensions in input: or output:)
  • temporary files are either written to a unique hidden folder in the working directory, or (better) stored where the Python function tempfile.gettempdir() points to
  • the meta.yaml contains a link to the documentation of the respective tool or command under url:
  • conda environments use a minimal amount of channels and packages, in recommended ordering

Summary by CodeRabbit

  • New Features

    • Introduced a Conda environment specification for Linux 64-bit, ensuring reproducibility with explicit package URLs.
    • Added a configuration for the ROOT framework, streamlining setup for scientific computing projects.
    • Launched the rootcp tool for copying ROOT files via command line, enhancing usability with detailed input and output specifications.
    • Implemented a workflow rule in Snakemake for automated copying of ROOT files with specified configurations.
  • Bug Fixes

    • Added tests to verify the functionality of the rootcp process, ensuring reliability.

@GoodingJamie GoodingJamie marked this pull request as draft September 17, 2024 12:08
Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Warning

Rate limit exceeded

@GoodingJamie has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 26 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Commits

Files that changed from the base of the PR and between 8144a54 and 0a14def.

Walkthrough

The changes introduce several new files related to the rootcp tool, which facilitates copying ROOT files and objects. This includes a Conda environment specification for Linux, a YAML configuration for ROOT, a metadata file for the rootcp tool, a Snakemake workflow rule for processing ROOT files, and a Python wrapper for executing the rootcp command. Additionally, a new test function is added to verify the functionality of the rootcp process.

Changes

Files Change Summary
phys/root/rootcp/environment.linux-64.pin.txt, phys/root/rootcp/environment.yaml Introduced explicit Conda environment specifications, including package URLs and dependencies for scientific computing.
phys/root/rootcp/meta.yaml Added metadata for the rootcp tool, including name, description, author, input/output requirements, and parameters.
phys/root/rootcp/test/Snakefile Introduced a Snakemake rule for copying ROOT files, specifying input, output, and parameters.
phys/root/rootcp/wrapper.py Created a Python script to execute the rootcp command within a Snakemake workflow, handling parameters and logging.
test.py Added a new test function to verify the functionality of the rootcp process conditionally.

Possibly related PRs

  • feat: Deeptools plot pca #3138: The changes in environment.linux-64.pin.txt and environment.yaml files are similar to those in the main PR, as both introduce Conda environment specifications for different packages, ensuring reproducibility and consistency in scientific computing environments.
  • feat: Enhance phys/root/filter functionality #3250: The enhancements to the filtering functionality in the phys/root/filter module relate to the main PR's focus on improving usability and functionality in data processing, particularly in the context of ROOT files, which aligns with the scientific computing theme of the main PR.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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 generate interesting stats about this repository and render them as a table.
    -- @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 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.

@GoodingJamie GoodingJamie changed the title feat: Add wrappers for ROOT CLI tools feat: Add wrappers for ROOT rootcp CLI tool Sep 17, 2024
@GoodingJamie GoodingJamie marked this pull request as ready for review September 17, 2024 12:59
@fgvieira
Copy link
Collaborator

Thanks a lot for your contributions!
Just some small cosmetic tweaks. 😄

@GoodingJamie
Copy link
Contributor Author

Thanks a bunch @fgvieira, all of the nice ways to tidy the wrapper up suggested above are in now 😁

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

Outside diff range and nitpick comments (2)
phys/root/rootcp/meta.yaml (1)

14-14: Add a newline at the end of the file.

To adhere to best practices and maintain consistency, please add a newline character at the end of the file.

Tools
yamllint

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

test.py (1)

Line range hint 12-24: The current discount policy may have unintended consequences.

Applying a flat $20 fee after the loyalty discount has the potential to negate the discount's benefit, especially for customers in the lower loyalty tiers making small purchases.

For example, a customer with 3 years of loyalty making a $100 purchase would see their bill discounted to $90 (10% off), but the $20 fee would bring it to $110, which is higher than the original undiscounted amount.

This may disincentivize customers from maintaining loyalty and cause frustration when the "discount" results in a higher total cost.

Consider adjusting the discount percentages and/or the flat fee logic to ensure the loyalty program appropriately incentivizes and rewards customers as intended. Some ideas:

  • Increase the discount percentages to offset the $20 fee impact
  • Make the fee a percentage of the discounted subtotal instead of a flat amount
  • Waive the fee for lower subtotals or loyalty tiers
  • Only apply the fee to the original total before the discount is applied

The exact adjustments will depend on your business goals, but the key is to avoid scenarios where the loyalty discount unintentionally penalizes customers.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4797d76 and 8144a54.

Files selected for processing (6)
  • phys/root/rootcp/environment.linux-64.pin.txt (1 hunks)
  • phys/root/rootcp/environment.yaml (1 hunks)
  • phys/root/rootcp/meta.yaml (1 hunks)
  • phys/root/rootcp/test/Snakefile (1 hunks)
  • phys/root/rootcp/wrapper.py (1 hunks)
  • test.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • phys/root/rootcp/environment.linux-64.pin.txt
Additional context used
Path-based instructions (2)
phys/root/rootcp/wrapper.py (2)

Pattern **/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.


Pattern **/wrapper.py: Do not complain about use of undefined variable called snakemake.

test.py (1)

Pattern **/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

Ruff
phys/root/rootcp/wrapper.py

9-9: Undefined name snakemake

(F821)


10-10: Undefined name snakemake

(F821)


12-12: Undefined name snakemake

(F821)


16-16: Undefined name snakemake

(F821)

yamllint
phys/root/rootcp/meta.yaml

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

Additional comments not posted (8)
phys/root/rootcp/environment.yaml (2)

1-2: LGTM!

Using the conda-forge channel is a good choice as it provides a wide range of community-maintained packages.


3-4: LGTM!

The ROOT version 6.30.4 is consistent with the past review comment. Good job addressing the feedback!

phys/root/rootcp/test/Snakefile (1)

1-13: LGTM!

The rootcp rule is well-structured and follows the Snakemake syntax. It enhances the functionality of the workflow by enabling automated copying of ROOT files with specified configurations.

Some key observations:

  • The rule specifies input, log, params, threads, output, and wrapper, providing a clear and maintainable structure.
  • The wrapper abstraction allows for a clean implementation by encapsulating the copying logic.
  • The logging configuration ensures that the process can be monitored and debugged if needed.
  • The parameters allow for customization of the copying process, such as specifying the input object name and extra options.

Overall, the rule is well-designed and adds value to the workflow.

phys/root/rootcp/wrapper.py (1)

1-22: LGTM!

The script follows the expected structure and logic for a Snakemake wrapper. It correctly handles optional parameters, executes the rootcp command, and logs the output. The code changes are well-implemented and provide flexibility to the user.

Tools
Ruff

9-9: Undefined name snakemake

(F821)


10-10: Undefined name snakemake

(F821)


12-12: Undefined name snakemake

(F821)


16-16: Undefined name snakemake

(F821)

phys/root/rootcp/meta.yaml (3)

1-5: LGTM!

The metadata section is well-defined, providing essential information about the rootcp tool, including its name, description, documentation URL, and author. This enhances the discoverability and usability of the tool.


6-10: LGTM!

The input and output specifications are well-defined, clearly indicating the expected input (ROOT file/object(s) target and destination) and output (single ROOT file containing copied target object(s)). This clarity helps users understand the tool's expected input and output.


11-14: LGTM!

The parameters section is well-defined, providing optional and extra parameters for the rootcp tool. The extra parameter allows users to pass additional parameters to rootcp as documented by ROOT, while the input_object_name and output_object_name parameters offer granular control over the copying process. This enhances the tool's flexibility and usability.

Tools
yamllint

[error] 14-14: no new line character at the end of file

(new-line-at-end-of-file)

test.py (1)

6855-6860: Looks good!

The new test_root_rootcp function properly tests the "phys/root/rootcp" wrapper using the standard pattern. Nice work.

@fgvieira fgvieira self-assigned this Sep 17, 2024
@fgvieira fgvieira merged commit 0be5d56 into snakemake:master Sep 17, 2024
6 checks passed
johanneskoester pushed a commit that referenced this pull request Sep 20, 2024
🤖 I have created a release \*beep\* \*boop\*
---
##
[4.5.0](https://www.github.com/snakemake/snakemake-wrappers/compare/v4.4.0...v4.5.0)
(2024-09-20)


### Features

* Add wrappers for ROOT rootcp CLI tool
([#3251](https://www.github.com/snakemake/snakemake-wrappers/issues/3251))
([0be5d56](https://www.github.com/snakemake/snakemake-wrappers/commit/0be5d566f4767b7cd2ea9ba78b0d83a6f79a4803))
* Bump meryl version
([#3266](https://www.github.com/snakemake/snakemake-wrappers/issues/3266))
([448a1cb](https://www.github.com/snakemake/snakemake-wrappers/commit/448a1cb793d04f7bd280c36bc4dd37d2d06aa104))
* Enhance phys/root/filter functionality
([#3250](https://www.github.com/snakemake/snakemake-wrappers/issues/3250))
([4797d76](https://www.github.com/snakemake/snakemake-wrappers/commit/4797d76630b0cc6ea05778a49727f7917b7874dc))
* Parse threads
([#3249](https://www.github.com/snakemake/snakemake-wrappers/issues/3249))
([9e63554](https://www.github.com/snakemake/snakemake-wrappers/commit/9e63554b0cf19b2a22513566a576105c39f47e3b))


### Bug Fixes

* name of bamqc
([#1464](https://www.github.com/snakemake/snakemake-wrappers/issues/1464))
([ee04ec2](https://www.github.com/snakemake/snakemake-wrappers/commit/ee04ec22b24c8d380ef98f5cee677f4ff4730ad3))


### Performance Improvements

* autobump bio/cnv_facets
([#3253](https://www.github.com/snakemake/snakemake-wrappers/issues/3253))
([c5c8ddd](https://www.github.com/snakemake/snakemake-wrappers/commit/c5c8ddded41ba96fd8bbc69790e1e17998551734))
* autobump bio/emu/abundance
([#3256](https://www.github.com/snakemake/snakemake-wrappers/issues/3256))
([6e42aef](https://www.github.com/snakemake/snakemake-wrappers/commit/6e42aef12570e7708dedd4ed24a7406a69356d81))
* autobump bio/emu/collapse-taxonomy
([#3255](https://www.github.com/snakemake/snakemake-wrappers/issues/3255))
([969067e](https://www.github.com/snakemake/snakemake-wrappers/commit/969067e8a94210d99bb67dfb3525c076f7731d02))
* autobump bio/emu/combine-outputs
([#3254](https://www.github.com/snakemake/snakemake-wrappers/issues/3254))
([de2a1be](https://www.github.com/snakemake/snakemake-wrappers/commit/de2a1bef7e9d330c4d6484bf0f1f250d7ad6c0c9))
* autobump bio/freebayes
([#3257](https://www.github.com/snakemake/snakemake-wrappers/issues/3257))
([80630dd](https://www.github.com/snakemake/snakemake-wrappers/commit/80630dd19aa113ea94dd55f89f596b83e81ebc34))
* autobump bio/galah
([#3258](https://www.github.com/snakemake/snakemake-wrappers/issues/3258))
([285d57a](https://www.github.com/snakemake/snakemake-wrappers/commit/285d57a8dd082fb515250fdc370cca11142fff44))
* autobump bio/gdc-api/bam-slicing
([#3259](https://www.github.com/snakemake/snakemake-wrappers/issues/3259))
([27b6958](https://www.github.com/snakemake/snakemake-wrappers/commit/27b695863bc123ba93fff53a130a0d7a06b4b2c1))
* autobump bio/igv-reports
([#3260](https://www.github.com/snakemake/snakemake-wrappers/issues/3260))
([a7d57ba](https://www.github.com/snakemake/snakemake-wrappers/commit/a7d57ba191bb59060dc82b9009a11c78dbaba86e))
* autobump bio/lofreq/call
([#3262](https://www.github.com/snakemake/snakemake-wrappers/issues/3262))
([13626f0](https://www.github.com/snakemake/snakemake-wrappers/commit/13626f0b9d3d25bafd04a3253f37b6bfd91414bc))
* autobump bio/lofreq/indelqual
([#3261](https://www.github.com/snakemake/snakemake-wrappers/issues/3261))
([76c854e](https://www.github.com/snakemake/snakemake-wrappers/commit/76c854e127cd792b5f74f8dc357f09fddb07998c))
* autobump bio/multiqc
([#3263](https://www.github.com/snakemake/snakemake-wrappers/issues/3263))
([d4d1475](https://www.github.com/snakemake/snakemake-wrappers/commit/d4d14750f10aa5f10fd5b20f560e13985a0f758f))
* autobump bio/tabix/index
([#3264](https://www.github.com/snakemake/snakemake-wrappers/issues/3264))
([e39e97e](https://www.github.com/snakemake/snakemake-wrappers/commit/e39e97e96fa26ab40e34a207ed62410453d28bae))
* autobump bio/vep/annotate
([#3265](https://www.github.com/snakemake/snakemake-wrappers/issues/3265))
([7f0b02a](https://www.github.com/snakemake/snakemake-wrappers/commit/7f0b02ac64b40a5aca8bd08c90f8b7df80ea4bed))
---


This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Sep 24, 2024
7 tasks
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