-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
221 lines (202 loc) · 6.84 KB
/
Dockerfile
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
# Image for INTERVENE Synthetic data pipeline
FROM debian:bullseye-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
; \
rm -rf /var/lib/apt/lists/*
# ********************* Build basic julia image ******************************************
ENV JULIA_PATH /usr/local/julia
ENV PATH $JULIA_PATH/bin:$PATH
# https://julialang.org/juliareleases.asc
# Julia (Binary signing key) <buildbot@julialang.org>
ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495
# https://julialang.org/downloads/
ENV JULIA_VERSION 1.6.4
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
if ! command -v gpg > /dev/null; then \
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
rm -rf /var/lib/apt/lists/*; \
fi; \
\
# https://julialang.org/downloads/#julia-command-line-version
# https://julialang-s3.julialang.org/bin/checksums/julia-1.6.4.sha256
arch="$(dpkg --print-architecture)"; \
case "$arch" in \
'amd64') \
url='https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz'; \
sha256='52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132'; \
;; \
'armhf') \
url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.6/julia-1.6.4-linux-armv7l.tar.gz'; \
sha256='9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1'; \
;; \
'arm64') \
url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.4-linux-aarch64.tar.gz'; \
sha256='072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b'; \
;; \
'i386') \
url='https://julialang-s3.julialang.org/bin/linux/x86/1.6/julia-1.6.4-linux-i686.tar.gz'; \
sha256='9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf'; \
;; \
*) \
echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \
exit 1; \
;; \
esac; \
\
curl -fL -o julia.tar.gz.asc "$url.asc"; \
curl -fL -o julia.tar.gz "$url"; \
\
echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \
gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \
command -v gpgconf > /dev/null && gpgconf --kill all; \
rm -rf "$GNUPGHOME" julia.tar.gz.asc; \
\
mkdir "$JULIA_PATH"; \
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \
rm julia.tar.gz; \
\
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
\
# smoke test
julia --version
# **************************** Install tools ***********************************
ENV TOOLS_DIR /opt/tools
ENV DOWNLOAD_DIR /home/Downloads
ENV PLINK_PATH "$TOOLS_DIR/plink"
ENV PLINK2_PATH "$TOOLS_DIR/plink2"
ENV KING_PATH "$TOOLS_DIR/king"
ENV VCFTOOLS_PATH "$TOOLS_DIR/vcftools"
ENV BCFTOOLS_PATH "$TOOLS_DIR/bcftools"
ENV MAPTHIN_PATH "$TOOLS_DIR/mapthin"
# Add tools to PATH
ENV PATH $PLINK_PATH:$PLINK2_PATH:$KING_PATH:$VCFTOOLS_PATH/bin:$BCFTOOLS_PATH/bin:$MAPTHIN_PATH:$PATH
# Setup compression tools
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
unzip \
git \
autoconf automake build-essential pkg-config zlib1g-dev cmake \
libbz2-dev liblzma-dev
RUN set -eux; \
# Setup tools directory
mkdir -p $TOOLS_DIR; \
mkdir -p $DOWNLOAD_DIR; \
# Setup Plink 1.9
echo "Setting up Plink 1.9"; \
curl -fL -o $DOWNLOAD_DIR/plink1.zip "http://s3.amazonaws.com/plink1-assets/plink_linux_x86_64_20201019.zip"; \
unzip $DOWNLOAD_DIR/plink1.zip -d "$PLINK_PATH"; \
# Setup Plink2
echo "Setting up Plink 2.0"; \
curl -fL -o $DOWNLOAD_DIR/plink2.zip "https://s3.amazonaws.com/plink2-assets/plink2_linux_avx2_latest.zip"; \
unzip $DOWNLOAD_DIR/plink2.zip -d "$PLINK2_PATH"; \
# Setup KING
echo "Setting up KING"; \
curl -fL -o $DOWNLOAD_DIR/king.tar.gz "https://www.kingrelatedness.com/Linux-king.tar.gz"; \
mkdir "$KING_PATH"; \
tar -xzf $DOWNLOAD_DIR/king.tar.gz -C "$KING_PATH"; \
# Setup vcftools
echo "Setting up vcftools"; \
cd "$DOWNLOAD_DIR"; \
git clone https://github.com/vcftools/vcftools.git; \
cd vcftools; \
./autogen.sh; \
./configure --prefix="$VCFTOOLS_PATH"; \
make; \
make install; \
cd -; \
# Setup bcftools
echo "Setting up bcftools"; \
cd "$DOWNLOAD_DIR"; \
curl -fL -o bcftools.tar.bz2 https://github.com/samtools/bcftools/releases/download/1.13/bcftools-1.13.tar.bz2; \
mkdir -p bcftools; \
tar -xf bcftools.tar.bz2 -C "bcftools" --strip-components 1; \
cd bcftools; \
./configure --prefix="$BCFTOOLS_PATH"; \
make; \
make install; \
cd -; \
# Setup mapthin
echo "Setting up mapthin"; \
cd "$DOWNLOAD_DIR"; \
curl --insecure -fL -o mapthin.zip https://www.staff.ncl.ac.uk/richard.howey/mapthin/mapthin-v1.11-linux-x86_64.zip; \
unzip mapthin.zip; \
mkdir $MAPTHIN_PATH; \
mv mapthin-v1.11-linux-x86_64/* $MAPTHIN_PATH; \
chmod +x $MAPTHIN_PATH/mapthin; \
# Setup plinkio
echo "Setting up plinkio"; \
cd "$DOWNLOAD_DIR"; \
curl -fL -o libplinkio.zip https://github.com/mfranberg/libplinkio/archive/refs/tags/v0.9.8.zip; \
unzip libplinkio.zip; \
cd libplinkio-0.9.8; \
mkdir build; \
cd build; \
cmake ../; \
make && make test && make install; \
# Debug
# ls -la $TOOLS_DIR; \
# ls -la $PLINK_PATH; \
# ls -la $PLINK2_PATH; \
# ls -la $KING_PATH; \
# ls -la $BCFTOOLS_PATH; \
# ls -ls $BCFTOOLS_PATH/bin; \
# ls -ls $BCFTOOLS_PATH/libexec; \
# ls -la $MAPTHIN_PATH; \
\
# Test
# plink --version; \
# plink2 --version; \
# which king; \
# vcftools --version; \
# bcftools --version; \
# mapthin; \
# Clean up
rm -rf $DOWNLOAD_DIR
# ************************* Add INTERVENE scripts *********************************
WORKDIR /opt/intervene
ENV SCRIPT_DIR "/opt/intervene/scripts"
ENV DATA_DIR "/data"
ENV JULIA_PROJECT $SCRIPT_DIR
RUN mkdir -p $DATA_DIR
# ENV JULIA_DEPOT_PATH "/opt/intervene/.julia/"
# RUN mkdir -p $JULIA_DEPOT_PATH
RUN echo "cat banner.txt\n" >> ~/.bashrc
# Copy source files
WORKDIR $SCRIPT_DIR
COPY . .
RUN ln -s $DATA_DIR .
# Install Julia packages
RUN set -eux; \
julia --project=$SCRIPT_DIR -e \
"using Pkg; Pkg.instantiate(); using Conda; Conda.add(\"bed-reader\")"
# Install dependencies for phenotype generation
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
libgsl-dev \
libblas-dev liblapack-dev
# Build phenotype generation binary
ENV PHENO_BIN_PATH "$TOOLS_DIR/phenotype"
RUN mkdir -p $PHENO_BIN_PATH
ENV PATH $PHENO_BIN_PATH:$PATH
RUN set -eux; \
cd algorithms/phenotype; \
gcc Main.c Support.c -o $PHENO_BIN_PATH/phenoalg -L. -lm -lgsl -fPIC -lblas -lplinkio
# Setup path for commands
ENV PATH "$SCRIPT_DIR/commands":$PATH