forked from garcia-nacho/TOP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall.sh
executable file
·106 lines (93 loc) · 2.24 KB
/
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
SHORT=k:,t:,c:,h:,p:
LONG=kraken:,tbdb:,cores:,help:,path:
OPTS=$(getopt --options $SHORT --longoptions $LONG -- "$@")
eval set -- "$OPTS"
while :
do
case "$1" in
-c | --cores )
cores="$2"
shift 2
;;
-t | --tbdb )
tbdb="$2"
shift 2
;;
-k | --kraken )
kraken="$2"
shift 2
;;
-p | --path )
binpath="$2"
shift 2
;;
-h | --help)
echo "This is a TOP installation script"
echo "use -c or --cores to set the number of cores"
echo "use -t or --tbdb to set the path to the tb_database"
echo "use -k or --kraken to set the path to the tb_database"
echo "use -p or --path to set the path to install the main script"
exit 2
;;
--)
shift;
break
;;
*)
echo "Unexpected option: $1"
;;
esac
done
#Cores
if [ -z ${cores+x} ]
then
${cores}=10
fi
echo "Number of cores assigned to TOP: " ${cores}
echo ""
#TBDB
if [ -z ${tbdb+x} ]
then
mkdir $(pwd)/TBDB
${tbdb}=$(pwd)/TBDB
fi
echo "Using TBDB located in "${tbdb}
echo ""
conda create -n top_nf -y
source activate top_nf
conda install -c bioconda nextflow
cp TOP.nf ${CONDA_PREFIX}/bin/TOP.nf
cp nextflow.config ${CONDA_PREFIX}/bin/
cp top_template.html ${CONDA_PREFIX}/top_template.html
conda deactivate
if [ -z ${kraken+x} ]
then
echo "No Kraken database set... Downloading it into"$(pwd)/krakenDB
echo ""
wget -O krakenDB.tar.gz https://genome-idx.s3.amazonaws.com/kraken/k2_standard_08gb_20221209.tar.gz
mkdir krakenDB
echo "Unpacking Kraken database"
echo ""
tar -xvzf krakenDB.tar.gz -C krakenDB
kraken=$(pwd)/krakenDB
fi
echo "Using krakenDB located in "${kraken}
echo ""
source activate top_nf
conda env config vars set KRAKENDB=${kraken}
conda env config vars set TBDB=${tbdb}
conda env config vars set TEMPDB=${CONDA_PREFIX}/top_temp
conda env config vars set TOPCORES=${cores}
conda env config vars set SPADESCORES=$((${cores}-2))
if [ -z ${binpath+x} ]
then
cp TOP.sh ${CONDA_PREFIX}/bin/TOP.sh
ln -s ${CONDA_PREFIX}/bin/TOP.sh ${binpath}/TOP.sh
conda env config vars set TOPSHPATH=${binpath}
else
mv TOP.sh ${CONDA_PREFIX}/bin/TOP.sh
ln -s ${CONDA_PREFIX}/bin/TOP.sh $(pwd)/TOP.sh
conda env config vars set TOPSHPATH=$(pwd)
fi
conda deactivate