--- a +++ b/Dockerfile.deepsomatic @@ -0,0 +1,220 @@ +# Copyright 2019 Google LLC. +# This is used to build the DeepSomatic release docker image. +# It can also be used to build local images, especially if you've made changes +# to the code. +# Example command: +# $ git clone https://github.com/google/deepvariant.git +# $ cd deepvariant +# $ sudo docker build -f Dockerfile.deepsomatic -t deepsomatic . +# +# To build for GPU, use a command like: +# $ sudo docker build -f Dockerfile.deepsomatic --build-arg=FROM_IMAGE=nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 --build-arg=DV_GPU_BUILD=1 -t deepsomatic_gpu . + + +ARG FROM_IMAGE=ubuntu:22.04 +# PYTHON_VERSION is also set in settings.sh. +ARG PYTHON_VERSION=3.10 +ARG DV_GPU_BUILD=0 +ARG VERSION_DEEPSOMATIC=1.8.0 +ARG TF_ENABLE_ONEDNN_OPTS=1 + +FROM continuumio/miniconda3 as conda_setup +RUN conda config --add channels defaults && \ + conda config --add channels bioconda && \ + conda config --add channels conda-forge +RUN conda create -n bio \ + bioconda::bcftools=1.15 \ + bioconda::samtools=1.15 \ + && conda clean -a + +FROM ${FROM_IMAGE} as builder +COPY --from=conda_setup /opt/conda /opt/conda +LABEL maintainer="https://github.com/google/deepvariant/issues" + +ARG DV_GPU_BUILD +ENV DV_GPU_BUILD=${DV_GPU_BUILD} + +# Copying DeepVariant source code +COPY . /opt/deepvariant + +WORKDIR /opt/deepvariant + +RUN ./build-prereq.sh \ + && PATH="${HOME}/bin:${PATH}" ./build_release_binaries.sh # PATH for bazel + +FROM ${FROM_IMAGE} +ARG DV_GPU_BUILD +ARG VERSION_DEEPSOMATIC +ARG PYTHON_VERSION +ARG TF_ENABLE_ONEDNN_OPTS +ENV DV_GPU_BUILD=${DV_GPU_BUILD} +ENV VERSION_DEEPSOMATIC ${VERSION_DEEPSOMATIC} +ENV PYTHON_VERSION ${PYTHON_VERSION} +ENV TF_ENABLE_ONEDNN_OPTS ${TF_ENABLE_ONEDNN_OPTS} + +WORKDIR /opt/ +COPY --from=builder /opt/deepvariant/bazel-bin/licenses.zip . + +WORKDIR /opt/deepvariant/bin/ +COPY --from=builder /opt/conda /opt/conda +COPY --from=builder /opt/deepvariant/run-prereq.sh . +COPY --from=builder /opt/deepvariant/settings.sh . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/make_examples_somatic.zip . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/call_variants.zip . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/postprocess_variants.zip . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/vcf_stats_report.zip . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/show_examples.zip . +COPY --from=builder /opt/deepvariant/bazel-out/k8-opt/bin/deepvariant/runtime_by_region_vis.zip . +COPY --from=builder /opt/deepvariant/scripts/run_deepsomatic.py ./deepsomatic/ +RUN ./run-prereq.sh + +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 0 && \ + update-alternatives --install /usr/bin/python python /usr/bin/python${PYTHON_VERSION} 0 + +# Create shell wrappers for python zip files for easier use. +RUN \ + BASH_HEADER='#!/bin/bash' && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 -u /opt/deepvariant/bin/make_examples_somatic.zip "$@"' > \ + /opt/deepvariant/bin/make_examples_somatic && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 /opt/deepvariant/bin/call_variants.zip "$@"' > \ + /opt/deepvariant/bin/call_variants && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 /opt/deepvariant/bin/postprocess_variants.zip "$@"' > \ + /opt/deepvariant/bin/postprocess_variants && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 /opt/deepvariant/bin/vcf_stats_report.zip "$@"' > \ + /opt/deepvariant/bin/vcf_stats_report && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 /opt/deepvariant/bin/show_examples.zip "$@"' > \ + /opt/deepvariant/bin/show_examples && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 /opt/deepvariant/bin/runtime_by_region_vis.zip "$@"' > \ + /opt/deepvariant/bin/runtime_by_region_vis && \ + printf "%s\n%s\n" \ + "${BASH_HEADER}" \ + 'python3 -u /opt/deepvariant/bin/deepsomatic/run_deepsomatic.py "$@"' > \ + /opt/deepvariant/bin/deepsomatic/run_deepsomatic && \ + chmod +x /opt/deepvariant/bin/make_examples_somatic \ + /opt/deepvariant/bin/call_variants \ + /opt/deepvariant/bin/postprocess_variants \ + /opt/deepvariant/bin/vcf_stats_report \ + /opt/deepvariant/bin/show_examples \ + /opt/deepvariant/bin/runtime_by_region_vis \ + /opt/deepvariant/bin/deepsomatic/run_deepsomatic + +# Copy models +WORKDIR /opt/models/deepsomatic/wgs +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/wgs/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/wgs/* + +WORKDIR /opt/models/deepsomatic/wes +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wes.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wes.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wes.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/wes/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wes.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wes.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/wes/* + +WORKDIR /opt/models/deepsomatic/pacbio +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/pacbio/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/pacbio/* + +WORKDIR /opt/models/deepsomatic/ont +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/ont/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/ont/* + +WORKDIR /opt/models/deepsomatic/ffpe_wgs +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wgs.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wgs.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wgs.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/ffpe_wgs/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wgs.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wgs.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/ffpe_wgs/* + +WORKDIR /opt/models/deepsomatic/ffpe_wes +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wes.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wes.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wes.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/ffpe_wes/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wes.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ffpe_wes.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/ffpe_wes/* + +# Tumor-only models +WORKDIR /opt/models/deepsomatic/wgs_tumor_only +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs_tumor_only.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs_tumor_only.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs_tumor_only.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/wgs_tumor_only/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs_tumor_only.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.wgs_tumor_only.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/wgs_tumor_only/* + +WORKDIR /opt/models/deepsomatic/pacbio_tumor_only +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio_tumor_only.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio_tumor_only.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio_tumor_only.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/pacbio_tumor_only/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio_tumor_only.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.pacbio_tumor_only.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/pacbio_tumor_only/* + +WORKDIR /opt/models/deepsomatic/ont_tumor_only +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont_tumor_only.savedmodel/fingerprint.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont_tumor_only.savedmodel/saved_model.pb . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont_tumor_only.savedmodel/example_info.json . +WORKDIR /opt/models/deepsomatic/ont_tumor_only/variables +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont_tumor_only.savedmodel/variables/variables.data-00000-of-00001 . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/savedmodels/deepsomatic.ont_tumor_only.savedmodel/variables/variables.index . +RUN chmod -R +r /opt/models/deepsomatic/ont_tumor_only/* + +# PONs and AF VCF files +WORKDIR /opt/models/deepsomatic/pons +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/AF_ilmn_PON_DeepVariant.GRCh38.AF0.05.vcf.gz . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/AF_ilmn_PON_DeepVariant.GRCh38.AF0.05.vcf.gz.tbi . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/AF_pacbio_PON_CoLoRSdb.GRCh38.AF0.05.vcf.gz . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/AF_pacbio_PON_CoLoRSdb.GRCh38.AF0.05.vcf.gz.tbi . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/PON_dbsnp138_gnomad_ILMN1000g_pon.vcf.gz . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/PON_dbsnp138_gnomad_ILMN1000g_pon.vcf.gz.tbi . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/PON_dbsnp138_gnomad_PB1000g_pon.vcf.gz . +ADD https://storage.googleapis.com/deepvariant/models/DeepSomatic/${VERSION_DEEPSOMATIC}/pons/PON_dbsnp138_gnomad_PB1000g_pon.vcf.gz.tbi . +RUN chmod -R +r /opt/models/deepsomatic/pons/* + +ENV PATH="${PATH}":/opt/conda/bin:/opt/conda/envs/bio/bin:/opt/deepvariant/bin/deepsomatic:/opt/deepvariant/bin + +RUN apt-get -y update && \ + apt-get install -y parallel python3-pip && \ + PATH="${HOME}/.local/bin:$PATH" python3 -m pip install absl-py==0.13.0 && \ + apt-get clean autoclean && \ + apt-get autoremove -y --purge && \ + rm -rf /var/lib/apt/lists/* + + +WORKDIR /opt/deepvariant + +CMD ["/opt/deepvariant/bin/deepsomatic/run_deepsomatic", "--help"]