#!/bin/bash
#
# An example script of an AF2Complex run to predict interactions between two
# complexes, H1065 and H1072 from examples 1 and 2. Because these two complexes
# do not interact, the output should be two clusters of proteins. Here, we only
# evaluate the interface score between these two complexes, and the
# resulting interface score should be zero or very close to this value.
#
# This example is useful for designing PPI screening, i.e., given a query complex
# target, screening against a library complex entry.


# You need to take care of these two items, which are dependent on your installation.
# 1) activate your conda environment for AlphaFold if you use conda
# . load_alphafold
# 2) change this to point to alphafold's deep learning model parameter directory
DATA_DIR=$IDEAS/af2c/data

### input targets
target_lst_file=targets/example3.lst  # a list of target with stoichiometry
fea_dir=af2c_fea   # input feature pickle files of individual monomers under $inp_dir/$monomer
out_dir=af2c_mod # model output files will be under $out_dir/$target

### run preset, note this is different from model_preset defined below
### This preset defined the number of recycles, ensembles, MSA cluster sizes (for monomer_ptm models)
preset=economy # up to 3 recycles, 1 ensemble.

### Choose neural network model(s) from ['model_1/2/3/4/5_multimer_v3', 'model_1/2/3/4/5_multimer_v2', or 'model_1/2/3/4/5_ptm']
# Using AF2 multimer model released in alphafold2 version 2.3.1
model=model_1_multimer_v3

### Choose model_preset from: ['monomer_ptm', 'multimer', 'multimer_np']
# Notes:
#   - monomer_ptm: applying original AF monomer DL model with the capability of predicting TM-score
#   - multimer_np: apply multimer DL model to assembled monomer features (various MSA pairing modes, default is unpaired)
#   - multimer: apply multimer DL model to paired MSA pre-generated by AlphaFold-Multimer's official data pipeline
#
#   You must specify approriate model names compatible with the model preset you choose.
#   E.g., mnomer_ptm for model_x_ptm, and multimer_np for model_x_multimer_v3
model_preset=multimer_np

recycling_setting=1   # output metrics but not saving pdb files during intermediate recycles

echo "Info: input feature directory is $fea_dir"
echo "Info: result output directory is $out_dir"
echo "Info: model preset is $model_preset"

# AF2Complex source code directory
af_dir=../src


python -u $af_dir/run_af2c_mod.py --target_lst_path=$target_lst_file \
  --data_dir=$DATA_DIR --output_dir=$out_dir --feature_dir=$fea_dir \
  --model_names=$model \
  --preset=$preset \
  --model_preset=$model_preset \
  --save_recycled=$recycling_setting
