Description

Open source code for AlphaFold

Software Category: bio

For detailed information, visit the AlphaFold website.

Available Versions

The current installation of AlphaFold incorporates the most popular packages. To find the available versions and learn how to load them, run:

module spider alphafold

The output of the command shows the available AlphaFold module versions.

For detailed information about a particular AlphaFold module, including how to load the module, run the module spider command with the module’s full version label. For example:

module spider alphafold/2.3.0
ModuleVersion Module Load Command
alphafold2.3.0 module load apptainer/1.2.2 alphafold/2.3.0

AlphaFold Installation Details

Dockerfile

We prepared a Docker image based on the official Dockerfile with some modifications.

  • AlphaFold does not use TensorFlow on the GPU (instead it uses JAX). See issue. Changed tensorflow to tensorflow-cpu.
  • There is no need to have system CUDA libraries since they are already included in the conda environment.
  • Switched to micromamba instead of Miniconda.

With a three-stage build, our Docker image is only 5.4 GB on disk (2.1 GB compressed on DockerHub), almost half the size using the official Dockerfile (10.1 GB).

For further details see here.

AlphaFold launch command

Please refer to run_alphafold.py for all available options.

Launch script run

For your convenience, we have prepared a launch script run that takes care of the Apptainer command and the database paths, since these are unlikely to change. If you do need to customize anything please use the full Apptainer command.

Explanation of Apptainer flags

  1. The database and models are stored in $ALPHAFOLD_DATA_PATH.
  2. A cache file ld.so.cache will be written to /etc, which is not allowed on Rivanna. The workaround is to bind-mount e.g. the current working directory to /etc inside the container. [-B .:/etc]
  3. You must launch AlphaFold from /app/alphafold inside the container due to this issue. [--pwd /app/alphafold]
  4. The --nv flag enables GPU support.

Explanation of AlphaFold flags

  1. The default command of the container is /app/run_alphafold.sh.
  2. As a consequence of the Apptainer --pwd flag, the fasta and output paths must be full paths (e.g. /scratch/$USER/mydir, not relative paths (e.g. ./mydir). You may use $PWD as demonstrated.
  3. The max_template_date is of the form YYYY-MM-DD.
  4. Only the database paths in mark_flags_as_required of run_alphafold.py are included because the optional paths depend on db_preset (full_dbs or reduced_dbs) and model_preset.

Slurm Script

Below are some Slurm script templates for version 2.3.

Monomer with full_dbs

#!/bin/bash
#SBATCH -A mygroup      # your allocation account
#SBATCH -p gpu          # partition
#SBATCH --gres=gpu:1    # number of GPUs
#SBATCH -C "v100|a100"  # request a V100 or A100 GPU
#SBATCH -N 1            # number of nodes
#SBATCH -c 8            # number of cores
#SBATCH -t 10:00:00     # time

module purge
module load apptainer alphafold

run --fasta_paths=$PWD/your_fasta_file \
    --output_dir=$PWD/outdir \
    --model_preset=monomer \
    --db_preset=full_dbs \
    --bfd_database_path=/data/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
    --pdb70_database_path=/data/pdb70/pdb70 \
    --uniref30_database_path=/data/uniref30/UniRef30_2021_03 \
    --max_template_date=YYYY-MM-DD \
    --use_gpu_relax=True

Multimer with reduced_dbs

#!/bin/bash
#SBATCH -A mygroup      # your allocation account
#SBATCH -p gpu          # partition
#SBATCH --gres=gpu:1    # number of GPUs
#SBATCH -C "v100|a100"  # request a V100 or A100 GPU
#SBATCH -N 1            # number of nodes
#SBATCH -c 8            # number of cores
#SBATCH -t 10:00:00     # time

module purge
module load apptainer alphafold

run --fasta_paths=$PWD/your_fasta_file \
    --output_dir=$PWD/outdir \
    --model_preset=multimer \
    --db_preset=reduced_dbs \
    --pdb_seqres_database_path=/data/pdb_seqres/pdb_seqres.txt \
    --uniprot_database_path=/data/uniprot/uniprot.fasta \
    --small_bfd_database_path=/data/small_bfd/bfd-first_non_consensus_sequences.fasta \
    --max_template_date=YYYY-MM-DD \
    --use_gpu_relax=True

Notes

  1. Before upgrading to a newer version, please always check the official repo for details, especially on any changes to the parameters, databases, and flags.

  2. You may need to request 8 CPU cores due to this line printed in the output:

    Launching subprocess "/usr/bin/jackhmmer -o /dev/null -A /tmp/tmpys2ocad8/output.sto --noali --F1 0.0005 --F2 5e-05 --F3 5e-07 --incE 0.0001 -E 0.0001 --cpu 8 -N 1 ./seq.fasta /share/resources/data/alphafold/mgnify/mgy_clusters.fa"
    
  3. You must provide a value for --max_template_date. If you are predicting the structure of a protein that is already in PDB and you wish to avoid using it as a template, then max_template_date must be set to be before the release date of the structure. If you do not need to specify a date, by default you can set today’s date. For example, if you are running the simulation on August 7th 2021, set -–max_template_date = 2021-08-07. See here.

  4. You are not required to use the run wrapper script. You can always provide the full apptainer command.