Skip to content

Commit

Permalink
Added HF3 Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jscgh committed Dec 5, 2024
1 parent 9baee7b commit 71f0e9e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 40 deletions.
34 changes: 34 additions & 0 deletions dockerfiles/Dockerfile_nfcore-proteinfold_helixfold3
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04

LABEL Author="j.caley@unsw.edu.au" \
title="nfcore/proteinfold_helixfold3" \
Version="0.9.0" \
description="Docker image containing all software requirements to run the RUN_HELIXFOLD3 module using the nf-core/proteinfold pipeline"

ENV PYTHONPATH="/app/helixfold3:$PYTHONPATH" \
PATH="/conda/bin:/app/helixfold3:$PATH" \
PYTHON_BIN="/conda/envs/helixfold/bin/python3.9" \
ENV_BIN="/conda/envs/helixfold/bin" \
OBABEL_BIN="/conda/envs/helixfold/bin"

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget git && \
wget -q -P /tmp "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \
bash /tmp/Miniforge3-$(uname)-$(uname -m).sh -b -p /conda && \
rm -rf /tmp/Miniforge3-$(uname)-$(uname -m).sh /var/lib/apt/lists/* && \
apt-get autoremove -y && apt-get clean -y

RUN git clone --single-branch --branch dev --depth 1 --no-checkout https://github.com/PaddlePaddle/PaddleHelix.git /app/helixfold3 && \
cd /app/helixfold3 && \
git sparse-checkout init --cone && \
git sparse-checkout set apps/protein_folding/helixfold3 && \
git checkout dev && \
mv apps/protein_folding/helixfold3/* . && \
rm -rf apps

COPY hf3_environment.yaml /app/helixfold3/
RUN /conda/bin/mamba env create --file=/app/helixfold3/hf3_environment.yaml && \
/conda/bin/mamba install -y -c bioconda aria2 hmmer==3.3.2 kalign2==2.04 hhsuite==3.3.0 -n helixfold && \
/conda/bin/mamba install -y -c conda-forge openbabel -n helixfold && \
/conda/bin/mamba clean --all --force-pkgs-dirs -y && \
rm -rf /root/.cache && \
apt-get autoremove -y && apt-get remove --purge -y wget git && apt-get clean -y
27 changes: 17 additions & 10 deletions dockerfiles/helixfold3.def
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Bootstrap: docker
From: nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
From: nvidia/cuda:12.6.0-cudnn-devel-ubuntu24.04

%labels
Author j.caley@unsw.edu.au
Version 0.2.4
Version 0.2.1

%files
hf3_environment.yaml .
environment.yaml .

%post
apt update && DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y wget git build-essential
apt update && DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y wget git

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opt/miniforge
rm Miniforge3-$(uname)-$(uname -m).sh
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh"
bash Miniforge3-Linux-x86_64.sh -b -p /opt/miniforge
rm Miniforge3-Linux-x86_64.sh
export PATH="/opt/miniforge/bin:$PATH"

git clone --single-branch --branch dev --depth 1 --no-checkout https://github.com/PaddlePaddle/PaddleHelix.git app/helixfold3
Expand All @@ -23,11 +23,18 @@ From: nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
git checkout dev
mv apps/protein_folding/helixfold3/* .
rm -rf apps
mv /hf3_environment.yaml .
CONDA_PKGS_DIRS=$(mktemp -d -p "${TMPDIR:-/tmp}") mamba env create --file=hf3_environment.yaml
mv /environment.yaml .
mamba env create -f environment.yaml

conda install -y -c bioconda aria2 hmmer==3.3.2 kalign2==2.04 hhsuite==3.3.0 -n helixfold
conda install -y -c conda-forge openbabel -n helixfold

mamba run -n helixfold \
'python3 -m pip install paddlepaddle-gpu==2.6.1 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html && \
python3 -m pip install -r requirements.txt'

apt autoremove -y && apt remove --purge -y wget git && apt clean -y
rm -rf /var/lib/apt/lists/* /root/.cache $CONDA_PKGS_DIRS
rm -rf /var/lib/apt/lists/* /root/.cache *.tar.gz
mamba clean --all --force-pkgs-dirs -y

%environment
Expand Down
20 changes: 0 additions & 20 deletions dockerfiles/hf3_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,3 @@ dependencies:
- libgcc
- libgomp
- pip
- aria2
- hmmer==3.4
- kalign2==2.04
- hhsuite==3.3.0
- openbabel
- pip:
- paddlepaddle-gpu==2.6.1 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
- absl-py==0.13.0
- biopython==1.79
- chex==0.0.7
- dm-haiku==0.0.4
- dm-tree==0.1.6
- docker==5.0.0
- immutabledict==2.0.0
- jax==0.2.14
- ml-collections==0.1.0
- pandas==1.3.4
- scipy==1.9.0
- rdkit-pypi==2022.9.5
- posebusters
20 changes: 10 additions & 10 deletions modules/local/run_helixfold3.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process RUN_HELIXFOLD3 {
error("Local RUN_HELIXFOLD3 module does not support Conda. Please use Docker / Singularity / Podman / Apptainer instead.")
}

container "/srv/scratch/sbf-pipelines/proteinfold/singularity/helixfold3.sif"
container "/srv/scratch/z5378336/apptainers/hf3_docker.sif"

input:
tuple val(meta), path(fasta)
Expand Down Expand Up @@ -43,19 +43,19 @@ process RUN_HELIXFOLD3 {
"""
export MAXIT_SRC="./maxit_src"
export RCSBROOT="\$MAXIT_SRC"
export PATH="\$MAXIT_SRC/bin:/opt/miniforge/envs/helixfold/bin:$PATH"
export OBABEL_BIN="/opt/miniforge/envs/helixfold/bin"
export PATH="\$MAXIT_SRC/bin:\$ENV_BIN:$PATH"
export OBABEL_BIN="\$ENV_BIN"
ln -s /app/helixfold3/* .
/opt/miniforge/envs/helixfold/bin/python3.9 inference.py \
\$ENV_BIN/python3.9 inference.py \
--maxit_binary "\$MAXIT_SRC/bin/maxit" \
--jackhmmer_binary_path "/opt/miniforge/envs/helixfold/bin/jackhmmer" \
--hhblits_binary_path "/opt/miniforge/envs/helixfold/bin/hhblits" \
--hhsearch_binary_path "/opt/miniforge/envs/helixfold/bin/hhsearch" \
--kalign_binary_path "/opt/miniforge/envs/helixfold/bin/kalign" \
--hmmsearch_binary_path "/opt/miniforge/envs/helixfold/bin/hmmsearch" \
--hmmbuild_binary_path "/opt/miniforge/envs/helixfold/bin/hmmbuild" \
--jackhmmer_binary_path "\$ENV_BIN/jackhmmer" \
--hhblits_binary_path "\$ENV_BIN/hhblits" \
--hhsearch_binary_path "\$ENV_BIN/hhsearch" \
--kalign_binary_path "\$ENV_BIN/kalign" \
--hmmsearch_binary_path "\$ENV_BIN/hmmsearch" \
--hmmbuild_binary_path "\$ENV_BIN/hmmbuild" \
--preset='reduced_dbs' \
--bfd_database_path="./bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt" \
--small_bfd_database_path="./small_bfd/bfd-first_non_consensus_sequences.fasta" \
Expand Down

0 comments on commit 71f0e9e

Please sign in to comment.