/
Build.sh
executable file
·73 lines (59 loc) · 2.38 KB
/
Build.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
#!/usr/bin/env bash
## Initialization script for setting up directory structure, downloading
## HMMER if necessary, and configuring system architecture for use with
## Meta-MARC.
shopt -s extglob
#############
## Methods ##
#############
config_metamarc() {
local OS=${2}
local ARCH=${3}
local RELPATH=${1}
local HMMER="n"
echo -n "Download HMMER binaries to the meta-marc directory? (yes/no) [no]: "
read HMMER
if [ "$HMMER" == "yes" ]; then
if [ "$OS" == "Darwin" ]; then
wget -P "$RELPATH" http://eddylab.org/software/hmmer3/3.1b2/hmmer-3.1b2-macosx-intel.tar.gz
tar -xzvf "${RELPATH}/hmmer-3.1b2-macosx-intel.tar.gz" -C "${RELPATH}"
mv "${RELPATH}/hmmer-3.1b2-macosx-intel" "${RELPATH}/hmmer-3.1b2"
rm "${RELPATH}/hmmer-3.1b2-macosx-intel.tar.gz"
elif [ "$OS" == "Linux" ] && [ "$ARCH" == "64" ]; then
wget -P "$RELPATH" http://eddylab.org/software/hmmer3/3.1b2/hmmer-3.1b2-linux-intel-x86_64.tar.gz
tar -xzvf "${RELPATH}/hmmer-3.1b2-linux-intel-x86_64.tar.gz" -C "${RELPATH}"
mv "${RELPATH}/hmmer-3.1b2-linux-intel-x86_64" "${RELPATH}/hmmer-3.1b2"
rm "${RELPATH}/hmmer-3.1b2-linux-intel-x86_64.tar.gz"
elif [ "$OS" == "Linux" ] && [ "$ARCH" == "32" ]; then
wget -P "$RELPATH" http://eddylab.org/software/hmmer3/3.1b2/hmmer-3.1b2-linux-intel-ia32.tar.gz
tar -xzvf "${RELPATH}/hmmer-3.1b2-linux-intel-ia32.tar.gz" -C "${RELPATH}"
mv "${RELPATH}/hmmer-3.1b2-linux-intel-ia32" "${RELPATH}/hmmer-3.1b2"
rm "${RELPATH}/hmmer-3.1b2-linux-intel-ia32.tar.gz"
fi
cd bin
ln -s ../hmmer-3.1b2/binaries/* .
cd ..
fi
}
##########
## Main ##
##########
OS=""
ARCH=""
RELPATH="${BASH_SOURCE%/*}"
chmod +x ${RELPATH}/bin/*
if [ "$( uname )" == "Darwin" ]; then
OS="Darwin"
elif [ "$( expr substr $( uname -s ) 1 5 )" == "Linux" ] && [ $( uname -a | grep -o -m 1 "x86_64" | head -1 ) == "x86_64" ]; then
OS="Linux"
ARCH="64"
elif [ "$( expr substr $( uname -s ) 1 5 )" == "Linux" ] && [ $( uname -a | grep -o -m 1 "i386" | head -1 ) == "i386" ]; then
OS="Linux"
ARCH="32"
else
echo -e "\nError: Not a valid system architecture for Meta-MARC. Linux 32/64-bit or Mac OS required."
exit 1
fi
config_metamarc ${RELPATH} ${OS} ${ARCH}
gunzip ${RELPATH}/src/HMMs/*
exit 0