|
a |
|
b/Dockerfile.pangenome_aware_deepvariant |
|
|
1 |
# Copyright 2019 Google LLC. |
|
|
2 |
# This is used to build the pangenome-aware DeepVariant release docker image. |
|
|
3 |
# It can also be used to build local images, especially if you've made changes |
|
|
4 |
# to the code. |
|
|
5 |
# Example command: |
|
|
6 |
# $ git clone https://github.com/google/deepvariant.git |
|
|
7 |
# $ cd deepvariant |
|
|
8 |
# $ sudo docker build -f Dockerfile.pangenome_aware_deepvariant -t pangenome_aware_deepvariant . |
|
|
9 |
# |
|
|
10 |
# To build for GPU, use a command like: |
|
|
11 |
# $ sudo docker build -f Dockerfile.pangenome_aware_deepvariant --build-arg=FROM_IMAGE=nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 --build-arg=DV_GPU_BUILD=1 -t pangenome_aware_deepvariant_gpu . |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
ARG FROM_IMAGE=ubuntu:22.04 |
|
|
15 |
# PYTHON_VERSION is also set in settings.sh. |
|
|
16 |
ARG PYTHON_VERSION=3.10 |
|
|
17 |
ARG DV_GPU_BUILD=0 |
|
|
18 |
ARG VERSION_DEEPVARIANT=1.8.0 |
|
|
19 |
ARG TF_ENABLE_ONEDNN_OPTS=1 |
|
|
20 |
|
|
|
21 |
FROM continuumio/miniconda3 AS conda_setup |
|
|
22 |
RUN conda config --add channels defaults && \ |
|
|
23 |
conda config --add channels bioconda && \ |
|
|
24 |
conda config --add channels conda-forge |
|
|
25 |
RUN conda create -n bio \ |
|
|
26 |
bioconda::bcftools=1.15 \ |
|
|
27 |
bioconda::samtools=1.15 \ |
|
|
28 |
&& conda clean -a |
|
|
29 |
|
|
|
30 |
FROM ${FROM_IMAGE} AS builder |
|
|
31 |
COPY --from=conda_setup /opt/conda /opt/conda |
|
|
32 |
LABEL maintainer="https://github.com/google/deepvariant/issues" |
|
|
33 |
|
|
|
34 |
ARG DV_GPU_BUILD |
|
|
35 |
ENV DV_GPU_BUILD=${DV_GPU_BUILD} |
|
|
36 |
|
|
|
37 |
# Copying DeepVariant source code |
|
|
38 |
COPY . /opt/deepvariant |
|
|
39 |
|
|
|
40 |
WORKDIR /opt/deepvariant |
|
|
41 |
|
|
|
42 |
RUN ./build-prereq.sh \ |
|
|
43 |
&& PATH="${HOME}/bin:${PATH}" ./build_release_binaries.sh # PATH for bazel |
|
|
44 |
|
|
|
45 |
FROM ${FROM_IMAGE} |
|
|
46 |
ARG DV_GPU_BUILD |
|
|
47 |
ARG VERSION_DEEPVARIANT |
|
|
48 |
ARG PYTHON_VERSION |
|
|
49 |
ARG TF_ENABLE_ONEDNN_OPTS |
|
|
50 |
ENV DV_GPU_BUILD=${DV_GPU_BUILD} |
|
|
51 |
ENV VERSION_DEEPVARIANT=${VERSION_DEEPVARIANT} |
|
|
52 |
ENV PYTHON_VERSION=${PYTHON_VERSION} |
|
|
53 |
ENV TF_ENABLE_ONEDNN_OPTS=${TF_ENABLE_ONEDNN_OPTS} |
|
|
54 |
|
|
|
55 |
WORKDIR /opt/ |
|
|
56 |
COPY --from=builder /opt/deepvariant/bazel-bin/licenses.zip . |
|
|
57 |
|
|
|
58 |
WORKDIR /opt/deepvariant/bin/ |
|
|
59 |
COPY --from=builder /opt/conda /opt/conda |
|
|
60 |
COPY --from=builder /opt/deepvariant/run-prereq.sh . |
|
|
61 |
COPY --from=builder /opt/deepvariant/settings.sh . |
|
|
62 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/make_examples_pangenome_aware_dv.zip . |
|
|
63 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/call_variants.zip . |
|
|
64 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/postprocess_variants.zip . |
|
|
65 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/vcf_stats_report.zip . |
|
|
66 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/show_examples.zip . |
|
|
67 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/runtime_by_region_vis.zip . |
|
|
68 |
COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/load_gbz_into_shared_memory.zip . |
|
|
69 |
COPY --from=builder /opt/deepvariant/scripts/run_pangenome_aware_deepvariant.py . |
|
|
70 |
RUN ./run-prereq.sh |
|
|
71 |
|
|
|
72 |
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 0 && \ |
|
|
73 |
update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 0 |
|
|
74 |
|
|
|
75 |
# Create shell wrappers for python zip files for easier use. |
|
|
76 |
RUN \ |
|
|
77 |
BASH_HEADER='#!/bin/bash' && \ |
|
|
78 |
printf "%s\n%s\n" \ |
|
|
79 |
"${BASH_HEADER}" \ |
|
|
80 |
'python3 -u /opt/deepvariant/bin/make_examples_pangenome_aware_dv.zip "$@"' > \ |
|
|
81 |
/opt/deepvariant/bin/make_examples_pangenome_aware_dv && \ |
|
|
82 |
printf "%s\n%s\n" \ |
|
|
83 |
"${BASH_HEADER}" \ |
|
|
84 |
'python3 /opt/deepvariant/bin/call_variants.zip "$@"' > \ |
|
|
85 |
/opt/deepvariant/bin/call_variants && \ |
|
|
86 |
printf "%s\n%s\n" \ |
|
|
87 |
"${BASH_HEADER}" \ |
|
|
88 |
'python3 /opt/deepvariant/bin/postprocess_variants.zip "$@"' > \ |
|
|
89 |
/opt/deepvariant/bin/postprocess_variants && \ |
|
|
90 |
printf "%s\n%s\n" \ |
|
|
91 |
"${BASH_HEADER}" \ |
|
|
92 |
'python3 /opt/deepvariant/bin/vcf_stats_report.zip "$@"' > \ |
|
|
93 |
/opt/deepvariant/bin/vcf_stats_report && \ |
|
|
94 |
printf "%s\n%s\n" \ |
|
|
95 |
"${BASH_HEADER}" \ |
|
|
96 |
'python3 /opt/deepvariant/bin/show_examples.zip "$@"' > \ |
|
|
97 |
/opt/deepvariant/bin/show_examples && \ |
|
|
98 |
printf "%s\n%s\n" \ |
|
|
99 |
"${BASH_HEADER}" \ |
|
|
100 |
'python3 /opt/deepvariant/bin/runtime_by_region_vis.zip "$@"' > \ |
|
|
101 |
/opt/deepvariant/bin/runtime_by_region_vis && \ |
|
|
102 |
printf "%s\n%s\n" \ |
|
|
103 |
"${BASH_HEADER}" \ |
|
|
104 |
'python3 /opt/deepvariant/bin/load_gbz_into_shared_memory.zip "$@"' > \ |
|
|
105 |
/opt/deepvariant/bin/load_gbz_into_shared_memory && \ |
|
|
106 |
printf "%s\n%s\n" \ |
|
|
107 |
"${BASH_HEADER}" \ |
|
|
108 |
'python3 -u /opt/deepvariant/bin/run_pangenome_aware_deepvariant.py "$@"' > \ |
|
|
109 |
/opt/deepvariant/bin/run_pangenome_aware_deepvariant && \ |
|
|
110 |
chmod +x /opt/deepvariant/bin/make_examples_pangenome_aware_dv \ |
|
|
111 |
/opt/deepvariant/bin/call_variants \ |
|
|
112 |
/opt/deepvariant/bin/postprocess_variants \ |
|
|
113 |
/opt/deepvariant/bin/vcf_stats_report \ |
|
|
114 |
/opt/deepvariant/bin/show_examples \ |
|
|
115 |
/opt/deepvariant/bin/runtime_by_region_vis \ |
|
|
116 |
/opt/deepvariant/bin/load_gbz_into_shared_memory \ |
|
|
117 |
/opt/deepvariant/bin/run_pangenome_aware_deepvariant |
|
|
118 |
|
|
|
119 |
# Copy models |
|
|
120 |
WORKDIR /opt/models/pangenome_aware_deepvariant/wgs |
|
|
121 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wgs.pangenome.savedmodel/fingerprint.pb . |
|
|
122 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wgs.pangenome.savedmodel/saved_model.pb . |
|
|
123 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wgs.pangenome.savedmodel/example_info.json . |
|
|
124 |
WORKDIR /opt/models/pangenome_aware_deepvariant/wgs/variables |
|
|
125 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wgs.pangenome.savedmodel/variables/variables.data-00000-of-00001 . |
|
|
126 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wgs.pangenome.savedmodel/variables/variables.index . |
|
|
127 |
RUN chmod -R +r /opt/models/pangenome_aware_deepvariant/wgs/* |
|
|
128 |
|
|
|
129 |
WORKDIR /opt/models/pangenome_aware_deepvariant/wes |
|
|
130 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wes.pangenome.savedmodel/fingerprint.pb . |
|
|
131 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wes.pangenome.savedmodel/saved_model.pb . |
|
|
132 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wes.pangenome.savedmodel/example_info.json . |
|
|
133 |
WORKDIR /opt/models/pangenome_aware_deepvariant/wes/variables |
|
|
134 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wes.pangenome.savedmodel/variables/variables.data-00000-of-00001 . |
|
|
135 |
ADD https://storage.googleapis.com/deepvariant/models/DeepVariant/${VERSION_DEEPVARIANT}/pangenome_aware_models/savedmodels/deepvariant.wes.pangenome.savedmodel/variables/variables.index . |
|
|
136 |
RUN chmod -R +r /opt/models/pangenome_aware_deepvariant/wes/* |
|
|
137 |
|
|
|
138 |
ENV PATH="${PATH}":/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/deepvariant/bin/pangenome_aware_deepvariant:/opt/deepvariant/bin |
|
|
139 |
|
|
|
140 |
RUN apt-get -y update && \ |
|
|
141 |
apt-get install -y parallel python3-pip && \ |
|
|
142 |
PATH="${HOME}/.local/bin:$PATH" python3 -m pip install absl-py==0.13.0 && \ |
|
|
143 |
apt-get clean autoclean && \ |
|
|
144 |
apt-get autoremove -y --purge && \ |
|
|
145 |
rm -rf /var/lib/apt/lists/* |
|
|
146 |
|
|
|
147 |
|
|
|
148 |
WORKDIR /opt/deepvariant |
|
|
149 |
|
|
|
150 |
CMD ["/opt/deepvariant/bin/run_pangenome_aware_deepvariant", "--help"] |