-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_spear
More file actions
executable file
·108 lines (95 loc) · 4.31 KB
/
Copy pathinstall_spear
File metadata and controls
executable file
·108 lines (95 loc) · 4.31 KB
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
107
108
#!/usr/bin/env bash
set -eu
# Matt Bashton 2021
# Install required dependencies for SPEAR
tput bold
echo "SPEAR install script"
tput sgr0
# Detect if we have working conda
if ! command -v conda &> /dev/null
then
echo "Conda could not be found, please install via https://docs.conda.io/en/latest/miniconda.html"
exit 1
fi
# Install env
echo " - Setting up conda env"
CONDA_PATH=$(conda list -n base | awk 'NR == 1' | grep -oP '/\S+[^:]')
source ${CONDA_PATH}/etc/profile.d/conda.sh
conda config --set channel_priority strict
conda env create -q --yes -f environment.yml
conda activate spear
# Download SnpEff and SnpSift
echo " - Downloading dependencies"
wget -q https://snpeff.odsp.astrazeneca.com/versions/snpEff_latest_core.zip -O ${CONDA_PREFIX}/snpEff_latest_core.zip
unzip -q -o ${CONDA_PREFIX}/snpEff_latest_core.zip -d ${CONDA_PREFIX}
rm ${CONDA_PREFIX}/snpEff_latest_core.zip
mkdir -p ${CONDA_PREFIX}/snpEff/data
unzip -q -o data/NC_045512.2.zip -d ${CONDA_PREFIX}/snpEff/data
# Detect OS
if [[ ${OSTYPE} == "darwin"* ]]; then
OS="macOS"
elif [[ ${OSTYPE} == "linux"* ]]; then
OS="linux"
else
echo "Unsupported OS: ${OSTYPE}"
exit 1
fi
# OS Dependent download
if [[ ${OS} = "linux" ]]; then
wget -q http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/faToVcf -O ${CONDA_PREFIX}/bin/faToVcf
chmod +x ${CONDA_PREFIX}/bin/faToVcf
wget -q https://github.com/brentp/vcfanno/releases/download/v0.3.3/vcfanno_linux64 -O ${CONDA_PREFIX}/bin/vcfanno
chmod +x ${CONDA_PREFIX}/bin/vcfanno
elif [[ ${OS} = "macOS" ]]; then
wget -q http://hgdownload.cse.ucsc.edu/admin/exe/macOSX.x86_64/faToVcf -O ${CONDA_PREFIX}/bin/faToVcf
chmod +x ${CONDA_PREFIX}/bin/faToVcf
wget -q https://github.com/brentp/vcfanno/releases/download/v0.3.3/vcfanno_osx -O ${CONDA_PREFIX}/bin/vcfanno
chmod +x ${CONDA_PREFIX}/bin/vcfanno
fi
# Download data from GitHub
mkdir -p ${CONDA_PREFIX}/data
mkdir -p ${CONDA_PREFIX}/data/ProblematicSites_SARS-CoV2
wget -q https://github.com/W-L/ProblematicSites_SARS-CoV2/raw/a36cee5dc5ce8fabcfd23f73b690874c739c2928/compressed_vcf/problematic_sites_sarsCov2.v8.vcf.gz -O ${CONDA_PREFIX}/data/problematic_sites_sarsCov2.vcf.gz
wget -q https://github.com/W-L/ProblematicSites_SARS-CoV2/raw/a36cee5dc5ce8fabcfd23f73b690874c739c2928/compressed_vcf/problematic_sites_sarsCov2.v8.vcf.gz.tbi -O ${CONDA_PREFIX}/data/problematic_sites_sarsCov2.vcf.gz.tbi
wget -q https://raw.githubusercontent.com/jbloomlab/SARS2_RBD_Ab_escape_maps/main/processed_data/escape_calculator_data.csv -O ${CONDA_PREFIX}/data/escape_calculator_data.csv
wget -q https://raw.githubusercontent.com/jbloomlab/SARS2_RBD_Ab_escape_maps/main/bindingcalculator.py -O ${CONDA_PREFIX}/bin/bindingcalculator.py
# Install SPEAR files
echo " - Installing SPEAR"
cp -r data/* ${CONDA_PREFIX}/data
chmod +x scripts/*.sh
chmod +x scripts/*.py
cp scripts/* ${CONDA_PREFIX}/bin
chmod +x spear
cp spear ${CONDA_PREFIX}/bin
mkdir -p ${CONDA_PREFIX}/images
cp images/* ${CONDA_PREFIX}/images
# Clone SPEAR to conda env
git clone --quiet https://github.com/m-crown/SPEAR.git ${CONDA_PREFIX}/repo
# Test snpEff is working
java -Xmx1g -jar $CONDA_PREFIX/snpEff/snpEff.jar -hgvs1LetterAa -nodownload -no SPLICE_SITE_ACCEPTOR -no SPLICE_SITE_DONOR -no SPLICE_SITE_REGION -no SPLICE_SITE_BRANCH -no SPLICE_SITE_BRANCH_U12 -noLog -noLof -no-intron -noMotif -noStats -no-downstream -no-upstream -no-utr NC_045512.2 $CONDA_PREFIX/data/install_vcf.vcf > /dev/null
# Deactivate env
conda deactivate
# Optional Pangolin install
while true; do
read -p "Do you wish to install Pangolin? (skip if you already have a working Pangolin env)" yn
case ${yn} in
[Yy]* ) echo " - Installing latest Pangolin"
mkdir -p latest_pangolin; wget -qO- https://api.github.com/repos/cov-lineages/pangolin/releases | grep "tarball_url" | grep -Eo 'https://[^\"]*' | sed -n '1p' | xargs wget -qO- | tar -xz --strip-components=1 -C latest_pangolin
cd latest_pangolin
conda env create -q --yes -f environment.yml
conda activate pangolin
pip -q install .
cd ..
conda deactivate
echo -ne "\n\n"
break;;
[Nn]* ) echo " - Skipping Pangolin installation"
echo -ne "\n\n"
break;;
* ) echo "Please answer yes or no.";;
esac
done
# Finish up
echo "To use SPEAR activate the conda enviroment like so:"
echo "conda activate spear"
echo "then run: spear - and follow command line help"