-
Notifications
You must be signed in to change notification settings - Fork 2
/
qiimeInstall.sh
46 lines (37 loc) · 1.74 KB
/
qiimeInstall.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
#!/bin/bash
set -e
#Install Miniconda
if [[ ! -f "Miniconda3-latest-Linux-x86_64.sh" ]]; then
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
fi
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
source ~/miniconda/etc/profile.d/conda.sh
conda init
# Set $PATH for this session, allowing bash to find conda
PATH="/home/chris/miniconda3/bin:/home/chris/miniconda3/condabin:/usr/local/bin:/usr/bin:/bin"
# install conda tooling for building and uploading packages
conda install conda-build -y
conda install anaconda-client -y
#Install latest q2 environment
Q2LATEST=$(curl --silent "https://api.github.com/repos/qiime2/qiime2/tags" | jq -r '.[0].name')
Q2PREV=$(curl --silent "https://api.github.com/repos/qiime2/qiime2/tags" | jq -r '.[1].name')
# logical or required to prevent script termination if no value found (grep returns 1)
ISDEV=$(echo $Q2LATEST | grep -o 'dev' || [[ $? == 1 ]])
# if latest version is a dev version, use the prior tag. Else, it is a patch and we should use that
if [[ $ISDEV == "dev" ]]; then
Q2LATEST=$Q2PREV
fi
# Strip patch numbers for download
Q2LATEST=$(echo $Q2LATEST | grep -oP '20[12][0-9]\.[0-9]+')
Q2SHORT=$(echo "$Q2LATEST" | grep -oP '[12][0-9]\.[0-9]+')
Q2URL="https://data.qiime2.org/distro/core/qiime2-${Q2LATEST}-py36-linux-conda.yml"
conda update conda -y
wget $Q2URL
conda env create -n "q2-${Q2SHORT}" --file "qiime2-${Q2LATEST}-py36-linux-conda.yml"
#Install dev environment
wget https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py36-linux-conda.yml
conda env create -n q2-dev --file qiime2-latest-py36-linux-conda.yml
#cleanup
rm "qiime2-${Q2LATEST}-py36-linux-conda.yml"
rm qiime2-latest-py36-linux-conda.yml
rm Miniconda3-latest-*