-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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-chord 2.1.0_beta #51149
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
TGT="$PREFIX/share/$PKG_NAME-$PKG_VERSION-$PKG_BUILDNUM" | ||
[ -d "$TGT" ] || mkdir -p $TGT | ||
[ -d "${PREFIX}/bin" ] || mkdir -p "${PREFIX}/bin" | ||
|
||
cd "${SRC_DIR}" | ||
mv jar/chord*.jar $TGT/chord.jar | ||
${R} CMD INSTALL --build src/chord/src/main/R/mutSigExtractor | ||
${R} CMD INSTALL --build src/chord/src/main/R/CHORD | ||
|
||
cp $RECIPE_DIR/chord.sh $TGT/chord | ||
ln -s $TGT/chord ${PREFIX}/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
# hmftools CHORD executable shell script | ||
# https://github.com/hartwigmedical/hmftools/tree/master/chord | ||
set -eu -o pipefail | ||
|
||
export LC_ALL=en_US.UTF-8 | ||
|
||
# Find original directory of bash script, resolving symlinks | ||
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128 | ||
SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
SOURCE="$(readlink "$SOURCE")" | ||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | ||
done | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
|
||
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 | ||
|
||
# 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) | ||
if [[ ${pass_arr[0]:=} == com.hartwig.* ]] | ||
then | ||
eval "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/chord.jar" $pass_args | ||
else | ||
eval "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/chord.jar" $pass_args | ||
fi | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% set version = "2.1.0_beta" %} | ||
{% set sha256_jar = "26d0a40e20635c4b797d28e0c7819b1653c9f8fa28180b9a556215d22387968c" %} | ||
{% set sha256_src = "ed039e7b405130a1e52df71c3535c6a5ed8aab0f80724bc83df88ae14aeaa257" %} | ||
|
||
package: | ||
name: hmftools-chord | ||
version: '{{ version }}' | ||
|
||
source: | ||
- folder: jar | ||
url: https://github.com/hartwigmedical/hmftools/releases/download/chord-v{{ version }}/chord-{{ version }}.jar | ||
sha256: '{{ sha256_jar }}' | ||
- folder: src | ||
url: https://github.com/hartwigmedical/hmftools/archive/refs/tags/chord-v{{ version }}.tar.gz | ||
sha256: '{{ sha256_src }}' | ||
|
||
build: | ||
noarch: generic | ||
number: 0 | ||
run_exports: | ||
- {{ pin_subpackage("hmftools-chord", max_pin="x.x") }} | ||
|
||
requirements: | ||
host: | ||
- r-base | ||
- r-randomforest | ||
- r-stringr | ||
- bioconductor-bsgenome | ||
- bioconductor-bsgenome.hsapiens.ucsc.hg19 | ||
- bioconductor-bsgenome.hsapiens.ucsc.hg38 | ||
run: | ||
- openjdk >=8 | ||
- r-base | ||
- r-randomforest | ||
- r-stringr | ||
- bioconductor-bsgenome | ||
- bioconductor-bsgenome.hsapiens.ucsc.hg19 | ||
- bioconductor-bsgenome.hsapiens.ucsc.hg38 | ||
|
||
test: | ||
commands: | ||
- $R -e "library('CHORD')" | ||
- $R -e "library('mutSigExtractor')" | ||
- 'chord com.hartwig.hmftools.chord.ChordRunner -version | grep CHORD' | ||
|
||
about: | ||
home: https://github.com/hartwigmedical/hmftools/blob/master/chord/ | ||
license: GPL-3.0-only | ||
scwatts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
license_family: GPL3 | ||
summary: Predict HRD using somatic mutations contexts |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve command execution for better security and robustness
While the logic for determining how to execute the Java command is sound, there are some security and robustness concerns in this section.
The use of
eval
can be dangerous if the inputs are not properly sanitized. Consider removingeval
and using arrays for argument handling.The word splitting warning on line 62 should be addressed.
Here's a suggested refactor to address these issues:
This refactored version:
eval
, improving security.pass_args
array using"${pass_args[@]}"
.These changes make the script more secure and robust against potential injection attacks or unexpected behavior with special characters in arguments.
📝 Committable suggestion
🧰 Tools
🪛 Shellcheck