-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatk_install.sh
executable file
·86 lines (66 loc) · 2.15 KB
/
gatk_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# script: gatk_install.sh
# Aim: install gatk from a selected github release
#
# Stéphane Plaisance - VIB-Nucleomics Core - 2018-08-01 v1.0
# now finds the latest release automatically 2020-05-04 v1.1
#
# visit our Git: https://github.com/Nucleomics-VIB
######################################
## get destination folder from user ##
function latest_git_release() {
# argument is a quoted string like "broadinstitute/gatk"
ID=${GITHUB_ID}
TOKEN=${GITHUB_TOKEN}
curl --silent -u ${GITHUB_ID}:${GITHUB_TOKEN} "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
mybuild=$(latest_git_release "broadinstitute/gatk")
echo "# Installing the current GATK release : "${mybuild}
echo -n "[ENTER] for '/opt/biotools' or provide a different path: "
read mypath
biotools=${mypath:-"/opt/biotools"}
# test if exists and abort
if [ ! -d "${biotools}" ]; then
echo "# This path was not found, check it and restart this script."
exit 0
fi
# get the zip and decompress it
cd ${biotools}
# check if already there and delete
if [ -f "gatk-${mybuild}.zip" ]; then
rm "gatk-${mybuild}.zip"
fi
if [ -d "gatk-${mybuild}" ]; then
rm -rf "gatk-${mybuild}"
fi
# get fresh
wget https://github.com/broadinstitute/gatk/releases/download/${mybuild}/gatk-${mybuild}.zip && \
unzip gatk-${mybuild}.zip &&
rm gatk-${mybuild}.zip
# test for success
if [ $? -ne 0 ] ; then
echo "# The archive was not found online or could not be decompressed"
fi
######################################
# create new link
gatklnk="gatk"
if [ -L "${gatklnk}" ]; then
unlink ${gatklnk}
fi
ln -s gatk-${mybuild} ${gatklnk}
# test for success
if [ $? -ne 0 ] ; then
echo "# The link to the new build folder could not be created"
fi
# create link in the build folder
cd gatk && \
ln -s "gatk-package-${mybuild}-local.jar" gatk.jar
# test for success
if [ $? -ne 0 ] ; then
echo "# The link to the new jar file could not be created"
fi
cd ../
# print version
echo
echo "# if all went right, you should see the new GATK version below"
java -jar gatk/gatk.jar HaplotypeCaller --version