-
Notifications
You must be signed in to change notification settings - Fork 55
Run AlphaPulldown Python Command Line Interface
AlphaPulldown can be used as a set of scripts for every particular step.
-
create_individual_features.py: Generates multiple sequence alignments (MSA), identifies structural templates, and stores the results in monomeric feature.pklfiles. -
run_multimer_jobs.py: Executes the prediction of structures. -
create_notebook.pyandalpha-analysis.sif: Prepares an interactive Jupyter Notebook and a Results Table, respectively.
Firstly, install Anaconda and create an AlphaPulldown environment, gathering necessary dependencies. To speed up dependency resolution, we recommend using Mamba.
conda create -n AlphaPulldown -c omnia -c bioconda -c conda-forge python==3.11 openmm==8.0 pdbfixer==1.9 kalign2 hhsuite hmmer modelcif
source activate AlphaPulldownThis usually works, but on some compute systems, users may prefer to use other versions or optimized builds of HMMER and HH-suite that are already installed.
Activate the AlphaPulldown environment and install AlphaPulldown:
source activate AlphaPulldown
python3 -m pip install alphapulldownpip install -U "jax[cuda12]"==0.5.3Note
For older versions of AlphaFold: If you haven't updated your databases according to the requirements of AlphaFold 2.3.0, you can still use AlphaPulldown with your older version of the AlphaFold database. Please follow the installation instructions on the dedicated branch.
Install CCP4 package: To install the software needed for the anaysis step, please follow these instructions:
singularity pull docker://kosinskilab/fold_analysis:latest
singularity build --sandbox <writable_image_dir> fold_analysis_latest.sif
# Download the top one from https://www.ccp4.ac.uk/download/#os=linux
tar xvzf ccp4-9.0.003-linux64.tar.gz
cd ccp4-9
cp bin/pisa bin/sc <writable_image_dir>/software/
cp -rn lib/* <writable_image_dir>/software/lib64/
singularity build <new_image.sif> <writable_image_dir>0.4. Installation for cross-link input data by AlphaLink2 (optional!)
- Make sure you have installed PyTorch corresponding to the pytorch CUDA version you have. Here we will take CUDA 11.8 and PyTorch 2.5.1 as an example:
pip3 install torch==2.5.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
Warning
Environment Requirements: AlphaLink2 uses PyTorch while AlphaFold uses JAX. While it's technically possible to have both in the same conda environment, we recommend using separate environments to avoid dependency conflicts:
- AlphaFold environment: JAX-based for standard AlphaFold predictions
- AlphaLink environment: PyTorch-based for AlphaLink2 predictions with crosslinks
This ensures optimal performance and avoids potential conflicts between the different deep learning frameworks.
-
Compile UniCore.
source activate AlphaPulldown git clone https://github.com/dptech-corp/Uni-Core.git cd Uni-Core pip3 install . # test whether unicore is successfully installed python -c "import unicore"
You may see the following warning, but it's fine:
fused_multi_tensor is not installed corrected fused_rounding is not installed corrected fused_layer_norm is not installed corrected fused_softmax is not installed corrected -
Download the PyTorch checkpoints from Zenodo, unzip it, then you should obtain a file named:
AlphaLink-Multimer_SDA_v3.pt
Only for the developers who would like to modify AlphaPulldown's codes and test their modifications. Please add your SSH key to your GitHub account
Instructions
-
Clone the GitHub repo
git clone --recurse-submodules [email protected]:KosinskiLab/AlphaPulldown.git cd AlphaPulldown git submodule init git submodule update
-
Create the Conda environment as described in Create Anaconda environment
-
Install AlphaPulldown package and add its submodules to the Conda environment (does not work if you want to update the dependencies)
source activate AlphaPulldown cd AlphaPulldown pip install -e . pip install -e AlphaLink2 --no-deps pip install -e ColabFold --no-deps pip install -e alphafold --no-deps
You need to do it only once.
-
When you want to develop, activate the environment, modify files, and the changes should be automatically recognized.
-
Test your package during development using tests in
test/, e.g.:pip install pytest pytest -s test/ pytest -s test/test_predictions_slurm.py pytest -s test/test_features_with_templates.py::TestCreateIndividualFeaturesWithTemplates::test_1a_run_features_generation
-
Before pushing to the remote or submitting a pull request:
pip install . pytest -s test/to install the package and test. Pytest for predictions only works if SLURM is available. Check the created log files in your current directory.
Note
If you work with proteins from model organisms you can directly download the features files from the AlphaPulldown Features Database and skip this step.
This is a general example of create_individual_features.py usage. For information on running specific tasks or parallel execution on a cluster, please refer to the corresponding sections of this chapter.
At this step, you need to provide a protein FASTA format file with all protein sequences that will be used for complex prediction.
Example of a FASTA file (sequences.fasta):
>proteinA
SEQUENCEOFPROTEINA
>proteinB
SEQUENCEOFPROTEINB
Activate the AlphaPulldown environment and run the script create_individual_features.py as follows:
source activate AlphaPulldown
create_individual_features.py \
--fasta_paths=<sequences.fasta> \
--data_dir=<path to alphafold databases> \
--output_dir=<dir to save the output objects> \
--max_template_date=<any date you want, format like: 2050-01-01> \- Instead of
<sequences.fasta>provide a path to your input FASTA file. You can also provide multiple comma-separated files.
- Instead of
<path to alphafold databases>provide a path to the genetic database (see 0. Alphafold-databases of the installation part).
- Instead of
<dir to save the output objects>provide a path to the output directory, where your features files will be saved.
- A date in the flag
--max_template_dateis needed to restrict the search of protein structures that are deposited before the indicated date. Unless the date is later than the date of your local genomic database's last update, the script will search for templates among all available structures.
Features calculation script create_individual_features.py has several optional FLAGS:
Full list of arguments (FLAGS):
-
--[no]save_msa_files: By default is False to save storage stage but can be changed into True. If it is set toTrue, the program will create an individual folder for each protein. The output directory will look like:output_dir |- proteinA.pkl |- proteinA |- uniref90_hits.sto |- pdb_hits.sto |- etc. |- proteinB.pkl |- proteinB |- uniref90_hits.sto |- pdb_hits.sto |- etc.If
save_msa_files=Falsethen theoutput_dirwill look like:output_dir |- proteinA.pkl |- proteinB.pkl -
--[no]use_precomputed_msas: Default value isFalse. However, if you have already had MSA files for your proteins, please set the parameter to be True and arrange your MSA files in the format as below:example_directory |- proteinA |- uniref90_hits.sto |- pdb_hits.sto |- ***.a3m |- etc |- proteinB |- ***.sto |- etcThen, in the command line, set the
output_dir=/path/to/example_directory. -
--[no]skip_existing: Default isFalsebut if you have run the 1st step already for some proteins and now add new proteins to the list, you can changeskip_existingtoTruein the command line to avoid rerunning the same procedure for the previously calculated proteins. -
--seq_index: Default isNoneand the program will run predictions one by one in the given files. However, you can setseq_indexto a different number if you wish to run an array of jobs in parallel then the program will only run the corresponding job specified by theseq_index. e.g. the program only calculates features for the 1st protein in your FASTA file ifseq_indexis set to be 1. See also the Slurm sbatch script above for an example of how to use it for parallel execution. ❗seq_indexstarts from 1. -
--[no]use_mmseqs2: Use mmseqs2 remotely or not. Default is False.
FLAGS related to TrueMultimer mode:
-
--path_to_mmt: Path to directory with multimeric template mmCIF files. -
--description_file: Path to the text file with descriptions for generating features. Please note, the first column must be an exact copy of the protein description from your FASTA files. Please consider shortening them in FASTA files using your favorite text editor for convenience. These names will be used to generate pickle files with monomeric features! The description.csv for the NS1-P85B complex should look like:
>sp|P03496|NS1_I34A1,3L4Q.cif,A
>sp|P23726|P85B_BOVIN,3L4Q.cif,C
In this example, we refer to the NS1 protein as chain A and to the P85B protein as chain C in multimeric template 3L4Q.cif.
Please note, that your template will be renamed to a PDB code taken from _entry_id. If you use a *.pdb file instead of *.cif, AlphaPulldown will first try to parse the PDB code from the file. Then it will check if the filename is 4-letter long. If it is not, it will generate a random 4-letter code and use it as the PDB code.
-
--threshold_clashes: Threshold for VDW overlap to identify clashes. The VDW overlap between two atoms is defined as the sum of their VDW radii minus the distance between their centers. If the overlap exceeds this threshold, the two atoms are considered to be clashing. A positive threshold is how far the VDW surfaces are allowed to interpenetrate before considering the atoms to be clashing. (default: 1000, i.e. no threshold, for thresholding, use 0.6-0.9). -
--hb_allowance: Additional allowance for hydrogen bonding (default: 0.4) used for identifying clashing residues to be removed from a multimeric template. An allowance > 0 reflects the observation that atoms sharing a hydrogen bond can come closer to each other than would be expected from their VDW radii. The allowance is only subtracted for pairs comprised of a donor (or donor-borne hydrogen) and an acceptor. This is equivalent to using smaller radii to characterize hydrogen-bonding interactions. -
--plddt_threshold: Threshold for pLDDT score (default: 0) to be removed from a multimeric template (all residues with pLDDT>plddt_threshold are removed and modeled from scratch). Can be used only when multimeric templates are models generated by AlphaFold. -
--new_uniclust_dir: Please use this if you want to overwrite the default path to the uniclust database. -
--[no]use_hhsearch: Use hhsearch instead of hmmsearch when looking for structure template. Default is False. -
--[no]multiple_mmts: Use multiple multimeric templates per chain. Default is False.
The result of create_individual_features.py run is pickle format features for each protein from the input FASTA file (e.g. sequence_name_A.pkl and sequence_name_B.pkl) stored in the output_dir.
Note
The name of the pickles will be the same as the descriptions of the sequences in FASTA files (e.g. >protein_A in the FASTA file will yield proteinA.pkl). Note that special symbols such as | : ; #, after > will be replaced with _.
Proceed to the next step 2.1 Basic Run.
If you run AlphaPulldown on a computer cluster, you may want to execute feature creation in parallel. Here, we provide an example of code that is suitable for a cluster that utilizes SLURM Workload Manager.
For more details about the SLURM on the EMBL cluster, please refer to the [EMBL Cluster wiki](https://wiki.embl.de/cluster/Main_Page) using the EMBL network.
For the following example, we will use example_2_sequences.fasta as input.
Create the create_individual_features_SLURM.sh script and place the following code in it using vi, nano, or any other text editor. Replace input parameters with the appropriate arguments for the create_individual_features.py script as described in Basic run or any other type of run you intend to execute:
#!/bin/bash
#A typical run takes a couple of hours but may be much longer
#SBATCH --job-name=array
#SBATCH --time=10:00:00
#log files:
#SBATCH -e logs/create_individual_features_%A_%a_err.txt
#SBATCH -o logs/create_individual_features_%A_%a_out.txt
#qos sets priority
#SBATCH --qos=normal
#Limit the run to a single node
#SBATCH -N 1
#Adjust this depending on the node
#SBATCH --ntasks=8
#SBATCH --mem=64000
module load Mamba
source activate AlphaPulldown
# CUSTOMIZE THE FOLLOWING SCRIPT PARAMETERS FOR YOUR SPECIFIC TASK:
####
create_individual_features.py \
--fasta_paths=example_1_sequences.fasta \
--data_dir=/scratch/AlphaFold_DBs/2.3.2 \
--output_dir=/scratch/mydir/test_AlphaPulldown/ \
--max_template_date=2050-01-01 \
--skip_existing=True \
--seq_index=$SLURM_ARRAY_TASK_ID
####Execute the following commands, replacing <sequences.fasta> with the path to your input FASTA file:
mkdir logs
#Count the number of jobs corresponding to the number of sequences:
count=`grep ">" <sequences.fasta> | wc -l`
#Run the job array, 100 jobs at a time:
sbatch --array=1-$count%100 create_individual_features_SLURM.shIf you have several FASTA files, use the following commands:
Example for two files (For more files, create count3, count4, etc., variables and add them to the sum of counts):
mkdir logs
#Count the number of jobs corresponding to the number of sequences:
count1=`grep ">" <sequences1.fasta> | wc -l`
count2=`grep ">" <sequences2.fasta> | wc -l`
count=$(( $count1 + $count2 ))
#Run the job array, 100 jobs at a time:
sbatch --array=1-$count%100 create_individual_features_SLURM.shProceed to the next step 2.2 Example run with SLURM (EMBL cluster).
MMseqs2 is another method for homolog search and MSA generation. It offers an alternative to the default HMMER and HHblits used by AlphaFold. The results of these different approaches might lead to slightly different protein structure predictions due to variations in the captured evolutionary information within the MSAs. AlphaPulldown supports the implementation of MMseqs2 search made by ColabFold, which also provides a web server for MSA generation, so no local installation of databases is needed.
Cite: If you use MMseqs2, please remember to cite: Mirdita M, Schütze K, Moriwaki Y, Heo L, Ovchinnikov S, Steinegger M. ColabFold: Making protein folding accessible to all. Nature Methods (2022) doi: 10.1038/s41592-022-01488-1
CAUTION: To avoid overloading the remote server, do not submit a large number of jobs simultaneously. If you want to calculate MSAs for many sequences, please use MMseqs2 locally.
To run create_individual_features.py using MMseqs2 remotely, add the --use_mmseqs2=True flag:
source activate AlphaPulldown
create_individual_features.py \
--fasta_paths=<sequences.fasta> \
--data_dir=<path to alphafold databases> \
--output_dir=<dir to save the output objects> \
--use_mmseqs2=True \
--max_template_date=<any date you want, format like: 2050-01-01> \After the script run is finished, your output_dir will look like this:
output_dir
|-proteinA.a3m
|-proteinA_env/
|-proteinA.pkl
|-proteinB.a3m
|-proteinB_env/
|-proteinB.pkl
...
Proceed to the next step 2.1 Basic Run.
AlphaPulldown does NOT provide an interface or code to run MMseqs2 locally, nor will it install MMseqs2 or any other required programs. The user must install MMseqs2, ColabFold databases, ColabFold search, and other required dependencies and run MSA alignments first. An example guide can be found on the ColabFold GitHub.
Suppose you have successfully run MMseqs2 locally using the colab_search program; it will generate an A3M file for each protein of your interest. Thus, your output_dir should look like this:
output_dir
|-0.a3m
|-1.a3m
|-2.a3m
|-3.a3m
...
These a3m files from colabfold_search are inconveniently named. Thus, we have provided a rename_colab_search_a3m.py script to help you rename all these files. Download the script from https://github.com/KosinskiLab/AlphaPulldown/blob/main/alphapulldown/scripts/rename_colab_search_a3m.py and run:
cd output_dir
python rename_colab_search_a3m.py path_to_fasta_file_you_used_as_input_for_colabfold_searchThen your output_dir will become:
output_dir
|-proteinA.a3m
|-proteinB.a3m
|-proteinC.a3m
|-proteinD.a3m
...
Here, proteinA, proteinB, etc., correspond to the names in your input FASTA file (e.g., >proteinA will give you proteinA.a3m, >proteinB will give you proteinB.a3m, etc.).
NOTE: You can also provide your own custom MSA file in
.a3mformat instead of using the files created by MMSeq2 or standard HHMER. Place appropriately named files in the output directory and use the code as follows.
After this, go back to your project directory with the original FASTA file and point to this directory in the command:
source activate AlphaPulldown
create_individual_features.py \
--fasta_paths=<sequences.fasta> \
--data_dir=<path to alphafold databases> \
--output_dir=<output_dir> \
--skip_existing=False \
--use_mmseqs2=True \
--seq_index=<any number you want or skip the flag to run all one after another>AlphaPulldown will automatically search each protein's corresponding a3m files. In the end, your output_dir will look like:
output_dir
|-proteinA.a3m
|-proteinA.pkl
|-proteinB.a3m
|-proteinB.pkl
|-proteinC.a3m
|-proteinC.pkl
...
Proceed to the next step 2.1 Basic Run.
Instead of using the default search through the PDB database for structural templates, you can provide a custom database. AlphaPulldown supports a feature called "True Multimer," which allows AlphaFold to use multi-chain structural templates during the prediction process. This can be beneficial for protein complexes where the arrangement of the chains may vary.
Details
- Prepare a FASTA File: Create a FASTA file containing all protein sequences that will be used for predictions as outlined in 1.1 Basic run.
-
Create a Template Directory: Designate a folder (e.g.,
templates) to store your custom template files in PDB or CIF format. -
Create a description file: This
description.csvfile links protein sequences to templates:
>proteinA,TMPL.cif,A
>proteinB,TMPL.cif,B
-
Column 1 (>proteinA): Must exactly match protein descriptions from your FASTA file, including the
>symbol. - Column 2 (TMPL.cif): The filename of your template structure in PDB or CIF format.
- Column 3 (A): The chain ID within the template that the query sequence corresponds to.
The result pkl files will be stored as: proteinA.TMPL.cif.A.pkl and proteinA.TMPL.cif.A.pkl.
For Multiple Templates: If you want to provide multiple templates for a single protein, add additional rows with the same protein name but different templates and chain IDs and use flag --multiple_template=True:
>proteinA,TMPL.cif,A
>proteinA,TMP2.cif,B
>proteinB,TMPL.cif,B
CAUTION: Even though you can use multiple templates for a single chain, this feature is not fully supported in AlphaPulldown yet and might bring unexpected results.
NOTE: Your template will be renamed to a PDB code taken from _entry_id. If you use a *.pdb file instead of *.cif, AlphaPulldown will first try to parse the PDB code from the file. Then it will check if the filename is 4-letter long. If it is not, it will generate a random 4-letter code and use it as the PDB code.
Tip: If you have already generated feature files (
.pkl) for protein sequences without custom templates or with the
different templates, instead of generating them once again with the new template, you can go directly to the prediction step and use templates and description.csv in combination with previously generated features. During the run, it will replace templates in the features .pkl file with the new one.
Run the following script:
create_individual_features.py \
--fasta_paths=<sequences.fasta> \
--path_to_mmt=<path to template directory> \
--description_file=<description.csv> \
--data_dir=<path to alphafold databases> \
--output_dir=<dir to save the output objects> \
--max_template_date=<any date you want, format like: 2050-01-01> \
--save_msa_files=True \
--use_precomputed_msas=True \
--skip_existing=TrueCompared to 1.1. Basic run, this example differs in:
-
--path_to_mmt=<path to template directory>: Path to yourtemplatesdirectory with custom template files in PDB or CIF format. -
--description_file=<description.csv>: Path to the description file.
Warning! Feature files generated with custom templates have the same names as standard feature files. To avoid overwriting existing feature files or skipping their generation if
--skip_existing=True, please create a separate directory to save custom features.
Pickle format features for each protein in the description.csv file stored in the output_dir.
Go to the next step 2.5. Run with custom templates (TrueMultimer).
This is a general example of run_multimer_jobs.py usage. For information on running specific tasks or parallel execution on a cluster, please refer to the corresponding sections of this chapter.
This step requires the pickle files (.pkl) generated during the first step. Additionally, you'll need to provide a list of protein combinations protein_list.txt you intend to predict.
Here's how to structure your combinations file protein_list.txt. Protein names should correspond to the names of features files (proteinA for proteinA.pkl):
Prediction of monomers:
proteinA
proteinB
proteinC,1-100
- Each line is a separate prediction.
- Lines like
proteinAwill trigger a prediction of the entire sequence. - To predict specific residue ranges (e.g., the first 100 residues of proteinC), use the format "proteinC,1-100".
Prediction of complexes:
proteinA;proteinB;proteinC
proteinB;proteinB
proteinB,4
proteinC,2;proteinA
proteinA,4,1-100;proteinB
- Use semicolons (
;) to separate protein names within a complex. - Instead of repeating the protein name for homo-oligomers, specify the number of copies after the protein's name (e.g.,
proteinB,4for a tetramer). - Combine residue ranges and homooligomer notation for specific predictions (e.g.,
proteinA,4,1-100;proteinB).
If you use --fold_backend=alphafold3, you can mix AlphaFold2 .pkl feature files with AlphaFold3 *_data.json features. To avoid confusion, always use the .json suffix for AlphaFold3 features — e.g.
proteinA;proteinB.json;RNA.json
To predict structures, activate the AlphaPulldown environment and run the script run_multimer_jobs.py as follows:
source activate AlphaPulldown
run_multimer_jobs.py \
--mode=custom \
--monomer_objects_dir=<dir that stores feature pickle files> \
--data_dir=<path to alphafold data dir>
--protein_lists=<protein_list.txt> \
--output_path=<path to output directory> \
--num_cycle=<any number e.g. 3> \
--num_predictions_per_model=1 Explanation of arguments:
- Instead of
<dir that stores feature pickle files>provide the path to the directory containing the.pklfeature files generated in the first step. The path is the same as--output_dirforcreate_individual_features.py. - Instead of
<protein_list.txt>provide the path to a text file containing a list of protein combinations to be modeled. - Instead of
<path to output directory>provide a path where subdirectories containing the final structures will be saved. - Instead of
<path to alphafold data dir>provide a path to the directory containingparamsdirectory with AlphaFold paramaters (see 0. Alphafold-databases of the installation part). Sequence and PDB databases are not needed at this stage. -
--num_cycle: specifies the number of times the AlphaFold neural network will run, using the output of one cycle as input for the next. Increasing this number may improve the quality of the final structures (especially for large complexes), but it will also increase the runtime. -
--num_predictions_per_model: Specifies the number of predictions per model. The number of predicted structures is N*5. The default value is 1, which gives 5 structures.
Note
Flag Name Differences: The two main scripts use different flag names for the same parameters:
-
run_multimer_jobs.pyuses:--data_dir,--output_path,--monomer_objects_dir,--alphalink_weight -
run_structure_prediction.pyuses:--data_directory,--output_directory,--features_directory,--data_directory(for AlphaLink weights when--fold_backend=alphalink)
AlphaLink Weights: For AlphaLink backend, --data_directory (in run_structure_prediction.py) or --alphalink_weight (in run_multimer_jobs.py) can point to either a directory containing weights files or a specific weights file (e.g., AlphaLink-Multimer_SDA_v3.pt).
Full list of arguments (FLAGS):
-
--data_dir: Path to params directory - --[no]dry_run: Report number of jobs that would be run and exit without running them. Default is False.
-
--fold_backend: Folding backend that should be used for structure prediction (default: 'alphafold'). Use 'alphalink' for AlphaLink2 predictions. -
--job_index: index of sequence in the FASTA file, starting from 1 (an integer) -
--mode: <pulldown|all_vs_all|homo-oligomer|custom>: choose the mode of running multimer jobs (default: 'pulldown') -
--models_to_relax: <None|All|Best>: Which models to relax. Default is None, meaning no model will be relaxed (default: 'None') -
--monomer_objects_dir: a list of directories where monomer objects are stored (a comma-separated list) -
--oligomer_state_file: path to oligomer state files -
--output_path: output directory where the region data is going to be stored -
--protein_lists: protein list files (a comma-separated list) -
--unifold_model_name: <multimer_af2|multimer_ft|multimer|multimer_af2_v3|multimer_af2_model45_v3>: choose unifold model structure (default: 'multimer_af2') -
--unifold_param: Path to UniFold neural network weights -
--alphalink_weight: Path to AlphaLink neural network weights (for run_multimer_jobs.py only) -
--[no]use_alphalink: Whether AlphaLink models are going to be used. Default is False (default: 'false'). Note: This flag is deprecated. Use--fold_backend=alphalinkinstead. -
--[no]use_unifold: Whether UniFold models are going to be used. Default is False (default: 'false')
alphapulldown.scripts.run_structure_prediction:
-
--[no]benchmark: Run multiple JAX model evaluations to obtain a timing that excludes the compilation time, which should be more indicative of the time required for inferencing many proteins (default: 'false') -
--[no]compress_result_pickles: Whether the result pickles are going to be gzipped. Default is False (default: 'false') -
--crosslinks: Path to crosslink information pickle for AlphaLink -
--data_directory: Path to directory containing model weights and parameters (for AlphaLink2, this should point to the AlphaLink weights file when using --fold_backend=alphalink) -
--description_file: Path to the text file with multimeric template instruction -
--desired_num_msa: A desired number of msa to pad (an integer) -
--desired_num_res: A desired number of residues to pad (an integer) -
--features_directory: Path to computed monomer features; repeat this option to specify a list of values -
--fold_backend: Folding backend that should be used for structure prediction (default: 'alphafold') -
-i,--input: Folds in format [fasta_path:number:start-stop],; repeat this option to specify a list of values -
--model_names: Names of models to use, e.g. model_2_multimer_v3 (default: all models) -
--model_preset: <monomer|monomer_casp14|monomer_ptm|multimer>: Choose preset model configuration - the monomer model, the monomer model with extra ensembling, monomer model with pTM head, or multimer model (default: 'monomer') -
--msa_depth: Number of sequences to use from the MSA (by default is taken from AF model config) (an integer) -
--[no]msa_depth_scan: Run predictions for each model with logarithmically distributed MSA depth (default: 'false') -
--[no]multimeric_template: Whether to use multimeric templates (default: 'false') -
--[no]no_pair_msa: Do not pair the MSAs when constructing multimer objects (default: 'false') -
--num_cycle: Number of recycles, defaults to 3 (default: '3') (an integer) -
--num_predictions_per_model: Number of predictions per model, defaults to 1 (default: '1') (an integer) -
-o,--output_directory: Path to output directory. Will be created if not exists -
--path_to_mmt: Path to directory with multimeric template mmCIF files -
--protein_delimiter: Delimiter for proteins of a single fold (default: '+') - `
--random_seed`: The random seed for the data pipeline. By default, this is randomly generated. Note that even if this is set, Alphafold may still not be deterministic, because processes like GPU inference are nondeterministic (an integer)
-
--[no]remove_result_pickles: Whether the result pickles are going to be removed (default: 'true') -
--[no]skip_templates: Do not use template features when modeling (default: 'false') -
--[no]use_ap_style: Change output directory to include a description of the fold as seen in previous alphapulldown versions (default: 'false') -
--[no]use_gpu_relax: Whether to run Amber relaxation on GPU. Default is True (default: 'true')
The run_multimer_jobs.py script generates a set of directories for each specified protein complex. The full structure of the output directories is the following:
<complex_name>/
<complex_name>_PAE_plot_ranked_{0,1,2,3,4}.png
ranked_{0,1,2,3,4}.pdb
ranked_{0,1,2,3,4}.cif
ranked_{0,1,2,3,4}.zip
ranking_debug.json
result_model_{1,2,3,4,5}_*.pkl
timings.json
confidence_model_{1,2,3,4,5}.json
pae_model_{1,2,3,4,5}_ptm_pred_0.json
unrelaxed_model_{1,2,3,4,5}_*.pdb
Please refer to the AlphaFold manual for more details on output files.
Key files:
-
ranked_{0,1,2,3,4}.cif: Structure files ranked from best to worst predicted quality in modelcif format. -
<complex_name>_PAE_plot_ranked_{0,1,2,3,4}.png: Plots of predicted aligned errors (PAE) providing a visual representation of the structure's confidence.
Caution
AlphaPulldown is designed for screening, so its default output doesn't relax structures. To relax the top-ranked structure (ranked_0.pdb), you can run AlphaPulldown with the --models_to_relax=Best flag, or --models_to_relax=All to relax all models.
Proceed to the next step 3. Analysis and Visualization.
The results of structure predictions can be very large. To copy the cropped output results for storage, use the truncate_pickles.py script by following the instructions provided Decrease the size of AlphaPulldown output.
Additionally, you can prepare the structures for deposition by creating .cif files containing all the necessary information about your predicted models. To do this, follow the instructions provided Convert Models from PDB Format to ModelCIF Format.
If you run AlphaPulldown on a computer cluster, you may want to execute feature creation in parallel. Here, we provide an example of code that is suitable for a cluster that utilizes SLURM Workload Manager.
Details
For this step, you need an example input file: custom_mode.txt and features (.pkl) files generated in the previous step 1.2. Example run with SLURM (EMBL cluster).
Create the run_multimer_jobs_SLURM.sh script and place the following code in it using vi, nano, or any other text editor. Replace input parameters with the appropriate arguments for the run_multimer_jobs.sh script as described in Basic run or any other type of run you intend to execute:
#!/bin/bash
#A typical run takes couple of hours but may be much longer
#SBATCH --job-name=array
#SBATCH --time=2-00:00:00
#log files:
#SBATCH -e logs/run_multimer_jobs_%A_%a_err.txt
#SBATCH -o logs/run_multimer_jobs_%A_%a_out.txt
#qos sets priority
#SBATCH --qos=low
#SBATCH -p gpu
#lower end GPUs might be sufficient for pairwise screens:
#SBATCH -C "gpu=2080Ti|gpu=3090"
#Reserve the entire GPU so no-one else slows you down
#SBATCH --gres=gpu:1
#Limit the run to a single node
#SBATCH -N 1
#Adjust this depending on the node
#SBATCH --ntasks=8
#SBATCH --mem=64000
module load Mamba
source activate AlphaPulldown
MAXRAM=$(echo `ulimit -m` '/ 1024.0'|bc)
GPUMEM=`nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits|tail -1`
export XLA_PYTHON_CLIENT_MEM_FRACTION=`echo "scale=3;$MAXRAM / $GPUMEM"|bc`
export TF_FORCE_UNIFIED_MEMORY='1'
# CUSTOMIZE THE FOLLOWING SCRIPT PARAMETERS FOR YOUR SPECIFIC TASK:
####
run_multimer_jobs.py \
--mode=custom \
--monomer_objects_dir=<dir that stores feature pickle files> \
--protein_lists=<protein_list.txt> \
--output_path=<path to output directory> \
--num_cycle=<any number e.g. 3> \
--data_dir=/scratch/AlphaFold_DBs/2.3.2/ \
--num_predictions_per_model=1 \
--job_index=$SLURM_ARRAY_TASK_ID
####Make the script executable by running:
chmod +x run_multimer_jobs_SLURM.shNext, for custom mode, execute the following commands, replacing <protein_list.txt> with the path to your protein combinations file:
mkdir -p logs
#Count the number of jobs corresponding to the number of sequences:
count=`grep -c "" <protein_list.txt>` #count lines even if the last one has no end of line
sbatch --array=1-$count example_data/run_multimer_jobs_SLURM.shFor pulldown mode for two files (for more files, create count3, count4, etc. variables and add them as a multiplier to the product):
mkdir -p logs
#Count the number of jobs corresponding to the number of sequences:
count1=`grep -c "" <protein_list1.txt>` #count lines even if the last one has no end of line
count2=`grep -c "" <protein_list2.txt>` #count lines even if the last one has no end of line
count=$(( $count1 * $count2 ))
sbatch --array=1-$count example_data/run_multimer_jobs_SLURM.shFor all_vs_all mode:
mkdir -p logs
#Count the number of jobs corresponding to the number of sequences:
count1=`grep -c "" <protein_list.txt>` #count lines even if the last one has no end of line
count=$(( $count1 * ( $count1 + 1) / 2 ))
sbatch --array=1-$count example_data/run_multimer_jobs_SLURM.shThe output and next step are the same as those for the 2.1. Basic Run.
Instead of manually typing all combinations of proteins, AlphaPulldown provides two different modes of automatic generation of such combinations.
This mode allows providing two or more lists of proteins that will generate all combinations of proteins from one list with all proteins from another list. If you want to emulate in silico pulldown of some hypothetical proteinA bait against proteins B-G you can use two protein_list.txt files:
The first protein_list1.txt:
proteinA
The second protein_list2.txt:
proteinB
proteinC
proteinD
proteinE
proteinF
proteinG
This results in the following combinations of proteins: A-B, A-C, A-D, A-E, A-F, A-G.
You can add a third protein_list3.txt:
proteinX
proteinZ
The resulting models will contain proteins A-B-X, A-B-Z, A-C-X, A-C-Z...
In fact, you can provide as many files as you wish, the number of combinations you will receive is the product of numbers of lines in the input files.
Lines in the files do not necessarily have to be single proteins. Input files follow the same rules as described for 2.1 Basic run. It can contain several protein names, indicate a number of oligomers, and have residue ranges.
To run run_multimer_jobs.py in pulldown mode, use the following script:
run_multimer_jobs.py \
--mode=pulldown \
--monomer_objects_dir=<dir that stores feature pickle files> \
--protein_lists=<protein_list1.txt>,<protein_list2.txt> \
--output_path=<path to output directory> \
--data_dir=<path to AlphaFold data directory> \
--num_cycle=<any number e.g. 3> Compared to 2.1 Basic run, this example differs in:
-
--mode=pulldownflag that defines the mode of the run. - Instead of
<protein_list1.txt>,<protein_list2.txt>, provide the paths to the files containing the list of protein combinations to be modeled.
In this mode, AlphaPulldown takes lines from the input protein_list.txt file and generates all possible combinations of these lines.
It is useful when you have a set of proteins, and you want to find out which interact with which.
proteinA
proteinB
proteinC
proteinD
proteinE
The resulting models will be all possible combinations of proteins A-A, A-B, A-C, A-D, A-E, B-B, B-C, B-D, B-E, C-C, C-D...
[!Caution] The number of predictions rapidly increases with the number of lines in the input
protein_list.txt.
Lines in files should not necessarily be single proteins. Input files follow the same rules as described for 2.1 Basic run. It can contain several protein names, indicate a number of oligomers, and have residue ranges.
To run run_multimer_jobs.py in all_vs_all mode, use the following script:
run_multimer_jobs.py \
--mode=all_vs_all \
--monomer_objects_dir=<dir that stores feature pickle files> \
--protein_lists=<protein_list.txt> \
--output_path=<path to output directory> \
--data_dir=<path to AlphaFold data directory> \
--num_cycle=<any number e.g. 3>Compared to 2.1 Basic run, this example differs in:
-
--mode=all_vs_allflag that defines the mode of the run.
The output and next step are the same as those for the 2.1. Basic Run.
If you have some experimental models you want to integrate into AlphaFold pipeline to guide the modeling, you can do so using custom multimeric databases created on the fly.
This step requires the feature files (.pkl) generated with custom templates during the first step. Additionally, you'll need to provide a list of protein combinations in protein_list.txt that you intend to predict.
Run the script run_multimer_jobs.py as described in the 2.1. Basic Run but with the flag --multimeric_template=True.
[!Note] To increase the impact of the custom templates on the final prediction (making the model more similar to the template), you can decrease the influence of the MSA by specifying the MSA depth with the
--msa_depth=<number>flag.
Alternatively, if you haven't generated feature files with a custom template but have feature files from the 1.1. Basic Run or features with different templates, you can provide those feature files in combination with the templates directory containing custom templates and description.csv as outlined in 1.4. Run with Custom Templates (TrueMultimer). Then templates will be taken from the provided template files and rewritten in the features .pkl files on-the-fly, whereas the MSA features will be taken directly from the original features files.
[!Warning] This mode is faster, but less accurate and works only if sequences of templates are nearly identical to the query sequence. It is recommended to use this mode only if you know what you do.
To run the script run_multimer_jobs.py in the fast mode you need to specify features, new templates, and a description file by adding the following flags:
-
--path_to_mmt=<path to template directory>: Path to your templates directory with custom template files in PDB or CIF format. Same as for 1.4. Run with Custom Templates (TrueMultimer) -
--description_file=<description.csv>: Path to the description file. Same as for 1.4. Run with Custom Templates (TrueMultimer) --multimeric_template=True
The output and next step are the same as those for the 2.1. Basic Run.
As Stahl et al., 2024 showed, integrating cross-link data with AlphaFold could improve the modelling quality in some challenging cases. Thus, AlphaPulldown has integrated the AlphaLink2 pipeline, allowing users to combine cross-link data with AlphaFold Multimer inference without needing to calculate MSAs from scratch again.
Cite: If you use AlphaLink2, please remember to cite: Stahl, K., Warneke, R., Demann, L. et al. Modelling protein complexes with crosslinking mass spectrometry and deep learning. Nat Commun 15, 7866 (2024). https://doi.org/10.1038/s41467-024-51771-2
Before using, install AlphaLink2 as described here.
Important: AlphaLink2 requires a PyTorch-based environment, which is different from the JAX-based environment used for AlphaFold. Make sure you have installed AlphaLink2 in the correct environment as described in the installation section.
Besides features (.pkl) files generated in the 1.1. Basic Run you need to prepare cross-link input data:
As instructed by AlphaLink2, information of cross-linked residues between 2 proteins, inter-protein crosslinks A->B 1,50 and 30,80 and an FDR=20%, should look like:
{'proteinA': {'proteinB': [(1, 50, 0.2), (30, 80, 0.2)]}}
and intra-protein crosslinks follow the same format:
{'proteinA': {'proteinA': [(5, 20, 0.2)]}}
The keys in these dictionaries should be the same as your pickle files created in the first step of AlphaPulldown. For example, you should have proteinA.pkl and proteinB.pkl already calculated.
Dictionaries like these should be stored in .pkl.gz files and provided to AlphaPulldown in the next step. You can use the script from AlphaLink2 to prepare these pickle files.
Warning! The dictionaries are 0-indexed, i.e., residues start from 0.
Within the same conda environment, run in e.g. custom mode:
Recommended approach (using --fold_backend):
Option 1: Point to directory containing weights files
run_multimer_jobs.py --mode=custom \
--num_predictions_per_model=1 \
--output_path=/scratch/user/output/models \
--data_dir=/scratch/AlphaFold_DBs/2.3.2/ \
--protein_lists=custom.txt \
--monomer_objects_dir=/scratch/user/output/features \
--job_index=$SLURM_ARRAY_TASK_ID \
--fold_backend=alphalink \
--alphalink_weight=/scratch/AlphaFold_DBs/alphalink_weights/ \
--crosslinks=/path/to/crosslinks.pkl.gz Option 2: Point directly to weights file
run_multimer_jobs.py --mode=custom \
--num_predictions_per_model=1 \
--output_path=/scratch/user/output/models \
--data_dir=/scratch/AlphaFold_DBs/2.3.2/ \
--protein_lists=custom.txt \
--monomer_objects_dir=/scratch/user/output/features \
--job_index=$SLURM_ARRAY_TASK_ID \
--fold_backend=alphalink \
--alphalink_weight=/scratch/AlphaFold_DBs/alphalink_weights/AlphaLink-Multimer_SDA_v3.pt \
--crosslinks=/path/to/crosslinks.pkl.gz Alternative approach (using deprecated flags):
run_multimer_jobs.py --mode=custom \
--num_predictions_per_model=1 \
--output_path=/scratch/scratch/user/output/models \
--data_dir=/g/alphafold/AlphaFold_DBs/2.3.0/ \
--protein_lists=custom.txt \
--monomer_objects_dir=/scratch/user/output/features \
--job_index=$SLURM_ARRAY_TASK_ID \
--use_alphalink=True \
--alphalink_weight=/scratch/AlphaFold_DBs/alphalink_weights/AlphaLink-Multimer_SDA_v3.pt \
--crosslinks=/path/to/crosslinks.pkl.gz The other modes provided by AlphaPulldown also work in the same way.
Note: If you want to use run_structure_prediction.py directly with AlphaLink2, use this format:
Option 1: Point to directory containing weights files
run_structure_prediction.py \
--input="proteinA:1:1-100+proteinB:1:1-150" \
--output_directory=/scratch/user/output/models \
--data_directory=/scratch/AlphaFold_DBs/alphalink_weights/ \
--features_directory=/scratch/user/output/features \
--fold_backend=alphalink \
--crosslinks=/path/to/crosslinks.pkl.gzOption 2: Point directly to weights file
run_structure_prediction.py \
--input="proteinA:1:1-100+proteinB:1:1-150" \
--output_directory=/scratch/user/output/models \
--data_directory=/scratch/AlphaFold_DBs/alphalink_weights/AlphaLink-Multimer_SDA_v3.pt \
--features_directory=/scratch/user/output/features \
--fold_backend=alphalink \
--crosslinks=/path/to/crosslinks.pkl.gz[!NOTE] AlphaLink Weights: When using AlphaLink backend, the
--data_directory(forrun_structure_prediction.py) or--alphalink_weight(forrun_multimer_jobs.py) parameter can point to either:
- A directory containing AlphaLink weights files (e.g.,
/path/to/alphalink_weights/containingAlphaLink-Multimer_SDA_v?.pt)- A specific AlphaLink weights file (e.g.,
/path/to/AlphaLink-Multimer_SDA_v3.pt)The backend will automatically search for expected weights files (
AlphaLink-Multimer_SDA_v2.ptorAlphaLink-Multimer_SDA_v3.pt) in the directory if a directory is provided.
The output and next step are the same as those for the 2.1. Basic Run.
The resulting predictions from the step 2 can be used directly as they are. However, for evaluation systematization and ranking of the prediction, you can use an interactive Jupyter Notebook and/or table with models scores.
Go to the model's output directory from the step 2.
cd <models_output_dir>And run the script in the activated conda environment:
source activate AlphaPulldown
create_notebook.py --cutoff=5.0 --output_dir=<models_output_dir>-
--cutoff: check the value of PAE between chains. In the case of multimers, the analysis program will create the notebook only from models with inter-chain PAE values smaller than the cutoff. Increase this parameter if you miss predictions in your notebook (e.g., 50). -
--output_dir: Directory where predicted models are stored in this,.in this example. -
--pae_figsize: Figsize of pae_plot, default is 50.
This command will generate an output.ipynb, which you can open using JupyterLab. JupyterLab is installed with AlphaPulldown. To view the notebook, launch it with:
jupyter-lab output.ipynbFor usage of the Jupyter Notebook, refer to the Downstream analysis section of this manual.
Making a CSV table with structural properties and scores requires the download of the singularity image fold_analysis.sif. Please refer to the installation instruction.
To execute the singularity image (i.e. the sif file) run:
singularity exec \
--no-home \
--bind </path/to/output/dir/with/predictions>:/mnt \
<path to your downloaded image>/fold_analysis.sif \
run_get_good_pae.sh \
--output_dir=/mnt \
--cutoff=10cutoff is to check the value of PAE between chains. In the case of multimers, the analysis program will create the notebook only from models with inter-chain PAE values smaller than the cutoff. If you do not want to filter out the models use very high cutoff e.g. --cutoff=100.
For usage of the Results table, refer to the Downstream analysis section of this manual.