Skip to content

Commit

Permalink
add slurm scripts, update sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuricho committed Feb 18, 2023
1 parent 2b651eb commit 8aeebbf
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
*.slurm
4 changes: 2 additions & 2 deletions alphafold/model/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
# Internal import (7716).


def get_model_haiku_params(model_name: str, data_dir: str) -> hk.Params:
def get_model_haiku_params(model_name: str, parameter_path: str) -> hk.Params:
"""Get the Haiku parameters from a model name."""

path = os.path.join(data_dir, 'params', f'params_{model_name}.npz')
path = os.path.join(parameter_path, f'params_{model_name}.npz')

with open(path, 'rb') as f:
params = np.load(io.BytesIO(f.read()), allow_pickle=False)
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions run_alphafold.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
'separated by commas. All FASTA paths must have a unique basename as the '
'basename is used to name the output directories for each prediction.')
flags.DEFINE_list('model_names', None, 'Names of models to use.')
flags.DEFINE_string('data_dir', None, 'Path to directory of supporting data.')
flags.DEFINE_string('parameter_path', None, 'Path to directory of supporting data.')
flags.DEFINE_string('output_dir', None, 'Path to a directory that will '
'store the results.')
flags.DEFINE_string('jackhmmer_binary_path', shutil.which('jackhmmer'),
Expand Down Expand Up @@ -389,7 +389,7 @@ def main(argv):
model_config.model.num_recycle = FLAGS.recycling
model_config.data.common.num_recycle = FLAGS.recycling
model_params = data.get_model_haiku_params(
model_name=model_name, data_dir=FLAGS.data_dir)
model_name=model_name, parameter_path=FLAGS.parameter_path)
model_runner = model.RunModel(model_config, model_params)
for i in range(num_predictions_per_model):
model_runners[f'{model_name}_pred_{i}'] = model_runner
Expand Down Expand Up @@ -433,7 +433,7 @@ def main(argv):
flags.mark_flags_as_required([
'fasta_paths',
'output_dir',
'data_dir',
'parameter_path',
'uniref90_database_path',
'mgnify_database_path',
'template_mmcif_dir',
Expand Down
3 changes: 2 additions & 1 deletion run_alphafold.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ export TF_FORCE_UNIFIED_MEMORY='1'
export XLA_PYTHON_CLIENT_MEM_FRACTION='4.0'

# Path and user config (change me if required)
parameter_path="$data_dir/params/2.2"
bfd_database_path="$data_dir/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt"
small_bfd_database_path="$data_dir/small_bfd/bfd-first_non_consensus_sequences.fasta"
mgnify_database_path="$data_dir/mgnify/mgy_clusters_2018_12.fa"
Expand Down Expand Up @@ -214,7 +215,7 @@ fi
python $alphafold_script \
--fasta_paths=$fasta_path \
--model_names=$model_selection \
--data_dir=$data_dir \
--parameter_path=$parameter_path \
--output_dir=$output_dir \
--jackhmmer_binary_path=$jackhmmer_binary_path \
--hhblits_binary_path=$hhblits_binary_path \
Expand Down
24 changes: 24 additions & 0 deletions sub_alphafold.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#SBATCH --job-name=GA98
#SBATCH --partition=a100
#SBATCH -N 1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --gres=gpu:1
#SBATCH --output=task_file/%x_%j.out
#SBATCH --error=task_file/%x_%j.err

module purge
module load miniconda3
source activate parafold

./run_alphafold.sh \
-d data \
-o output \
-p monomer_ptm \
-u 0 \
-i \
input/mono_set_1/GA98.fasta \
-t 2020-01-01 \
-r best

25 changes: 25 additions & 0 deletions sub_alphafold_multimer.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
#SBATCH --job-name=complex_benchmark
#SBATCH --partition=a100
#SBATCH -N 1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --gres=gpu:2
#SBATCH --output=task_file/%x_%j.out
#SBATCH --error=task_file/%x_%j.err

module purge
module load miniconda3
source activate parafold

./run_alphafold.sh \
-d data \
-o output \
-p multimer \
-m model_1_multimer_v3,model_2_multimer_v3,model_3_multimer_v3,model_4_multimer_v3,model_5_multimer_v3 \
-u 0,1 \
-i \
input/complex_benchmark/MHC_TCR.fasta \
-t 2022-01-01 \
-r none

17 changes: 17 additions & 0 deletions tools/batch_scripts/template_alphafold.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#SBATCH --job-name=A501_001
#SBATCH --partition=dgx2
##SBATCH -w vol08
#SBATCH -N 1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=6
#SBATCH --gres=gpu:1
#SBATCH --output=task_file/%x_%j.out
#SBATCH --error=task_file/%x_%j.err

module load cuda/10.1.243-gcc-8.3.0
module load miniconda3
source activate alphafold_cuda10
cd /lustre/home/acct-stu/stu/deepocean
/lustre/home/acct-stu/stu/parallelfold/run_alphafold.sh -d /lustre/home/acct-stu/stu/parallelfold/data -o A501_result -m model_1,model_2 -f A501_seq/${SLURM_JOB_NAME}.fasta -t 2021-07-27

17 changes: 17 additions & 0 deletions tools/batch_scripts/template_feature.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
#SBATCH --job-name=A501_001
#SBATCH --partition=small
#SBATCH -N 1
#SBATCH -n 8
#SBATCH --ntasks-per-node=8
#SBATCH --output=task_file/%x_%j.out
#SBATCH --error=task_file/%x_%j.err

echo $SLURM_JOB_NAME

module load cuda/10.1.243-gcc-8.3.0
module load miniconda3
source activate alphafold_cuda10
cd /lustre/home/acct-stu/stu/deepocean

/lustre/home/acct-stu/stu/parallelfold/run_feature.sh -d /lustre/home/acct-stu/stu/parallelfold/data -o A501_result -m model_1 -f A501_seq/${SLURM_JOB_NAME}.fasta -t 2021-07-27

0 comments on commit 8aeebbf

Please sign in to comment.