-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSingularity.Demuxafy
426 lines (323 loc) · 14.8 KB
/
Singularity.Demuxafy
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
BootStrap: library
From: ubuntu:20.04
%labels
Author = Drew Neavin
Image_version = v3.0.0
Software = Demuxafy
%environment
# set up all essential environment variables
export LC_ALL=C
export PATH=/miniconda3/bin:/opt/minimap2-2.26_x64-linux:/opt/:/opt/hisat2-2.2.1:/opt/bedtools2/bin:/opt/souporcell:/opt/.cargo/bin:/opt/freebayes/scripts:/opt/popscle/bin/:/miniconda3/lib/python3.9/site-packages/scSplit:/opt/Demultiplexing_Doublet_Detecting_Docs/scripts:opt/Demultiplexing_Doublet_Detecting_Docs/mods:/usr/bin:/usr/local/cuda-11.8/bin:/opt/Drop-seq/dropseq-3.0.1-7-gf7acbbc/:/opt/gradle/gradle-8.8/bin:/$PATH
export PYTHONPATH=/miniconda3/lib/python3.9/:$PYTHONPATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/:/miniconda3/lib/python3.9/site-packages/nvidia/cudnn/lib:/miniconda3/lib/
export JAVA_HOME=/usr/lib/jvm/jdk-21-oracle-x64
%post
#!/bin/dash
export HOME=/root ## Needed for rust to behave correctly
export DEBIAN_FRONTEND=noninteractive
# update and install essential dependencies
apt update
apt-get -y update
apt-get update && apt-get install -y automake build-essential bzip2 wget git default-jre unzip libcurl4-gnutls-dev libxml2-dev libssl-dev
apt-get install -y libcurl4-openssl-dev
apt-get install -y --no-install-recommends apt-utils
apt-get -y install wget
apt-get -y install libtool
apt-get -y install flex
apt-get -y install zip unzip
apt-get -y install software-properties-common
apt update
apt-get -y install curl
export PATH=/usr/bin:$PATH
cd /opt
curl -V
## Install java (for dropulation)
wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb
dpkg -i jdk-21_linux-x64_bin.deb
rm jdk-21_linux-x64_bin.deb
JAVA_HOME=/usr/lib/jvm/jdk-21-oracle-x64
## dropulation
cd /opt
git clone https://github.com/broadinstitute/Drop-seq.git
cd Drop-seq
./gradlew distZip
ls dropseq
ls dropseq/build/
ls dropseq/build/distributions
unzip -d /opt/Drop-seq ./dropseq/build/distributions/dropseq-3.0.1-7-gf7acbbc.zip
rm dropseq/build/distributions/dropseq-3.0.1-7-gf7acbbc.zip
# wget https://github.com/broadinstitute/Drop-seq/releases/download/v3.0.1/dropseq-3.0.1.zip
# unzip dropseq-3.0.1.zip
# rm dropseq-3.0.1.zip
apt install -y dirmngr --install-recommends
apt install -y software-properties-common
apt install -y apt-transport-https
yes | apt-get update
yes | apt-get upgrade
apt install -y ca-certificates gnupg2
apt-key adv --keyserver keyserver.ubuntu.com --recv-key 'E298A3A825C0D65DFD57CBB651716619E084DAB9'
yes | add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'
apt-get update
apt install -y r-base
apt install -y r-base-dev
add-apt-repository ppa:c2d4u.team/c2d4u4.0+
apt update
apt list --upgradable
add-apt-repository ppa:cran/libgit2
apt install -y r-cran-devtools r-cran-usethis r-cran-gert -f
apt-get update
apt-get install -y libv8-dev
apt-get update
apt install -y ncdu
apt install -y libgeos-dev
yes | apt-get install libncurses5-dev
yes | apt-get install zlib1g-dev
yes | apt-get install libbz2-dev
yes | apt-get install liblzma-dev
yes | apt-get install zlib1g
yes | apt-get install zlib1g-dev
apt-get install -y pkg-config
apt-get install -y graphviz
apt-get install -y graphviz-dev
apt-get install -y libxml2
apt-get install -y bzip2
apt-get install -y devscripts
apt-get install -y tabix
apt-get install -y libcairo2-dev ## for complex heatmap
apt-get install -y libgmp-dev
apt-get install -y libgtk2.0-dev
apt-get install -y xvfb
apt-get install -y xauth
apt-get install -y xfonts-base
apt-get install -y libxt-dev
apt-get install -y libhdf5-dev
apt install -y libtiff-dev
apt-get install -y libasound2
apt-get -y install git
apt-get update
apt-get install -y libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev libglpk-dev
## igraph must be built before activating conda because of how it searches for some dependencies and decides things are available that aren't
R --slave -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
R --slave -e 'pak::pak("igraph/rigraph")'
R --slave -e 'devtools::install_github("cran/lsa")'
cd /opt
wget https://github.com/Kitware/CMake/releases/download/v3.14.4/cmake-3.14.4.tar.gz
tar -xzf cmake-3.14.4.tar.gz
cd cmake-3.14.4
./configure
make
make install
cmake --version
cd /opt
rm cmake-3.14.4.tar.gz
# download, install, and update miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_24.3.0-0-Linux-x86_64.sh
bash Miniconda3-py39_24.3.0-0-Linux-x86_64.sh -b -f -p /miniconda3/
rm Miniconda3-py39_24.3.0-0-Linux-x86_64.sh
# install dependencies via conda
eval "$(command conda 'shell.bash' 'hook' 2> /dev/null)"
export PATH="/miniconda3/bin:$PATH"
conda install -y -c conda-forge pip # general dependencies
conda update --all
conda install -c conda-forge ncurses
apt-get -y install libncurses5-dev
apt-get -y install zlib1g-dev
apt-get -y install libbz2-dev
apt-get -y install liblzma-dev
apt-get -y install pkg-config
conda install conda-forge::pystan==2.19.1.1
### Install dependencies
cd /opt
pip install pysam ##scSplit, souporcell
pip install pyfaidx ## souporcell
pip install "setuptools<58" --upgrade
pip install pyvcf ##scSplit, souporcell
pip install scipy
pip install arviz==0.12.1
### Install solo ###
pip install tensorflow[and-cuda] tensorrt==8.6.1 tensorflow-gpu==2.8.0
yes | conda install cudatoolkit=11.8 nvidia/label/cuda-11.8.0::cuda
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install torchmetrics==0.6.0 pytorch-lightning==1.3.1 scvi-tools==0.14.6 numpy==1.21.5
cd /opt
git clone https://github.com/calico/solo.git
cd solo
git reset --hard cd0ec6b
git clean -df
### There are some issues with updates to numpy handeling and other steps that were updated for python 3.12 but can't use 3.12 here (due to souporcell) but still need the updates => make the changes manually before building on the last commit before the 3.12 updates
sed -i 's/np.percentile(cell_umi_depth/np.percentile(np.array(cell_umi_depth)/g' /opt/solo/solo/solo.py
sed -i '319d' /opt/solo/solo/solo.py
sed -i '319i\ if logit_predictions.columns[0]=="doublet":' /opt/solo/solo/solo.py
sed -i '320i\ doublet_score = softmax_predictions[:, 0]' /opt/solo/solo/solo.py
sed -i '321i\ else:' /opt/solo/solo/solo.py
sed -i '322i\ doublet_score = softmax_predictions[:, 1]' /opt/solo/solo/solo.py
sed -i 's/.values//g' /opt/solo/solo/solo.py
pip install -e .
pip install setuptools==57.5.0 ##scSplit, souporcell
pip install scikit-learn==1.0.2 ### later sklearns don't play well with scSplit need for numpy matrix...
pip install pandas==1.5.3
pip install matplotlib==3.2.2
pip install scikit-image
pip install numba
pip install annoy==1.15 ### can't be 1.17 based on feedback from some users about issues with scrublet on their system
pip install umap-learn
pip install h5py
pip install xgboost
pip install argparse
pip install biopython # to handle gzipped fasta files in souporcell
### Install R libraries ###
## Base helper packages ##
R --slave -e 'install.packages("textshaping", repo="http://cran.us.r-project.org")'
R --slave -e 'install.packages("ragg", repo="http://cran.us.r-project.org")'
R --slave -e 'install.packages("pkgdown", repos = "http://cran.us.r-project.org", dependecies=TRUE)'
R --slave -e 'install.packages("V8", repos = "http://cran.us.r-project.org")'
R --slave -e 'install.packages("devtools", repos = "http://cran.us.r-project.org")'
R --slave -e 'remotes::install_github("tidyverse/tidyverse")'
R --slave -e 'install.packages("data.table", repos = "http://cran.us.r-project.org")'
R --slave -e 'install.packages("xgboost", repos = "http://cran.us.r-project.org")'
R --slave -e 'remotes::install_github("trevorld/r-argparse")'
R --slave -e 'install.packages("https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-4.tar.gz", repos=NULL, type="source")'
# ## Other helper pacages ##
R --slave -e 'install.packages("BiocManager")'
R --slave -e 'install.packages("remotes", repos = "http://cran.us.r-project.org")'
R --slave -e 'install.packages("hdf5r", repos = "http://cran.us.r-project.org")'
R --slave -e 'devtools::install_github(repo="knausb/vcfR")'
R --slave -e 'install.packages("Cairo",repo="http://cran.us.r-project.org")' ### Required for Complex Heatmap
R --slave -e 'devtools::install_github("krassowski/complex-upset")'
R --slave -e 'install.packages("lsa", repos = "http://cran.us.r-project.org")'
R --slave -e 'devtools::install_github("cran/lsa")'
# R --slave -e 'install.packages("ComplexUpset", repos = "http://cran.us.r-project.org")'
R --slave -e 'devtools::install_github("jokergoo/ComplexHeatmap")'
## Single Cell packages ##
R --slave -e 'install.packages("BH", repos = "http://cran.us.r-project.org")'
R --slave -e 'remotes::install_version("SeuratObject")'
R --slave -e 'remotes::install_version("Seurat")'
# Doublet Detecting packages ##
R --slave -e 'BiocManager::install("SparseArray")' ### Depdnency for scDblFinder and scds
R --slave -e 'BiocManager::install("mbkmeans")' ### Depdnency for scDblFinder and scds
R --slave -e 'devtools::install_github("kostkalab/scds", ref="master")' ### One of the dependencies = SCE so dont need to install separately
R --slave -e 'BiocManager::install("scDblFinder")'
R --slave -e 'devtools::install_github("drneavin/DoubletDecon")' ### Forked and changed on August 2, 2022 because of errors with original directory and poor response from author of repo so unlikely to fix
R --slave -e 'remotes::install_github("chris-mcginnis-ucsf/DoubletFinder")'
## For dropseq
R --slave -e 'devtools::install_github("broadinstitute/Drop-seq", subdir="/src/R/packages/DropSeq.utilities")'
R --slave -e 'devtools::install_github("broadinstitute/Drop-seq", subdir="/src/R/packages/DropSeq.dropulation")'
### Install hisat2 for souporcell ###
cd /opt
wget https://cloud.biohpc.swmed.edu/index.php/s/oTtGWbWjaxsQ2Ho/download
mv download hisat2.zip
unzip hisat2.zip
### Install minimap 2 for souporcell ###
cd /opt
wget https://github.com/lh3/minimap2/releases/download/v2.26/minimap2-2.26_x64-linux.tar.bz2
tar -xf minimap2-2.26_x64-linux.tar.bz2
### Install bedtools2 for souporcell ###
cd /opt
wget https://github.com/arq5x/bedtools2/releases/download/v2.30.0/bedtools-2.30.0.tar.gz
tar -zxvf bedtools-2.30.0.tar.gz
cd bedtools2
make
cd /opt
rm bedtools-2.30.0.tar.gz
### Activate cargo
cd /opt
CARGO_HOME=/opt/.cargo RUSTUP_HOME=/opt/.cargo bash -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y'
. /opt/.cargo/env
which cargo
rustup default stable
### Clone and install souporcell ###
cd /opt
git clone --recursive https://github.com/wheaton5/souporcell.git
cd souporcell/troublet
cargo build --release
cd /opt/souporcell/souporcell
cargo build --release
### Install CellSNP and Vireo ###
pip3 install vireoSNP
conda config --add channels bioconda
conda config --add channels conda-forge
conda install cellsnp-lite
### Install vartrix for souporcell ###
cd /opt
wget https://github.com/10XGenomics/vartrix/releases/download/v1.1.22/vartrix_linux
mv vartrix_linux vartrix
chmod 777 vartrix
### Install htslib for samtools - souporcell ###
cd /opt
wget https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2
tar xvfj htslib-1.20.tar.bz2
rm htslib-1.20.tar.bz2
cd htslib-1.20
./configure
make
make install
cd /opt
wget https://github.com/samtools/samtools/releases/download/1.20/samtools-1.20.tar.bz2
tar xvfj samtools-1.20.tar.bz2
rm samtools-1.20.tar.bz2
cd samtools-1.20
./configure
make
make install
cd /opt
wget https://github.com/samtools/bcftools/releases/download/1.20/bcftools-1.20.tar.bz2
tar xvfj bcftools-1.20.tar.bz2
rm bcftools-1.20.tar.bz2
cd bcftools-1.20
./configure --enable-versioned-symbols
make
make install
### Install freebayes - souporcell and scSplit ###
conda install -c bioconda freebayes=1.3.5 ## Some older version dont have the required functionality but know that 1.3.5 does so should use at leaast 1.3.5
### Install vcflib - I think for scSplit to parallelize if necessary? ###
conda install -c bioconda vcflib==1.0.3
### Install vcftools ###
cd /opt
wget https://github.com/vcftools/vcftools/releases/download/v0.1.16/vcftools-0.1.16.tar.gz
tar xvf vcftools-0.1.16.tar.gz
rm vcftools-0.1.16.tar.gz
cd vcftools-0.1.16
./configure
make
make install
### Install popscle ###
cd /opt
git clone https://github.com/statgen/popscle.git
cd popscle
cat CMakeLists.txt
mkdir build
cd build
cmake ..
make
### Install scSplit ###
pip install scSplit
chmod 777 /miniconda3/lib/python3.9/site-packages/scSplit/scSplit
### Install scrublet
pip install scrublet
### Install DoubletDetection
cd /opt
git clone https://github.com/JonathanShor/DoubletDetection.git
cd DoubletDetection
pip install .
## Install gnu parallel for txn doublet detecting softwares ####
cd /opt
wget http://ftp.gnu.org/gnu/parallel/parallel-latest.tar.bz2
tar xjf parallel-latest.tar.bz2
rm parallel-latest.tar.bz2
cd parallel-*
./configure && make
yes | make install
cd /opt
## demuxalot
pip install demuxalot
### Get the github repo with scripts for workflow ###
cd /opt
git clone --branch v3.0.0 https://github.com/drneavin/Demultiplexing_Doublet_Detecting_Docs.git
cd Demultiplexing_Doublet_Detecting_Docs
rm -rf references ## Only hosting on github for people to download if they want, no need to take up extra space in the image
rm -rf docs ## doc files, dont need in image
### Make scripts executable ###
chmod 777 -R /opt/Demultiplexing_Doublet_Detecting_Docs/scripts
### Remove unnecessary files ###
conda clean --all
unset DEBIAN_FRONTEND