comparison CSP2/docker/Dockerfile @ 39:93393808f415

"planemo upload"
author rliterman
date Thu, 12 Dec 2024 13:53:15 -0500
parents 01431fa12065
children
comparison
equal deleted inserted replaced
38:ee512a230a1e 39:93393808f415
1 # CSP2 Dockerfile
2 # Based on StaPH-B's Dockerfile for BEDTools, MUmmer, and Skesa
3 # Thanks to Erin Young, Curtis Kapsak, John Arnn, and the StaPH-B team
4 # https://github.com/StaPH-B/docker-builds/blob/master/bedtools/2.31.1/Dockerfile
5 # https://github.com/StaPH-B/docker-builds/blob/master/mummer/4.0.0/Dockerfile
6 # https://github.com/StaPH-B/docker-builds/blob/master/skesa/2.4.0/Dockerfile
7
8 ARG CSP2_VER="0.9.0"
9 ARG BEDTOOLS_VER="2.31.1"
10 ARG MUMMER_VER="4.0.0"
11 ARG SKESA_VER="2.4.0"
12 ARG MASH_VER="2.3"
13 ARG BBMAP_VER="38.90"
14 ARG PYTHON_VER="3.8"
15
16 FROM ubuntu:focal AS build
17
18 ARG BEDTOOLS_VER
19 ARG MUMMER_VER
20 ARG SKESA_VER
21 ARG MASH_VER
22 ARG BBMAP_VER
23 ARG PYTHON_VER
24
25 WORKDIR /build
26
27 # to prevent tzdata from asking for a region during apt updates; ARG so that variable only
28 # persists at buildtime
29 # from https://github.com/StaPH-B/docker-builds/blob/master/mummer/4.0.0/Dockerfile
30 ARG DEBIAN_FRONTEND=noninteractive
31
32 # Install build dependencies
33 RUN apt-get update && apt-get install -y --no-install-recommends \
34 tzdata \
35 gpg-agent \
36 software-properties-common \
37 build-essential \
38 zlib1g-dev \
39 libghc-bzlib-dev \
40 liblzma-dev \
41 wget \
42 ca-certificates
43
44 RUN add-apt-repository 'ppa:deadsnakes/ppa' && apt-get update && apt-get install -y --no-install-recommends \
45 python${PYTHON_VER} \
46 # python${PYTHON_VER}-pip \
47 # python${PYTHON_VER}-full \
48 python${PYTHON_VER}-dev \
49 python${PYTHON_VER}-venv && \
50 python${PYTHON_VER} -m venv --copies /opt/venv
51
52
53 ENV PATH="/opt/venv/bin:$PATH"
54
55 RUN pip install --no-cache-dir -U pandas~=1.2.0 pybedtools refchooser scikit-learn
56
57 ADD https://github.com/arq5x/bedtools2/archive/refs/tags/v${BEDTOOLS_VER}.tar.gz .
58 ADD https://github.com/mummer4/mummer/releases/download/v${MUMMER_VER}rc1/mummer-${MUMMER_VER}rc1.tar.gz .
59 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/skesa.centos.7.7 .
60 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/gfa_connector.centos7.7 .
61 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/kmercounter.centos7.7 .
62 ADD https://github.com/marbl/Mash/releases/download/v${MASH_VER}/mash-Linux64-v${MASH_VER}.tar .
63
64 # Install BEDTools
65 # per https://github.com/StaPH-B/docker-builds/blob/master/bedtools/2.31.1/Dockerfile
66 # python3 required when compiling via `make` command for creating old CLI executables
67 # dependencies listed here (albeit for v2.30.0, still should be identical): https://packages.ubuntu.com/jammy/bedtools
68 # requires libghc-bzlib-dev, build-essential, zlib1g-dev, and a few others
69 # 'make install' should place binary executable files in /usr/local/bin
70 RUN tar -xzf v${BEDTOOLS_VER}.tar.gz && \
71 rm v${BEDTOOLS_VER}.tar.gz && \
72 cd bedtools2-${BEDTOOLS_VER} && \
73 make && \
74 make install
75
76 # Install mummer
77 # per https://github.com/StaPH-B/docker-builds/blob/master/mummer/4.0.0/Dockerfile
78 RUN tar -xvf mummer-${MUMMER_VER}rc1.tar.gz && \
79 rm mummer-${MUMMER_VER}rc1.tar.gz && \
80 cd mummer-${MUMMER_VER}rc1 && \
81 ./configure --prefix=/usr/local && \
82 make && \
83 make install && \
84 ldconfig
85
86 # # Install Skesa
87 # # per https://github.com/StaPH-B/docker-builds/blob/master/skesa/2.4.0/Dockerfile
88 # # get skesa, gfa_connector, and kmercounter binaries, rename them
89 RUN mkdir skesa && \
90 cd skesa && \
91 mv /build/skesa.centos.7.7 skesa && \
92 mv /build/gfa_connector.centos7.7 gfa_connector && \
93 mv /build/kmercounter.centos7.7 kmercounter && \
94 chmod +x skesa gfa_connector kmercounter && \
95 mv skesa gfa_connector kmercounter /usr/local/bin
96
97 # Install Mash
98 RUN tar -xvf mash-Linux64-v${MASH_VER}.tar && \
99 mv mash-Linux64-v${MASH_VER}/mash /usr/local/bin
100
101 # Install BBMap
102 RUN wget -O BBMap_${BBMAP_VER}.tar.gz https://sourceforge.net/projects/bbmap/files/BBMap_${BBMAP_VER}.tar.gz/download && \
103 tar -xvf BBMap_${BBMAP_VER}.tar.gz && \
104 mv bbmap/* /usr/local/bin
105
106
107 FROM ubuntu:focal AS app
108
109 ARG CSP2_VER
110 ARG CSP2_BRANCH="main"
111 ARG PYTHON_VER
112
113 LABEL base.image="ubuntu:focal"
114 LABEL version=${CSP2_VER}
115 LABEL software="CSP2"
116 LABEL software.version=${CSP2_VER}
117 LABEL description="a Nextflow pipeline for rapid, accurate SNP distance estimation from assembly data"
118 LABEL website="https://github.com/CFSAN-Biostatistics/CSP2"
119 LABEL licence="https://github.com/CFSAN-Biostatistics/CSP2/blob/main/LICENSE"
120 LABEL maintainer="Robert Literman"
121 LABEL maintainer.email="Robert.Literman@fda.hhs.gov"
122 LABEL maintainer.organization="FDA/CFSAN/Biostatistics"
123 LABEL maintainer2="Justin Payne"
124 LABEL maintainer2.email="Justin.Payne@fda.hhs.gov"
125 LABEL maintainer2.organization="FDA/CFSAN/Biostatistics"
126
127 WORKDIR /root/.nextflow
128 WORKDIR /app
129
130 # copy in all executable files from builder stage to final app stage
131 COPY --from=build /usr/local/bin /usr/local/bin
132
133 # Lots of perl nonsense
134 COPY --from=build /usr/local/lib /usr/local/lib
135 COPY --from=build /usr/local/libexec/mummer /usr/local/libexec/mummer
136 COPY --from=build /usr/lib/x86_64-linux-gnu/perl /usr/lib/x86_64-linux-gnu/perl
137 COPY --from=build /usr/local/share /usr/local/share
138 COPY --from=build /usr/share /usr/share
139 COPY --from=build /opt/venv /opt/venv
140 COPY --from=build /usr/bin/make /usr/local/bin/make
141
142
143 # Python stuff
144 COPY --from=build /usr/lib/python${PYTHON_VER} /usr/lib/python${PYTHON_VER}
145
146
147 #Install JRE
148 RUN apt-get update && apt-get install -y --no-install-recommends \
149 ca-certificates \
150 openjdk-17-jre-headless \
151 curl
152
153 # Install Nextflow
154 # per https://www.nextflow.io/docs/latest/getstarted.html
155 RUN export CAPSULE_LOG=debug && curl -s https://get.nextflow.io | bash && \
156 chmod +x nextflow && \
157 mv nextflow /usr/local/bin && \
158 nextflow run hello
159
160 ADD docker/Makefile .
161
162 # set PATH, set perl locale settings for singularity compatibility
163 ENV PATH="/opt/venv/bin:/usr/local/bin:/skesa:$PATH" \
164 LC_ALL=C \
165 NXF_OFFLINE='true'
166
167 ADD bin ./bin
168 ADD conf ./conf
169 ADD subworkflows ./subworkflows
170 ADD CSP2.nf ./CSP2.nf
171 ADD nextflow.config ./nextflow.config
172
173
174 FROM app AS pretest
175
176 # set PATH, set perl locale settings for singularity compatibility
177 ENV PATH="/opt/venv/bin:/usr/local/bin:/skesa:$PATH" \
178 LC_ALL=C \
179 NXF_OFFLINE='true'
180
181 #Alternate test data directory
182 ADD https://github.com/CFSAN-Biostatistics/CSP2_TestData#main:assets assets/
183
184
185 # Test MUmmer installation
186 # per https://github.com/StaPH-B/docker-builds/blob/master/mummer/4.0.0/Dockerfile
187
188 ADD https://mummer4.github.io/tutorial/exampleFiles/2.1/in/H_pylori26695_Eslice.fasta .
189 ADD https://mummer4.github.io/tutorial/exampleFiles/2.1/in/H_pyloriJ99_Eslice.fasta .
190 ADD https://mummer4.github.io/tutorial/exampleFiles/2.2/in/B_anthracis_Mslice.fasta .
191 ADD https://mummer4.github.io/tutorial/exampleFiles/2.2/in/B_anthracis_contigs.fasta .
192 ADD http://mummer.sourceforge.net/examples/data/H_pylori26695_Eslice.fasta .
193 ADD http://mummer.sourceforge.net/examples/data/H_pyloriJ99_Eslice.fasta .
194 ADD https://raw.githubusercontent.com/artic-network/artic-ncov2019/master/primer_schemes/nCoV-2019/V5.3.2/SARS-CoV-2.primer.bed ./V5.3.2.artic.bed
195 ADD https://raw.githubusercontent.com/artic-network/artic-ncov2019/master/primer_schemes/nCoV-2019/V4.1/SARS-CoV-2.primer.bed ./V4.1.artic.bed
196
197 FROM pretest AS test
198
199 # Test MASH
200
201 RUN nucmer -h && \
202 promer -h && \
203 mummer -mum -b -c H_pylori26695_Eslice.fasta H_pyloriJ99_Eslice.fasta > mummer.mums && \
204 nucmer -c 100 -p nucmer B_anthracis_Mslice.fasta B_anthracis_contigs.fasta && \
205 show-snps -C nucmer.delta > nucmer.snps && \
206 promer -p promer_100 -c 100 H_pylori26695_Eslice.fasta H_pyloriJ99_Eslice.fasta
207
208 # Test bedtools installation
209 # check help options and version
210 RUN bedtools --help && \
211 bedtools --version
212
213 # downloads two bedfiles for ARTIC SARS-CoV-2 artic schemes, fixes their formatting, uses bedtools sort, intersect, and merge
214 # per https://github.com/StaPH-B/docker-builds/blob/master/bedtools/2.31.1/Dockerfile
215 RUN awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6}' V5.3.2.artic.bed > V5.3.2.unsorted.bed && \
216 bedtools sort -i V5.3.2.unsorted.bed > V5.3.2.bed && \
217 awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $6}' V4.1.artic.bed > V4.1.bed && \
218 bedtools intersect -a V5.3.2.bed -b V4.1.bed > intersect_test.bed && \
219 mergeBed -i V5.3.2.bed > merged_test.bed && \
220 head intersect_test.bed merged_test.bed
221
222 RUN /bin/bash -c 'make test'
223
224 FROM app AS release
225
226 ARG CSP2_VER
227 ARG BEDTOOLS_VER
228 ARG MUMMER_VER
229 ARG SKESA_VER
230 ARG MASH_VER
231 ARG BBMAP_VER
232 ARG PYTHON_VER
233 ENV CSP2_VER=${CSP2_VER}
234 ENV BEDTOOLS_VER=${BEDTOOLS_VER}
235 ENV MUMMER_VER=${MUMMER_VER}
236 ENV SKESA_VER=${SKESA_VER}
237 ENV MASH_VER=${MASH_VER}
238 ENV BBMAP_VER=${BBMAP_VER}
239 ENV PYTHON_VER=${PYTHON_VER}
240
241 # set PATH, set perl locale settings for singularity compatibility
242 ENV PATH="/opt/venv/bin:/usr/local/bin:/skesa:$PATH" \
243 LC_ALL=C \
244 NXF_OFFLINE='true'
245
246 ENTRYPOINT ["make", "--makefile=/app/Makefile"]