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

Add hmftools-redux 1.0_beta #51151

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Conversation

scwatts
Copy link
Contributor

@scwatts scwatts commented Oct 4, 2024

Add recipe for hmftools-redux 1.0_beta


Please read the guidelines for Bioconda recipes before opening a pull request (PR).

General instructions

  • If this PR adds or updates a recipe, use "Add" or "Update" appropriately as the first word in its title.
  • New recipes not directly relevant to the biological sciences need to be submitted to the conda-forge channel instead of Bioconda.
  • PRs require reviews prior to being merged. Once your PR is passing tests and ready to be merged, please issue the @BiocondaBot please add label command.
  • Please post questions on Gitter or ping @bioconda/core in a comment.

Instructions for avoiding API, ABI, and CLI breakage issues

Conda is able to record and lock (a.k.a. pin) dependency versions used at build time of other recipes.
This way, one can avoid that expectations of a downstream recipe with regards to API, ABI, or CLI are violated by later changes in the recipe.
If not already present in the meta.yaml, make sure to specify run_exports (see here for the rationale and comprehensive explanation).
Add a run_exports section like this:

build:
  run_exports:
    - ...

with ... being one of:

Case run_exports statement
semantic versioning {{ pin_subpackage("myrecipe", max_pin="x") }}
semantic versioning (0.x.x) {{ pin_subpackage("myrecipe", max_pin="x.x") }}
known breakage in minor versions {{ pin_subpackage("myrecipe", max_pin="x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
known breakage in patch versions {{ pin_subpackage("myrecipe", max_pin="x.x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
calendar versioning {{ pin_subpackage("myrecipe", max_pin=None) }}

while replacing "myrecipe" with either name if a name|lower variable is defined in your recipe or with the lowercase name of the package in quotes.

Bot commands for PR management

Please use the following BiocondaBot commands:

Everyone has access to the following BiocondaBot commands, which can be given in a comment:

@BiocondaBot please update Merge the master branch into a PR.
@BiocondaBot please add label Add the please review & merge label.
@BiocondaBot please fetch artifacts Post links to CI-built packages/containers.
You can use this to test packages locally.

Note that the @BiocondaBot please merge command is now depreciated. Please just squash and merge instead.

Also, the bot watches for comments from non-members that include @bioconda/<team> and will automatically re-post them to notify the addressed <team>.

Summary by CodeRabbit

  • New Features

    • Introduced the hmftools-redux package, enabling streamlined installation and execution of the Redux tool for post-processing read alignments.
    • Added a new shell script (redux.sh) to facilitate running the Java application.
    • Implemented an automated build script (build.sh) for easier setup and execution.
  • Documentation

    • Added a configuration file (meta.yaml) detailing package version, dependencies, and metadata for the hmftools-redux package.

Copy link
Contributor

coderabbitai bot commented Oct 4, 2024

📝 Walkthrough

Walkthrough

This pull request introduces the hmftools-redux package, including a build.sh script to automate the installation process, a meta.yaml file for package configuration, and a redux.sh script to execute the Java application. The build.sh script manages directory creation, file movement, and symbolic linking for easy command-line access. The meta.yaml file specifies the package version, checksum, source URL, runtime dependencies, and metadata. The redux.sh script is designed to run the redux.jar file, handling Java execution and command-line arguments.

Changes

File Path Change Summary
recipes/hmftools-redux/build.sh New script added to automate installation, manage directories, move JAR files, and create links.
recipes/hmftools-redux/meta.yaml New file added with package configuration, version, SHA256 checksum, source URL, dependencies, and metadata.
recipes/hmftools-redux/redux.sh New script added to execute the redux.jar file with Java, handling arguments and memory options.

Possibly related PRs

  • Update hmftools-bam-tools to 1.3_beta #51142: This PR updates the hmftools-bam-tools package, which is part of the hmftools suite, similar to the hmftools-redux package in the main PR. Both PRs involve modifications to the meta.yaml file for packages under the hmftools umbrella.

Suggested labels

please review & merge


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

@scwatts
Copy link
Contributor Author

scwatts commented Oct 4, 2024

@BiocondaBot please fetch artifacts

@BiocondaBot
Copy link
Collaborator

Package(s) built are ready for inspection:

Arch Package Zip File / Repodata CI Instructions
noarch hmftools-redux-1.0_beta-hdfd78af_0.tar.bz2 LinuxArtifacts.zip Azure
showYou may also use conda to install after downloading and extracting the zip file. From the LinuxArtifacts directory: conda install -c ./packages <package name>

Docker image(s) built:

Package Tag CI Install with docker
hmftools-redux 1.0_beta--hdfd78af_0 Azure
showImages for Azure are in the LinuxArtifacts zip file above.gzip -dc LinuxArtifacts/images/hmftools-redux:1.0_beta--hdfd78af_0.tar.gz | docker load

@scwatts scwatts marked this pull request as ready for review October 4, 2024 04:26
@scwatts
Copy link
Contributor Author

scwatts commented Oct 4, 2024

@BiocondaBot please add label

@BiocondaBot BiocondaBot added the please review & merge set to ask for merge label Oct 4, 2024
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: 5

🧹 Outside diff range and nitpick comments (7)
recipes/hmftools-redux/build.sh (3)

1-5: LGTM! Consider adding error handling for directory creation.

The initial setup looks good. The use of environment variables and directory checks are consistent with Bioconda practices.

For improved robustness, consider adding error handling for directory creation:

-[ -d "$TGT" ] || mkdir -p "$TGT"
-[ -d "${PREFIX}/bin" ] || mkdir -p "${PREFIX}/bin"
+[ -d "$TGT" ] || mkdir -p "$TGT" || { echo "Failed to create $TGT"; exit 1; }
+[ -d "${PREFIX}/bin" ] || mkdir -p "${PREFIX}/bin" || { echo "Failed to create ${PREFIX}/bin"; exit 1; }

12-12: LGTM! Consider adding error handling for chmod.

The chmod command is correct and necessary to ensure the script is executable.

For completeness, consider adding error handling:

-chmod 0755 "${PREFIX}/bin/redux"
+chmod 0755 "${PREFIX}/bin/redux" || { echo "Failed to set permissions for ${PREFIX}/bin/redux"; exit 1; }

1-12: Overall assessment: Good structure, needs improved error handling.

The build script for hmftools-redux is well-structured and follows Bioconda practices. However, it would benefit from improved error handling and robustness in several areas:

  1. Directory creation
  2. Changing directories
  3. File operations (moving, copying)
  4. Symbolic link creation
  5. Permission setting

Implementing the suggested changes will make the script more resilient to potential issues during the build process.

Consider creating helper functions for common operations (e.g., safe_mkdir, safe_copy) to improve code readability and maintainability.

🧰 Tools
🪛 Shellcheck

[warning] 7-7: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

recipes/hmftools-redux/meta.yaml (2)

12-16: LGTM with a suggestion: Consider adjusting the run_exports directive.

The build configuration is correct, with noarch: generic appropriate for a Java JAR file and the build number set to 0 for a new package. However, the run_exports directive might be too restrictive for a beta version.

Consider modifying the run_exports directive to allow for more flexibility in beta versions:

run_exports:
  - {{ pin_subpackage('hmftools-redux', max_pin="x") }}

This change allows for minor version updates without breaking dependencies, which is more suitable for beta releases.


18-25: LGTM with a suggestion: Consider improving the test command.

The runtime requirements and test command are generally correct. However, the test command could be more specific to ensure the correct version is installed.

Consider modifying the test command to check for the exact version:

test:
  commands:
    - 'redux -version | grep -q "Redux version {{ version }}"'

This change ensures that the installed version matches the expected version, providing a more robust test.

recipes/hmftools-redux/redux.sh (2)

1-7: Consider using a more specific locale setting.

The script sets LC_ALL=en_US.UTF-8, which might be too broad. Consider using LANG or LC_CTYPE instead, as they are more specific and less likely to interfere with other locale-dependent operations.

You could replace line 6 with:

-export LC_ALL=en_US.UTF-8
+export LANG=en_US.UTF-8

or

-export LC_ALL=en_US.UTF-8
+export LC_CTYPE=en_US.UTF-8

69-69: Remove unnecessary exit command.

The explicit exit at the end of the script is redundant as the script would naturally terminate at this point.

You can safely remove this line:

-exit
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e9865fd and 6a99f0c.

📒 Files selected for processing (3)
  • recipes/hmftools-redux/build.sh (1 hunks)
  • recipes/hmftools-redux/meta.yaml (1 hunks)
  • recipes/hmftools-redux/redux.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/hmftools-redux/build.sh

[warning] 7-7: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

recipes/hmftools-redux/redux.sh

[warning] 19-19: Quote this to prevent word splitting.

(SC2046)


[warning] 62-62: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.

(SC2206)

🪛 yamllint
recipes/hmftools-redux/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (7)
recipes/hmftools-redux/meta.yaml (5)

1-2: LGTM: Version and SHA256 hash are correctly defined.

The version and SHA256 hash are properly set using Jinja2 variables. The version "1.0_beta" correctly indicates a pre-release version, and the SHA256 hash is provided for package integrity verification.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


4-6: LGTM: Package name and version are correctly defined.

The package name "hmftools-redux" follows the convention of using lowercase and hyphens. The version is correctly referenced using the Jinja2 variable, ensuring consistency with the earlier definition.


8-10: LGTM: Source URL and SHA256 hash are correctly defined.

The source URL correctly points to a GitHub release JAR file, using Jinja2 variables for easy version updates. The SHA256 hash is properly referenced using the Jinja2 variable, ensuring integrity verification.


27-31: LGTM: About section is correctly defined.

The about section provides all necessary metadata, including the correct home URL, license information (GPL-3.0-only), and a concise summary of the tool's functionality.


1-2: Note: Ignore the yamllint syntax error for Jinja2 templates.

The yamllint tool reported a syntax error for the '%' character at the beginning of the file. This is a false positive, as the '%' character is part of the Jinja2 template syntax, which is valid and commonly used in Conda recipes. The YAML is processed correctly by the Conda build system, which interprets the Jinja2 templates.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

recipes/hmftools-redux/redux.sh (2)

8-16: LGTM: Robust script directory resolution.

The script correctly resolves its own directory, handling potential symlinks. This implementation is a well-established method for determining the script's location.


1-69: LGTM: Well-structured script with good functionality.

The overall structure and functionality of the script are sound. It effectively handles various scenarios for Java execution and argument processing. The minor issues identified in previous comments do not significantly impact the script's core functionality.

🧰 Tools
🪛 Shellcheck

[warning] 19-19: Quote this to prevent word splitting.

(SC2046)


[warning] 62-62: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.

(SC2206)

recipes/hmftools-redux/build.sh Show resolved Hide resolved
recipes/hmftools-redux/build.sh Show resolved Hide resolved
Comment on lines +18 to +28
JAR_DIR=$DIR
ENV_PREFIX="$(dirname $(dirname $DIR))"
# Use Java installed with Anaconda to ensure correct version
java="$ENV_PREFIX/bin/java"

# if JAVA_HOME is set (non-empty), use it. Otherwise keep "java"
if [ -n "${JAVA_HOME:=}" ]; then
if [ -e "$JAVA_HOME/bin/java" ]; then
java="$JAVA_HOME/bin/java"
fi
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix potential issue with ENV_PREFIX determination.

The current method of determining ENV_PREFIX assumes a specific directory structure, which may not always hold true. This could lead to incorrect Java executable selection.

Consider using a more robust method to determine the Anaconda environment prefix. Here's a suggested fix:

-ENV_PREFIX="$(dirname $(dirname $DIR))"
+ENV_PREFIX="${CONDA_PREFIX:-$(dirname $(dirname $DIR))}"

This change uses the CONDA_PREFIX environment variable if it's set (which it should be in an active Conda environment), falling back to the current method if it's not.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
JAR_DIR=$DIR
ENV_PREFIX="$(dirname $(dirname $DIR))"
# Use Java installed with Anaconda to ensure correct version
java="$ENV_PREFIX/bin/java"
# if JAVA_HOME is set (non-empty), use it. Otherwise keep "java"
if [ -n "${JAVA_HOME:=}" ]; then
if [ -e "$JAVA_HOME/bin/java" ]; then
java="$JAVA_HOME/bin/java"
fi
fi
JAR_DIR=$DIR
ENV_PREFIX="${CONDA_PREFIX:-$(dirname $(dirname $DIR))}"
# Use Java installed with Anaconda to ensure correct version
java="$ENV_PREFIX/bin/java"
# if JAVA_HOME is set (non-empty), use it. Otherwise keep "java"
if [ -n "${JAVA_HOME:=}" ]; then
if [ -e "$JAVA_HOME/bin/java" ]; then
java="$JAVA_HOME/bin/java"
fi
fi
🧰 Tools
🪛 Shellcheck

[warning] 19-19: Quote this to prevent word splitting.

(SC2046)

Comment on lines +63 to +68
if [[ ${pass_arr[0]:=} == com.hartwig.* ]]
then
eval "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/redux.jar" $pass_args
else
eval "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/redux.jar" $pass_args
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider alternatives to eval for improved security.

The use of eval to execute the Java command could be potentially dangerous if pass_args contains uncontrolled user input.

Consider using array expansion instead of eval. Here's a suggested alternative:

 if [[ ${pass_arr[0]:=} == com.hartwig.* ]]
 then
-    eval "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/redux.jar" $pass_args
+    "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/redux.jar" "${pass_arr[@]}"
 else
-    eval "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/redux.jar" $pass_args
+    "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/redux.jar" "${pass_arr[@]}"
 fi

This change uses array expansion to pass arguments, which is safer than using eval.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ ${pass_arr[0]:=} == com.hartwig.* ]]
then
eval "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/redux.jar" $pass_args
else
eval "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/redux.jar" $pass_args
fi
if [[ ${pass_arr[0]:=} == com.hartwig.* ]]
then
"$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/redux.jar" "${pass_arr[@]}"
else
"$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/redux.jar" "${pass_arr[@]}"
fi

Comment on lines +30 to +62
# extract memory and system property Java arguments from the list of provided arguments
# http://java.dzone.com/articles/better-java-shell-script
default_jvm_mem_opts="-Xms512m -Xmx1g"
jvm_mem_opts=""
jvm_prop_opts=""
pass_args=""
for arg in "$@"; do
case $arg in
'-D'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-XX'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-Xm'*)
jvm_mem_opts="$jvm_mem_opts $arg"
;;
*)
if [[ ${pass_args} == '' ]] #needed to avoid preceeding space on first arg e.g. ' MarkDuplicates'
then
pass_args="$arg"
else
pass_args="$pass_args \"$arg\"" #quotes later arguments to avoid problem with ()s in MarkDuplicates regex arg
fi
;;
esac
done

if [ "$jvm_mem_opts" == "" ]; then
jvm_mem_opts="$default_jvm_mem_opts"
fi

pass_arr=($pass_args)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix potential word splitting issue in argument processing.

The current method of splitting pass_args into an array on line 62 could lead to unexpected behavior if arguments contain spaces.

Consider using a more robust method to split the arguments. Here's a suggested fix:

-pass_arr=($pass_args)
+IFS=' ' read -r -a pass_arr <<< "$pass_args"

This change uses read with IFS set to space to properly split the arguments into an array, preserving spaces within individual arguments.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# extract memory and system property Java arguments from the list of provided arguments
# http://java.dzone.com/articles/better-java-shell-script
default_jvm_mem_opts="-Xms512m -Xmx1g"
jvm_mem_opts=""
jvm_prop_opts=""
pass_args=""
for arg in "$@"; do
case $arg in
'-D'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-XX'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-Xm'*)
jvm_mem_opts="$jvm_mem_opts $arg"
;;
*)
if [[ ${pass_args} == '' ]] #needed to avoid preceeding space on first arg e.g. ' MarkDuplicates'
then
pass_args="$arg"
else
pass_args="$pass_args \"$arg\"" #quotes later arguments to avoid problem with ()s in MarkDuplicates regex arg
fi
;;
esac
done
if [ "$jvm_mem_opts" == "" ]; then
jvm_mem_opts="$default_jvm_mem_opts"
fi
pass_arr=($pass_args)
# extract memory and system property Java arguments from the list of provided arguments
# http://java.dzone.com/articles/better-java-shell-script
default_jvm_mem_opts="-Xms512m -Xmx1g"
jvm_mem_opts=""
jvm_prop_opts=""
pass_args=""
for arg in "$@"; do
case $arg in
'-D'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-XX'*)
jvm_prop_opts="$jvm_prop_opts $arg"
;;
'-Xm'*)
jvm_mem_opts="$jvm_mem_opts $arg"
;;
*)
if [[ ${pass_args} == '' ]] #needed to avoid preceeding space on first arg e.g. ' MarkDuplicates'
then
pass_args="$arg"
else
pass_args="$pass_args \"$arg\"" #quotes later arguments to avoid problem with ()s in MarkDuplicates regex arg
fi
;;
esac
done
if [ "$jvm_mem_opts" == "" ]; then
jvm_mem_opts="$default_jvm_mem_opts"
fi
IFS=' ' read -r -a pass_arr <<< "$pass_args"
🧰 Tools
🪛 Shellcheck

[warning] 62-62: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a.

(SC2206)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please review & merge set to ask for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants