-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_Setup.sh
128 lines (96 loc) · 3.64 KB
/
00_Setup.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#! /bin/bash
#
# /!\ To launch in the terminal with bash
# varSettings.sh needs to be in the same folder
source ./varSettings.sh
work_DIR=$(pwd)
echo "work_DIR="${work_DIR} >> varSettings.sh
mkdir output
##Input Guppy's latest VERSION:
read -p 'Input Guppy version (ie: 5.0.11), check it here: community.nanoporetech.com/downloads/guppy/release_notes :' GUPPY_VERSION
if [[ ! $GUPPY_VERSION =~ ^[0-9,.]*$ ]]
then
echo "Invalid version number"
exit
else
echo "Guppy "${GUPPY_VERSION}" will be downloaded"
fi
##Create software directory
SOFTWARE_DIR=${work_DIR}/software
mkdir -p ${SOFTWARE_DIR}
cd $SOFTWARE_DIR
echo "Installing software in " ${SOFTWARE_DIR}
echo "SOFTWARE_DIR="${SOFTWARE_DIR} >> ../varSettings.sh
#Install conda (or not if already installed)
#Dealing with miniconda vs anaconda installations
CONDA_PACKAGE=`which conda`
if [ ! ${CONDA_PACKAGE} ];
then
echo "Installing miniconda in" ${SOFTWARE_DIR};
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
source ./Miniconda3-latest-Linux-x86_64.sh
fi
echo "export CONDA_ACTIVATE=${CONDA_PACKAGE%conda}activate" >> ~/.bashrc
#Create Conda env
conda create --name ${condaEnv} python=3.7 --yes
#Activate conda env
source ~/.bashrc
source ${CONDA_ACTIVATE} ${condaEnv}
#Install fetchchromsizes
conda install -c bioconda ucsc-fetchchromsizes --yes
#Install wigToBigWig
conda install -c bioconda ucsc-wigtobigwig --yes
#Install pycoQC
conda install -c aleg pycoqc --yes
#Install Samtools
conda install -c bioconda samtools --yes
#Install tensorflow-gpu 1.14
conda install tensorflow-gpu==1.14 --yes
#Install Deepbinner
pip3 install git+https://github.com/rrwick/Deepbinner.git
#Install Keras 2.3.1
pip3 install Keras==2.3.1
#Install ont fast5 api
pip3 install ont-fast5-api
#Install Guppy
wget https://mirror.oxfordnanoportal.com/software/analysis/ont-guppy_${GUPPY_VERSION}_linux64.tar.gz
tar -xzvf ont-guppy_${GUPPY_VERSION}_linux64.tar.gz
echo "GUPPY_DIR="${SOFTWARE_DIR}/ont-guppy/bin >> ../varSettings.sh
#Install Megalodon
pip3 install Megalodon
pip3 install ont_pyguppy_client_lib==$GUPPY_VERSION
# Create and move to a temporary scratch folder
mkdir -p /scratch/TMP_Megalodon_${expName}
cd /scratch/TMP_Megalodon_${expName}
### Get Rerio's research model from GitHub (if it doesn't exist already)
if [[ ! -f ./rerio/basecall_models/${modelConfig}.cfg ]]
then
echo "Installing Rerio's modbases all context research model"
git clone https://github.com/nanoporetech/rerio
python rerio/download_model.py rerio/basecall_models/${modelConfig}
fi
source ${work_DIR}/varSettings.sh
# Copy Guppy's barcoding models into Rerio's folder
cp ${GUPPY_DIR}/../data/barcoding/* ./rerio/basecall_models/barcoding/
if [ "${two_pass}" = "yes" ]; then
echo "Preparation of raw Fast5s before 2-pass demultiplexing"
# Copy the raw fast5s to the temporary scratch folder
mkdir -p /scratch/TMP_Megalodon_${expName}/rawFast5
cp -r ${rawFast5_DIR} ./rawFast5
#Move fast5s from children folders to the parent folder
find ./rawFast5 -type f -name "*.fast5" | xargs mv -t ./rawFast5
#Create a txt file containing the absolute filename of all raw fast5s
find ./rawFast5 -type f -name "*.fast5" > rawFast5s_list.txt
#Get total number of fast5s and half it
tot_fast5s=$(find ./rawFast5 -type f -name "*.fast5" | wc -l)
let half_1=${tot_fast5s}/2
let half_2=${tot_fast5s}-${half_1}
# Get a list for each half
head -${half_1} rawFast5s_list.txt > rawFast5s_half1.txt
tail -${half_2} rawFast5s_list.txt > rawFast5s_half2.txt
# Create folders and move the fast5s
mkdir -p ./rawFast5/1 ./rawFast5/2
xargs mv -t ./rawFast5/1 < rawFast5s_half1.txt
xargs mv -t ./rawFast5/2 < rawFast5s_half2.txt
fi
echo "Done"