Skip to content

Commit

Permalink
Add recipe for hmftools-peach 2.0.0 (#51150)
Browse files Browse the repository at this point in the history
  • Loading branch information
scwatts authored Oct 4, 2024
1 parent 91b1559 commit d645462
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
12 changes: 12 additions & 0 deletions recipes/hmftools-peach/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/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 peach*.jar $TGT/peach.jar

cp $RECIPE_DIR/peach.sh $TGT/peach
ln -s $TGT/peach $PREFIX/bin
chmod 0755 "${PREFIX}/bin/peach"
30 changes: 30 additions & 0 deletions recipes/hmftools-peach/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% set version = "2.0.0" %}
{% set sha256 = "52ffd5dc9bd6018adc5854cbe10cdb2cc364e99099af2f9c8dbc7fdd80fab83e" %}

package:
name: hmftools-peach
version: '{{ version }}'

source:
url: https://github.com/hartwigmedical/hmftools/releases/download/peach-v{{ version }}/peach_v{{ version }}.jar
sha256: '{{ sha256 }}'

build:
noarch: generic
number: 0
run_exports:
- {{ pin_subpackage("hmftools-peach", max_pin="x.x") }}

requirements:
run:
- openjdk >=8

test:
commands:
- 'peach -version | grep Peach'

about:
home: https://github.com/hartwigmedical/hmftools/blob/master/peach/README.md
license: GPL-3.0-only
license_family: GPL3
summary: Infer haplotypes for interpretation in a pharmacogenomic context
69 changes: 69 additions & 0 deletions recipes/hmftools-peach/peach.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
# hmftools PEACH executable shell script
# https://github.com/hartwigmedical/hmftools/tree/master/peach
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]:=} == org* ]]
then
eval "$java" $jvm_mem_opts $jvm_prop_opts -cp "$JAR_DIR/peach.jar" $pass_args
else
eval "$java" $jvm_mem_opts $jvm_prop_opts -jar "$JAR_DIR/peach.jar" $pass_args
fi
exit

0 comments on commit d645462

Please sign in to comment.