-
Couldn't load subscription status.
- Fork 53
Haddock3 container workflow & usage #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fa0d2b3
0d4fb11
5efc144
e6e5c4f
71cdc53
22b587b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # Container workflow for HADDOCK3 | ||
|
|
||
| Build, run, and extend an **Apptainer/Singularity** container for HADDOCK3. [**HADDOCK3**](https://doi.org/10.1021/acs.jcim.5c00969)(High Ambiguity Driven protein–protein Docking) is a flexible, information-driven software suite for modeling biomolecular complexes using experimental and theoretical restraints. **Docker**, **Singularity**, and **Apptainer** are containerization platforms that package applications and all their dependencies into lightweight, portable images, ensuring reproducible execution across different environments. | ||
|
|
||
| A ready-to-use Docker image for HADDOCK3 is published on the GitHub container registry, simply pull: | ||
| ```bash | ||
| # For the latest release | ||
| docker pull ghcr.io/haddocking/haddock3:latest | ||
|
|
||
| # Or pin to a specific release for reproducibility | ||
| docker pull ghcr.io/haddocking/haddock3:2025.8.0 | ||
|
|
||
| ``` | ||
| See the [HADDOCK3 container package](https://github.com/haddocking/haddock3/pkgs/container/haddock3) for details and version tags. This image serves as the canonical, versioned distribution of HADDOCK3 and can be used across development, CI/CD, and cloud environments. | ||
|
|
||
| To use this as the foundation for HPC-friendly SIF images, build **Apptainer** or **Singularity** containers directly from the Docker image in a single step. For example, to create an image: | ||
|
|
||
| ```bash | ||
| # Build Apptainer image | ||
| apptainer build haddock3_mpi.sif docker://ghcr.io/haddocking/haddock3:2025.8.0 | ||
|
|
||
| # Or, build with Singularity | ||
| singularity build haddock3_mpi.sif docker://ghcr.io/haddocking/haddock3:2025.8.0 | ||
| ``` | ||
| **Note:** Refer to the [**usage.md**](https://github.com/haddocking/haddock3/blob/main/usage-container/docs/usage.md) and the example SLURM script available in the `scripts` folder for detailed instructions on how to run HADDOCK3 jobs in an HPC environment. | ||
| <pre> <strong>Version updates:</strong> The HADDOCK3 image is regularly updated. Please check the tags at <a href="https://github.com/haddocking/haddock3/pkgs/container/haddock3">ghcr.io/haddocking/haddock3</a> for the latest version. </pre> | ||
|
|
||
| --- | ||
|
|
||
| ### Build Your Own HADDOCK3 Container | ||
| Containerization techniques enable highly reproducible, customizable, and scalable scientific workflows. If you want to understand how the container is built under the hood from scratch or customize it for your own workflows, follow these detailed steps: | ||
| 1. **Clone** | ||
|
|
||
| ```bash | ||
| git clone https://github.com/haddocking/haddock3.git | ||
| cd haddock3/usage-container/usage-container/recipe | ||
|
|
||
| ``` | ||
|
|
||
| **Repository Structure** | ||
|
|
||
| ```plaintext | ||
| ├── apptainer_recipe/ | ||
| │ └── HADDOCK3.def # Definition file | ||
| ├── docs/ # Documentation | ||
| │ ├── usage.md # Usage guide | ||
| ├── scripts/ # Scripts | ||
| │ ├── slurm_run.sh # Multi-node MPI run script | ||
| ├── README.md # Overview | ||
|
|
||
| ``` | ||
|
|
||
| 2. **Build** | ||
|
|
||
| A definition file is a blueprint that tells the containerization platform how to build the container. It specifies the base OS, software packages, environment variables, and custom setup steps, ensuring your container is reproducible and tailored to your workflow. | ||
| A ready-to-use `HADDOCK3.def` is provided in the ([recipe/](https://github.com/haddocking/haddock3/blob/main/usage-container/recipe)) directory. | ||
|
|
||
| ```bash | ||
| # Apptainer | ||
| apptainer build haddock3_mpi.sif haddock3_mpi.def | ||
|
|
||
| # Singularity | ||
| singularity build haddock3_mpi.sif haddock3_mpi.def | ||
| ``` | ||
|
|
||
| **Tip:** To create your own definition files to layer in additional packages, alternative MPI variants, Python libraries, and any domain-specific utilities.Just simply modify the `%post` section of `HADDOCK3.def` before building. | ||
|
|
||
| 3. **Verify&Run** | ||
|
|
||
| - **Shell**: interactive access | ||
| ```bash | ||
| apptainer shell haddock3_cpu-mpi.sif | ||
| ``` | ||
| - **HADDOCK3**: verify installation | ||
| ```bash | ||
| apptainer shell haddock3_cpu-mpi.sif haddock3 --version | ||
| ``` | ||
|
|
||
|
|
||
| ## Resources & Tutorials | ||
|
|
||
| - **Apptainer Installation & Usage**: Detailed installation instructions and usage examples can be found on the official docs: [apptainer.org/docs/admin/main/installation.html](https://apptainer.org/docs/admin/main/installation.html) | ||
| - **Official HADDOCK3 Tutorials**: Visit the Bonvin lab’s educational page for HADDOCK3 tutorials : [bonvinlab.org/education/HADDOCK3](https://www.bonvinlab.org/education/HADDOCK3/) | ||
| - **Source Code & Issues**: Explore the HADDOCK3 source code on GitHub: [github.com/haddocking/haddock3](https://github.com/haddocking/haddock3) | ||
|
|
||
| --- | ||
|
|
||
| ## Requirements | ||
|
|
||
| - **Host**: Linux with Apptainer or Singularity installed (local machine or HPC environment) | ||
| - **Disk**: ≥ 2 GB free for building | ||
| - **Python**: 3.10+ (inside container) | ||
|
|
||
| --- | ||
|
|
||
| ## Documentation | ||
|
|
||
| See the `docs/` folder: | ||
|
|
||
| - [**usage.md**](https://github.com/haddocking/haddock3/blob/main/usage-container/docs/usage.md) – Detailed usage and instructions to run Apptainer. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| *Get ready for seamless reproducible workflow for HADDOCK3 runs!* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| This guide explains how to run HADDOCK3 jobs either interactively or via SLURM batch submission (MPI HPC ready) | ||
| --- | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Run Interactively with `srun` | ||
|
|
||
| To run HADDOCK3 in an interactive SLURM session: | ||
|
|
||
| #example code | ||
|
|
||
| srun --partition=compute \ | ||
| --nodes=1 \ | ||
| --ntasks-per-node=8 \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to add somewhere some explanations on how to change the number of cpu used. Now the example gives 8, but is this a dynamic variable that the container will automatically take over? Or do you need to rebuild the container in case a different number of cpus should be used? |
||
| --chdir=/path/to/haddock3/examples/docking-protein-protein \ | ||
| apptainer exec \ | ||
| --bind /path/to/host:/path/to/host \ | ||
| /path/to/haddock3_cpu-mpi.sif \ | ||
| haddock3 docking-protein-protein-mpi.cfg | ||
|
|
||
| *Note: Change the `.cfg` file path and directory bindings to match your project location.* | ||
|
|
||
| --- | ||
|
|
||
| ### 2. Run as a Batch Job with `sbatch` | ||
|
|
||
| Submit your job to SLURM using the sample script in the `scripts/` folder: | ||
|
|
||
| ```bash | ||
| scripts/ sbatch run_haddock3_slurm.sh | ||
| ``` | ||
|
|
||
| *Customize the script and config paths as needed.* | ||
|
|
||
| --- | ||
|
|
||
|
|
||
|
|
||
|
|
||
| ## Requirements | ||
|
|
||
| - SLURM-enabled HPC environment | ||
| - Docker, Apptainer or Singularity installed | ||
| - Image: `haddock3_cpu-mpi.sif` | ||
| - `.cfg` configuration file for HADDOCK3 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| Bootstrap: docker | ||
| From: ubuntu:22.04 | ||
|
|
||
| %labels | ||
| Maintainer Shantanu Khatri | ||
| Description "MPI-ready HADDOCK3 + mpi4py container" | ||
|
|
||
| %environment | ||
| export PATH=/usr/local/bin:$PATH | ||
| export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/openmpi/lib:$LD_LIBRARY_PATH | ||
|
|
||
| %post | ||
| # Install core dependencies and MPI | ||
| apt-get update && apt-get install -y \ | ||
| wget git build-essential cmake gfortran \ | ||
| libfftw3-dev libxml2-dev zlib1g-dev \ | ||
| openmpi-bin libopenmpi-dev \ | ||
| python3 python3-pip \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Python packages | ||
| pip3 install --no-cache-dir --upgrade pip \ | ||
| mpi4py haddock3 | ||
|
|
||
| %runscript | ||
| echo "Welcome to the MPI-ready HADDOCK3 container." | ||
| exec "$@" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| #SBATCH --job-name=HADDOCK3-docking | ||
| #SBATCH --output=HADDOCK3_%j.out | ||
| #SBATCH --nodes=3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here we are requesting 3 nodes with each 120 tasks. Somewhere it should be made clear that the mpi run mode of HADDOCK3 must then be used in the config file. |
||
| #SBATCH --ntasks-per-node=120 | ||
| #SBATCH --mem=256GB | ||
| #SBATCH --partition=compute | ||
|
|
||
| echo "Starting HADDOCK3 Docking Job" | ||
| echo "SLURM_JOBID = $SLURM_JOBID" | ||
| echo "SLURM_JOB_NODELIST = $SLURM_JOB_NODELIST" | ||
| echo "SLURM_NNODES = $SLURM_NNODES" | ||
| echo "SLURMTMPDIR = $SLURMTMPDIR" | ||
| echo "Date = $(date)" | ||
| echo "Hostname = $(hostname -s)" | ||
| echo "Working Directory = $(pwd)" | ||
| echo "Submit Directory = $SLURM_SUBMIT_DIR" | ||
|
|
||
| # Load necessary environment (optional depending on your setup) | ||
| source /lustre/oneApi/setvars.sh | ||
| export OMP_NUM_THREADS=1 | ||
|
|
||
| # Run HADDOCK3 via Apptainer | ||
| cd "${WORK_DIR}" | ||
|
|
||
| # Ensure the working directory is set correctly | ||
| apptainer exec --bind /path/to/host/data:/path/to/container/data \ | ||
| /path/to/haddock3_image.sif \ | ||
| haddock3 your-docking-config.cfg | ||
|
|
||
|
|
||
| echo "HADDOCK3 Job Complete" | ||
| echo "Completed at: $(date)" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| #SBATCH --job-name=HADDOCK3-docking | ||
| #SBATCH --output=HADDOCK3_%j.out | ||
| #SBATCH --nodes=3 | ||
| #SBATCH --ntasks-per-node=120 | ||
| #SBATCH --mem=256GB | ||
| #SBATCH --partition=compute | ||
|
|
||
| echo "Starting HADDOCK3 Docking Job" | ||
| echo "SLURM_JOBID = $SLURM_JOBID" | ||
| echo "SLURM_JOB_NODELIST = $SLURM_JOB_NODELIST" | ||
| echo "SLURM_NNODES = $SLURM_NNODES" | ||
| echo "SLURMTMPDIR = $SLURMTMPDIR" | ||
| echo "Date = $(date)" | ||
| echo "Hostname = $(hostname -s)" | ||
| echo "Working Directory = $(pwd)" | ||
| echo "Submit Directory = $SLURM_SUBMIT_DIR" | ||
|
|
||
| # Load necessary environment (optional depending on your setup) | ||
| source /lustre/oneApi/setvars.sh | ||
| export OMP_NUM_THREADS=1 | ||
|
|
||
| # Run HADDOCK3 via Apptainer | ||
| cd "${WORK_DIR}" | ||
|
|
||
| # Ensure the working directory is set correctly | ||
| singularity exec --bind /path/to/host/data:/path/to/container/data \ | ||
| /path/to/haddock3_image.sif \ | ||
| haddock3 your-docking-config.cfg | ||
|
|
||
|
|
||
| echo "HADDOCK3 Job Complete" | ||
| echo "Completed at: $(date)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still pointing to https://github.com/Comp-era/HADDOCK3-Container - if we make it part of the haddock3 repo, we should rather point to the local haddock3 repo files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link updated with local haddock3 repo files.