-
Notifications
You must be signed in to change notification settings - 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 1 commit
fa0d2b3
0d4fb11
5efc144
e6e5c4f
71cdc53
22b587b
ee40aa8
4db7273
0fdbde8
32a9402
6a55cb6
dcae9eb
543d56e
7fc1c39
30c3f95
8955a05
31c2ed6
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,18 @@ | ||
| ## What I Love to See | ||
|
|
||
| We're not just building containers—we're crafting efficient, elegant tools for science. If you're looking for ways to make a difference, consider contributing to: | ||
|
|
||
| - **New functionalities** (e.g., new features or support) | ||
| - **Reducing redundancy** in scripts or layered installs | ||
| - **Shrinking image size** by stripping unused packages or optimizing layers | ||
| - **Lowering computational/carbon footprint** through performance tweaks or ecoconscious configurations (smaller images) | ||
|
|
||
| ## Ideas Welcome — Let’s Connect! | ||
|
|
||
| Have a suggestion? Want to extend functionality, reduce image size, or make this container even more efficient and elegant? I'm all ears. | ||
|
|
||
| Feel free to: | ||
| - Open an [issue](https://github.com/Comp-era/Apptainer-Container-for-HADDOCK3/issues) | ||
| - Start a discussion | ||
| - Or reach out directly ([email protected]), collaboration is always welcome. | ||
|
|
Comp-era marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Shantanu Khatri | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| # Container workflow for HADDOCK3 | ||
|
|
||
| This repository provides everything you need to build, run, and extend an **Apptainer/Singularity** container for HADDOCK3. [**HADDOCK3**](https://www.biorxiv.org/content/10.1101/2025.04.30.651432v1)(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. | ||
Comp-era marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| A ready-to-use Docker image for HADDOCK3 is published on the GitHub container registry, simply pull: | ||
| ```bash | ||
| docker pull ghcr.io/haddocking/haddock3:2025.5.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.5.0 | ||
|
|
||
| # Or, build with Singularity | ||
| singularity build haddock3_mpi.sif docker://ghcr.io/haddocking/haddock3:2025.5.0 | ||
| ``` | ||
| **Note:** Refer to the [**usage.md**](https://github.com/Comp-era/HADDOCK3-Container/blob/main/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 | ||
|
Member
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. 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.
Author
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. Link updated with local haddock3 repo files. |
||
| 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/Comp-era/HADDOCK3-Container.git | ||
| cd HADDOCK3-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 | ||
| ├── LICENSE # MIT License | ||
| ├── README.md # Overview | ||
| └── CONTRIBUTING.md # Contribution guidelines | ||
| ``` | ||
|
|
||
| 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/Comp-era/HADDOCK3-Container/tree/main/recipe)) directory. | ||
|
|
||
| ```bash | ||
| # Apptainer | ||
| apptainer build haddock3_mpi.sif haddock3_mpi.def | ||
| # Singularity | ||
| singularity build haddock3_mpi.sif haddock3_mpi.def | ||
rvhonorato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| **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 | ||
| ``` | ||
|
|
||
|
|
||
| 4. **Download a pre-built image** | ||
|
|
||
| You can also pull the pre-built apptainer image I created directly from GitHub’s container registry using the ORAS protocol: | ||
|
|
||
| ```bash | ||
| apptainer pull oras://ghcr.io/comp-era/haddock3:2025.06-v1.0-haddock3-mpi | ||
| ``` | ||
| --- | ||
|
|
||
| ## 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) | ||
rvhonorato marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
|
|
||
| ## Documentation | ||
|
|
||
| See the `docs/` folder: | ||
|
|
||
| - [**usage.md**](https://github.com/Comp-era/HADDOCK3-Container/blob/main/docs/usage.md) – Detailed usage and instructions to run Apptainer. | ||
|
|
||
| --- | ||
|
|
||
| ## Contributing | ||
|
|
||
| Kindly refer to [CONTRIBUTING.md](CONTRIBUTING.md) , for contributions. | ||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| ## License | ||
|
|
||
| MIT License © 2025 Shantanu Khatri. | ||
|
|
||
| --- | ||
|
|
||
| *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 \ | ||
|
Member
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?
Author
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. Required changes have been incorporated. The documentation now clarifies that the number of CPUs can be adjusted dynamically through the SLURM command and does not require rebuilding the container. Also added relevant information pertaining to usage of the container. |
||
| --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 | ||
rvhonorato marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| *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: `haddock-mpi-gpt.sif` | ||
| - `.cfg` configuration file for HADDOCK3 | ||
rvhonorato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
Member
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. Is this the minimal set of dependencies?
Author
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. These are the minimal set of dependencies to build and run 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 | ||
rvhonorato marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| %runscript | ||
| echo "Welcome to the MPI-ready HADDOCK3 container." | ||
| exec "$@" | ||
Comp-era marked this conversation as resolved.
Show resolved
Hide resolved
|
| 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 | ||
| 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)" |
Uh oh!
There was an error while loading. Please reload this page.