-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
262 lines (227 loc) · 9.4 KB
/
Copy pathDockerfile
File metadata and controls
262 lines (227 loc) · 9.4 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
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
FROM debian:bullseye AS buildbase
# docker buildx build --progress=plain --no-cache --platform linux/amd64 -t microbiomedata/img-omics:5.3.0 .
# version variables
ENV IMG_annotation_pipeline_ver=5.3.0
ENV prodigal_ver=2.6.3
ENV trnascan_ver=2.0.12
ENV hmm_ver=3.3.2
ENV hpc_hmm_sha=66a2b4a7a01dab5111163d8372f581de381e8cb1
ENV last_ver=1584
ENV infernal_ver=1.1.4
ENV gms2_ver=1.14_1.25
ENV CRT_ver=1.8.4
ENV cromwell_ver=49
ENV jgi_genomad_branch=1.0.0_g1.8.1
# Update and clean package lists
RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get clean -y
# Install CA certificates
RUN apt-get -y update && \
apt-get install -y ca-certificates
RUN update-ca-certificates --fresh
# Install OpenJDK
# for building on arm / mac machine for amd, use `openjdk-11-jdk:amd64`
RUN apt-get -y update && apt-get install -y openjdk-11-jdk
# potential fix with openjdk:19-alpine following this comment, if we want
# to use wget instead of ADD (which is better practice) for building on MacOS
# https://forums.docker.com/t/how-to-make-wget-run-in-docker/140555/6
# Install essential packages
RUN apt-get -y update && apt-get install -y \
git \
gcc \
make \
wget \
time \
autoconf \
unzip \
curl \
libz-dev \
g++
RUN apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
#
########## Build prodigal
#
FROM buildbase AS prodigal
#4/20/23 Marcel is using a patched version, get from NERSC instead of offical repo
RUN \
cd /opt && \
wget http://portal.nersc.gov/dna/metagenome/assembly/prodigal_${prodigal_ver}_patched/prodigal && \
chmod 755 prodigal
#
######### Build trnascan
#
FROM buildbase AS trnascan
RUN \
wget https://github.com/UCSC-LoweLab/tRNAscan-SE/archive/refs/tags/v${trnascan_ver}.tar.gz && \
tar -xzf v${trnascan_ver}.tar.gz && \
rm v${trnascan_ver}.tar.gz && \
cd tRNAscan-SE-${trnascan_ver} && \
./configure --prefix=/opt/omics/programs/tRNAscan-SE/tRNAscan-SE-${trnascan_ver}/ && \
make && \
make install
#
########## Build HMMER 3.3.2
#
FROM buildbase AS hmm
RUN \
cd /opt && \
wget http://eddylab.org/software/hmmer/hmmer-${hmm_ver}.tar.gz && \
tar -zxf hmmer-${hmm_ver}.tar.gz && \
rm hmmer-${hmm_ver}.tar.gz && \
cd hmmer-${hmm_ver} && \
./configure --prefix /opt/omics/programs/hmmer/ && \
make && \
make install
# pre 2025: get and extract commit sha a8d641046729328fdda97331d527edb2ce81510a of master branch of modification file, copy into hmmer source code
## for hmmer version 3.3.2 the hpc_hmmsearch should use the code in master branch
# 2025: master branch sha 66a2b4a7a01dab5111163d8372f581de381e8cb1 for oct 5, 2022 version
# ENV hpc_hmm_sha=66a2b4a7a01dab5111163d8372f581de381e8cb1
RUN \
wget https://github.com/Larofeticus/hpc_hmmsearch/archive/${hpc_hmm_sha}.zip && \
unzip ${hpc_hmm_sha}.zip && \
rm ${hpc_hmm_sha}.zip && \
cp /hpc_hmmsearch-*/hpc_hmmsearch.c /opt/hmmer-${hmm_ver}/src && \
cd /opt/hmmer-${hmm_ver}/src && \
gcc -std=gnu99 -O3 -fomit-frame-pointer -fstrict-aliasing -march=core2 -fopenmp -fPIC -msse2 -DHAVE_CONFIG_H -I../easel -I../libdivsufsort -I../easel -I. -I. -o hpc_hmmsearch.o -c hpc_hmmsearch.c && \
gcc -std=gnu99 -O3 -fomit-frame-pointer -fstrict-aliasing -march=core2 -fopenmp -fPIC -msse2 -DHAVE_CONFIG_H -L../easel -L./impl_sse -L../libdivsufsort -L. -o hpc_hmmsearch hpc_hmmsearch.o -lhmmer -leasel -ldivsufsort -lm && \
cp hpc_hmmsearch /opt/omics/programs/hmmer/bin/ && \
/opt/omics/programs/hmmer/bin/hpc_hmmsearch -h
#
########## Build last 1584
#
FROM buildbase AS last
RUN \
wget https://gitlab.com/mcfrith/last/-/archive/1584/last-${last_ver}.tar.gz && \
tar -zxf last-${last_ver}.tar.gz && \
rm last-${last_ver}.tar.gz && \
cd last-${last_ver} && \
make && \
make prefix=/opt/omics/programs/last install
#
########## Build infernal 1.1.4
#
FROM buildbase AS infernal
RUN \
wget http://eddylab.org/infernal/infernal-${infernal_ver}.tar.gz && \
tar -zxf infernal-${infernal_ver}.tar.gz && \
rm infernal-${infernal_ver}.tar.gz && \
cd infernal-${infernal_ver} && \
./configure --prefix=/opt/omics/programs/infernal/infernal-${infernal_ver} && \
make && \
make install
#
########## IMG scripts and tools v 5.1.14, repo is public 4/2023. Add split.py from bfoster1/img-omics:0.1.12 (md5sum 21fb20bf430e61ce55430514029e7a83)
#
FROM buildbase AS img
RUN \
cd /opt && \
wget https://code.jgi.doe.gov/img/img-pipelines/img-annotation-pipeline/-/archive/${IMG_annotation_pipeline_ver}/img-annotation-pipeline-${IMG_annotation_pipeline_ver}.tar.gz && \
tar -xzf img-annotation-pipeline-${IMG_annotation_pipeline_ver}.tar.gz && \
rm img-annotation-pipeline-${IMG_annotation_pipeline_ver}.tar.gz
RUN \
cd /opt && \
wget https://code.jgi.doe.gov/official-jgi-workflows/jgi-wdl-pipelines/img-omics/-/raw/83c5483f0fd8afc43a2956ed065bffc08d8574da/bin/split.py && \
chmod 755 split.py
########## MetaGeneMark version was updated for img annotation pipeline 5.1.*
RUN \
cd /opt && \
wget http://portal.nersc.gov/dna/metagenome/assembly/gms2_linux_64.v${gms2_ver}_lic.tar.gz && \
tar -zxf gms2_linux_64.v${gms2_ver}_lic.tar.gz && \
rm gms2_linux_64.v${gms2_ver}_lic.tar.gz
########## get CRT version 1.8.4
RUN \
wget https://code.jgi.doe.gov/img/img-pipelines/crt-cli-imgap-version/-/archive/${CRT_ver}/crt-cli-imgap-version-${CRT_ver}.tar.gz && \
tar -xzf crt-cli-imgap-version-${CRT_ver}.tar.gz && \
rm crt-cli-imgap-version-${CRT_ver}.tar.gz && \
cd crt-cli-imgap-version-${CRT_ver}/src && \
javac *.java && \
jar cfe CRT-CLI.jar crt *.class && \
cp CRT-CLI.jar /opt/.
########## get genomad script from jgi
## https://code.jgi.doe.gov/img/img-pipelines/containerized-imgap-modules/misc/img-genomad
RUN \
cd /opt && \
wget https://code.jgi.doe.gov/img/img-pipelines/containerized-imgap-modules/misc/img-genomad/-/raw/${jgi_genomad_branch}/genomad.sh && \
chmod 755 genomad.sh
#
########## Build micromamba for genomad from img and replace miniconda3
FROM mambaorg/micromamba:2.0.3 as micromamba
# Set up micromamba and install dependencies
RUN micromamba install -y -n base -c conda-forge -c bioconda -c anaconda \
ca-certificates \
curl \
git \
wget \
jq \
parallel \
pyyaml \
openjdk \
perl-getopt-long \
bc \
procps-ng \
genomad=1.8.1 \
seqkit=2.9.0 && \
micromamba clean --all --yes
# Ensure micromamba is the only package manager used
ENV PATH="/opt/conda/bin:$PATH"
ENV MAMBA_ROOT_PREFIX="/opt/conda"
ENV MAMBA_EXE="/usr/bin/micromamba"
#
########## Install Cromwell v49
#
FROM buildbase AS cromwell
RUN \
mkdir -p /opt/omics/bin && \
cd /opt/omics/bin && \
wget -q https://github.com/broadinstitute/cromwell/releases/download/${cromwell_ver}/cromwell-${cromwell_ver}.jar && \
ln -sf cromwell-${cromwell_ver}.jar cromwell.jar
#
#
########## build final image
#
FROM buildbase
COPY --from=micromamba /opt/conda /opt/conda
COPY --from=micromamba /usr/bin/micromamba /usr/bin/micromamba
COPY --from=micromamba /usr/local/bin/ /usr/local/bin/
# conda shell.posix activate
ENV PATH="/opt/conda/bin:/opt/conda/envs/base/bin:/opt/omics/bin:/opt/omics/bin/functional_annotation:/opt/omics/bin/qc/post-annotation:/opt/omics/bin/qc/pre-annotation:/opt/omics/bin/structural_annotation:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ENV MAMBA_ROOT_PREFIX="/opt/conda"
ENV MAMBA_EXE="/usr/bin/micromamba"
# move everything to /opt
COPY --from=cromwell /opt/omics/bin/ /opt/omics/bin/
COPY --from=prodigal /opt/prodigal /opt/omics/programs/prodigal
COPY --from=trnascan /opt/omics/programs/tRNAscan-SE /opt/omics/programs/tRNAscan-SE
COPY --from=hmm /opt/omics/programs/hmmer/ /opt/omics/programs/hmmer
COPY --from=last /opt/omics/programs/last/ /opt/omics/programs/last
COPY --from=infernal /opt/omics/programs/infernal/ /opt/omics/programs/infernal/
COPY --from=img /opt/img-annotation-pipeline-${IMG_annotation_pipeline_ver}/bin/ /opt/omics/bin/
COPY --from=img /opt/split.py /opt/omics/bin/split.py
COPY --from=img /opt/gms2_linux_64 /opt/omics/programs/gms2_linux_64
COPY --from=img /opt/CRT-CLI.jar /opt/omics/programs/CRT/CRT-CLI.jar
COPY --from=img /opt/img-annotation-pipeline-${IMG_annotation_pipeline_ver}/VERSION /opt/omics/VERSION
COPY --from=img /opt/genomad.sh /usr/local/bin/genomad.sh
RUN \
mkdir /opt/omics/lib && \
cd /opt/omics/lib && \
ln -s ../programs/tRNAscan-SE/tRNAscan-SE-${trnascan_ver}/lib/tRNAscan-SE/* .
#link things to the bin directory
RUN \
cd /opt/omics/bin && \
ln -s ../programs/gms2_linux_64/gms2.pl gms2.pl && \
ln -s ../programs/gms2_linux_64/gmhmmp2 gmhmmp2 && \
ln -s ../programs/infernal/infernal-${infernal_ver}/bin/cmsearch cmsearch && \
ln -s ../programs/tRNAscan-SE/tRNAscan-SE-${trnascan_ver}/bin/tRNAscan-SE tRNAscan-SE && \
ln -s ../programs/last/bin/lastal lastal && \
ln -s ../programs/CRT/CRT-CLI.jar CRT-CLI.jar && \
ln -s ../programs/prodigal prodigal && \
ln -s ../programs/hmmer/bin/hpc_hmmsearch hmmsearch && \
ln -s /opt/conda/bin/seqkit seqkit && \
ln -s /opt/conda/bin/genomad genomad && \
ln -s /usr/bin/micromamba micromamba
#make sure tRNAscan can see cmsearch and cmscan
RUN \
cd /opt/omics/programs/tRNAscan-SE/tRNAscan-SE-${trnascan_ver}/bin/ && \
ln -s /opt/omics/programs/infernal/infernal-${infernal_ver}/bin/cmsearch cmsearch && \
ln -s /opt/omics/programs/infernal/infernal-${infernal_ver}/bin/cmscan cmscan