Skip to content

AlphaFold

AlphaFold is an application for predicting models of protein structures.

AlphaFold is available as a Singularity container on Apocrita.

Usage

AlphaFold requires a suite of supporting tools to be installed, so for reproducibility, we provide all of the tools in a container along with AlphaFold.

To run the default version of Alphafold, simply load the alphafold module:

module load alphafold

Calling alphafold python after loading the alphafold module will invoke the installed version of Python inside the container. Additionally, this entry point will automatically use any requested GPU cards

Example job

GPU job

To run Alphafold from the container, we prepare a job script called alpha.qsub:

#$ -cwd
#$ -j y
#$ -pe smp 8                   # 8 cores per GPU
#$ -l h_rt=240:0:0             # 240 hours runtime
#$ -l h_vmem=11G               # 11G RAM per core
#$ -l gpu=1                    # AlphaFold only uses 1 GPU
#$ -l gpu_type="volta|ampere"  # Avoid kepler GPUs
# Approved DERI users can include the following line
#$ -l cluster=andrena

# Specify an output destination.
export OUTPUT=/data/scratch/${USER}/alphafold_out

module load alphafold

alphafold ${HOME}/alphafold_scripts/run.sh \
  --fasta_paths=${HOME}/alphafold_input/T1050.fasta

The example uses scratch storage for output, although shared project storage may be used if you have access to any.

Since there are a lot of configuration options, the options that are less likely to change are stored in a separate script called run.sh:

#!/bin/bash

# Set the destination of the AlphaFold dataset
DOWNLOAD_DIR=/data/DERI-DataSets/AlphaFold

# Recommended settings for use with Alphafold
export TF_FORCE_UNIFIED_MEMORY=1
export XLA_PYTHON_CLIENT_MEM_FRACTION=4.0

# Options for Alphafold
cd /app/alphafold
python run_alphafold.py \
   --data_dir=${DOWNLOAD_DIR} \
   --uniref90_database_path=${DOWNLOAD_DIR}/uniref90/uniref90.fasta \
   --mgnify_database_path=${DOWNLOAD_DIR}/mgnify/mgy_clusters_2018_12.fa \
   --bfd_database_path=${DOWNLOAD_DIR}/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
   --uniclust30_database_path=${DOWNLOAD_DIR}/uniclust30/uniclust30_2018_08/uniclust30_2018_08 \
   --pdb70_database_path=${DOWNLOAD_DIR}/pdb70/pdb70 \
   --template_mmcif_dir=${DOWNLOAD_DIR}/pdb_mmcif/mmcif_files \
   --obsolete_pdbs_path=${DOWNLOAD_DIR}/pdb_mmcif/obsolete.dat \
   --output_dir=${OUTPUT} \
   --preset=casp14 \
   --benchmark=False \
   --model_names=model_1,model_2,model_3,model_4,model_5 \
   --max_template_date=2020-05-14 \
   $@

You can either take a copy of this file from /data/containers/alphafold/run.sh or make your own (ensuring that the script has execute permissions with chmod +x /path/to/run.sh). The job script expects your copy to be found at ${HOME}/alphafold_scripts/run.sh. Depending on your workflow, you may wish to use multiple instances of run.sh, or move some options into the job script instead, as shown by the fasta_paths option, for example.

The ${DOWNLOAD_DIR} path will not need to change. This is a 2TB dataset required to make AlphaFold work.

Input data

You will need some input data for the job. In the above example, T1050.fasta was downloaded from the Protein Structure Prediction Center and stored in the ${HOME}/alphafold_input directory.

Running the job

Check that the job script correctly specifies the output location, any input files and location of the run.sh file. Then submit the job. In the above example, this is done with qsub alpha.qsub.

The $@ bash operator at the end of the run.sh script enables specifying the additional options in alpha.qsub file, so be sure to keep that line in.

The AlphaFold processing workflow will run tasks on the CPU, followed by bursts of intensive GPU activity. For the above example, running on an A100 GPU completes in around 4 hours, and around 5.5 hours on a V100 GPU. The Kepler GPUs have insufficient RAM to run AlphaFold.

Visualising results

The example job produces the following output in /data/scratch/${USER}/alphafold_out/T1050:

$ ls /data/scratch/${USER}/alphafold_out/T1050
features.pkl         ranked_1.pdb        ranked_4.pdb          relaxed_model_2.pdb
relaxed_model_5.pdb  result_model_3.pkl  timings.json          unrelaxed_model_3.pdb
msas                 ranked_2.pdb        ranking_debug.json    relaxed_model_3.pdb
result_model_1.pkl   result_model_4.pkl  unrelaxed_model_1.pdb unrelaxed_model_4.pdb
ranked_0.pdb         ranked_3.pdb        relaxed_model_1.pdb   relaxed_model_4.pdb
result_model_2.pkl   result_model_5.pkl  unrelaxed_model_2.pdb unrelaxed_model_5.pdb

If you download the pdb output files to your local machine, you can visualise them using the NCBI Web-based 3D Structure Viewer, or you can use another tools such as pymol if you have a licence.

AlphaFold visualisation

References