Docker command

Setup

Command

Before running, make sure you have af_model, af_output, af_database folder prepared in the current directory


source

get_docker_command


def get_docker_command(
    input_dir:str='af_input', # Directory for input data
    output_dir:str='af_output', # Directory for output results
    model_dir:str='af_model', # Directory containing models
    db_dir:str='af_database', # Directory for databases. If None, this option is ommitted
    cache_dir:str='af_cache', # Directory for JAX compilation cache. If None, this option is omitted
    gpus:int=0, # GPU devices to allocate (e.g., 0,1), if None, ommitted
    docker_name:str='sky1ove/alphafold3', # Docker image name
    embedding:bool=False, # If True, includes the --save_embeddings=true flag
    skip_search:bool=False, # if MSA is precalculated and present in json; If True, includes the --norun_data_pipeline flag
    search_only:bool=False, # search MSA only; If True, sets skip_search to False and includes the --norun_inference flag
    json_path:NoneType=None, # Path to JSON file. If not None, uses json_file instead of input_dir
):

Generate a Docker run command for Alphafold with customizable parameters.

Single json file:

# for single json file, we don't need to cache the model
get_docker_command(json_path=f"af_input/subfolder/data.json",
                   output_dir="af_output/subfolder",
                   cache_dir=False)
docker run --rm \
    --volume "$HOME/af_input:/root/af_input" \
    --volume "$HOME/af_output/subfolder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --json_path=/root/af_input/subfolder/data.json \
    --output_dir=/root/af_output \
    --model_dir=/root/models

Input directory with json files:

# For a number of json files in the input folder
get_docker_command(input_dir="af_input/subfolder/folder_0",
                   output_dir="af_output/subfolder")
docker run --rm \
    --volume "$HOME/af_input:/root/af_input" \
    --volume "$HOME/af_output/subfolder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --volume "$HOME/af_cache:/root/cache" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --input_dir=/root/af_input/subfolder/folder_0 \
    --output_dir=/root/af_output \
    --model_dir=/root/models \
    --jax_compilation_cache_dir=/root/cache

Single json full pipeline


source

docker_single_full


def docker_single_full(
    json_path, # Path to JSON file. If not None, uses json_file instead of input_dir
    output_dir, # Directory for output results
    cache_dir:bool=False, input_dir:str='af_input', # Directory for input data
    model_dir:str='af_model', # Directory containing models
    db_dir:str='af_database', # Directory for databases. If None, this option is ommitted
    gpus:int=0, # GPU devices to allocate (e.g., 0,1), if None, ommitted
    docker_name:str='sky1ove/alphafold3', # Docker image name
    embedding:bool=False, # If True, includes the --save_embeddings=true flag
    skip_search:bool=False, # if MSA is precalculated and present in json; If True, includes the --norun_data_pipeline flag
    search_only:bool=False, # search MSA only; If True, sets skip_search to False and includes the --norun_inference flag
):

Single json task with full pipeline.

docker_single_full('a.json','output_folder')
docker run --rm \
    --volume "$HOME/a.json:/root/af_input" \
    --volume "$HOME/output_folder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --json_path=/root/af_input/ \
    --output_dir=/root/af_output \
    --model_dir=/root/models

Folder input

Full pipeline


source

docker_multi_full


def docker_multi_full(
    input_dir, # Directory for input data
    output_dir, model_dir:str='af_model', # Directory containing models
    db_dir:str='af_database', # Directory for databases. If None, this option is ommitted
    cache_dir:str='af_cache', # Directory for JAX compilation cache. If None, this option is omitted
    gpus:int=0, # GPU devices to allocate (e.g., 0,1), if None, ommitted
    docker_name:str='sky1ove/alphafold3', # Docker image name
    embedding:bool=False, # If True, includes the --save_embeddings=true flag
    skip_search:bool=False, # if MSA is precalculated and present in json; If True, includes the --norun_data_pipeline flag
    search_only:bool=False, # search MSA only; If True, sets skip_search to False and includes the --norun_inference flag
    json_path:NoneType=None, # Path to JSON file. If not None, uses json_file instead of input_dir
):

Folder of json as input with full pipeline.

docker_multi_full('input_folder','output_folder')
docker run --rm \
    --volume "$HOME/input_folder:/root/af_input" \
    --volume "$HOME/output_folder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --volume "$HOME/af_cache:/root/cache" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --input_dir=/root/af_input \
    --output_dir=/root/af_output \
    --model_dir=/root/models \
    --jax_compilation_cache_dir=/root/cache

MSA only


source

docker_multi_msa


def docker_multi_msa(
    input_dir, # Directory for input data
    output_dir, # Directory for output results
    search_only:bool=True, model_dir:str='af_model', # Directory containing models
    db_dir:str='af_database', # Directory for databases. If None, this option is ommitted
    cache_dir:str='af_cache', # Directory for JAX compilation cache. If None, this option is omitted
    gpus:int=0, # GPU devices to allocate (e.g., 0,1), if None, ommitted
    docker_name:str='sky1ove/alphafold3', # Docker image name
    embedding:bool=False, # If True, includes the --save_embeddings=true flag
    skip_search:bool=False, # if MSA is precalculated and present in json; If True, includes the --norun_data_pipeline flag
    json_path:NoneType=None, # Path to JSON file. If not None, uses json_file instead of input_dir
):

MSA search only, without structure inference; CPU only.

docker_multi_msa('input_folder','output_folder')
docker run --rm \
    --volume "$HOME/input_folder:/root/af_input" \
    --volume "$HOME/output_folder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --volume "$HOME/af_cache:/root/cache" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --input_dir=/root/af_input \
    --output_dir=/root/af_output \
    --model_dir=/root/models \
    --jax_compilation_cache_dir=/root/cache \
    --norun_inference

Infer only


source

docker_multi_infer


def docker_multi_infer(
    input_dir, # Directory for input data
    output_dir, # Directory for output results
    skip_search:bool=True, model_dir:str='af_model', # Directory containing models
    db_dir:str='af_database', # Directory for databases. If None, this option is ommitted
    cache_dir:str='af_cache', # Directory for JAX compilation cache. If None, this option is omitted
    gpus:int=0, # GPU devices to allocate (e.g., 0,1), if None, ommitted
    docker_name:str='sky1ove/alphafold3', # Docker image name
    embedding:bool=False, # If True, includes the --save_embeddings=true flag
    search_only:bool=False, # search MSA only; If True, sets skip_search to False and includes the --norun_inference flag
    json_path:NoneType=None, # Path to JSON file. If not None, uses json_file instead of input_dir
):

Infer only with pre-calculated MSA; GPU is needed.

docker_multi_infer('input_folder','output_folder')
docker run --rm \
    --volume "$HOME/input_folder:/root/af_input" \
    --volume "$HOME/output_folder:/root/af_output" \
    --volume "$HOME/af_model:/root/models" \
    --volume "$HOME/af_database:/root/public_databases" \
    --volume "$HOME/af_cache:/root/cache" \
    --gpus "device=0" \
    sky1ove/alphafold3 \
    python run_alphafold.py \
    --input_dir=/root/af_input \
    --output_dir=/root/af_output \
    --model_dir=/root/models \
    --jax_compilation_cache_dir=/root/cache \
    --norun_data_pipeline

End