### Install Protenix from GitHub Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Installs the latest development version directly from the repository. ```bash pip3 install git+https://github.com/bytedance/Protenix.git ``` -------------------------------- ### Clone ColabFold, Prepare Databases, and Install Source: https://github.com/lucidrains/protenix/blob/main/scripts/msa/step2-get_msa.ipynb Clones the ColabFold repository, checks out a specific commit, and prepares the necessary databases using the provided setup script. It also includes instructions for adding taxonomy information and installing ColabFold via pip. ```bash git clone https://github.com/sokrypton/ColabFold cd ColabFold git checkout 9bd39fd8be88ca71c039be9a8000bb0db92f80a2 # download and prepare the database # Note: Uniref only version uniref30_2103 has contained taxonomy information # you can download it from https://wwwuser.gwdg.de/~compbiol/colabfold/uniref30_2103_taxonomy.tar.gz bash setup_databases.sh # If you want to add Taxonomy ID using uniref30_2103 database # refer to https://github.com/sokrypton/ColabFold/issues/216 # Add the following line after Line 93 in colabfold/mmseqs/search.py # run_mmseqs(mmseqs, ["convertalis", base.joinpath("qdb"), dbbase.joinpath(f"{uniref_db}{dbSuffix1}"), # base.joinpath("res_exp_realign_filter"), base.joinpath("uniref_tax.m8"), "--format-output", # "query,target,taxid,taxname,taxlineage,fident,alnlen,mismatch,gapopen,qstart,qend,tstart,tend,evalue,bits,cigar", # "--db-load-mode", str(db_load_mode), "--threads", str(threads)]) pip3 install . pip install colabfold[alphafold]==1.5.5 ``` -------------------------------- ### Install Protenix Source: https://context7.com/lucidrains/protenix/llms.txt Commands to install Protenix from PyPI, GitHub, or local source. ```bash # Install from PyPI (stable version) pip install protenix # Install from GitHub (latest development version) pip install git+https://github.com/bytedance/Protenix.git # Install from local source (for development) git clone https://github.com/bytedance/Protenix.git cd Protenix pip install -e . ``` -------------------------------- ### Install Protenix from Local Source Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Clones the repository and installs it in editable mode for development. ```bash git clone https://github.com/bytedance/Protenix.git cd Protenix pip3 install -e . ``` -------------------------------- ### Install and Activate Conda Environment for ColabFold Source: https://github.com/lucidrains/protenix/blob/main/scripts/msa/step2-get_msa.ipynb Installs miniforge and creates a Python 3.10 environment named 'colabfold_search', then activates it. This is the initial setup step for the ColabFold search process. ```bash # Install miniforge # https://github.com/conda-forge/miniforge#download conda create -n colabfold_search python=3.10 conda activate colabfold_search cd ~ && mkdir workdir && cd workdir ``` -------------------------------- ### Install Protenix via PyPI Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Installs the stable version of Protenix using pip. ```bash pip3 install protenix ``` -------------------------------- ### Install Protenix via pip Source: https://github.com/lucidrains/protenix/blob/main/README.md Standard installation command for the Protenix package. ```bash pip install protenix ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/lucidrains/protenix/blob/main/README.md Commands to install and initialize pre-commit hooks for maintaining code quality. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Install and Verify Protenix Source: https://github.com/lucidrains/protenix/blob/main/docs/docker_installation.md Inside the Docker container, install Protenix in editable mode using pip and verify the installation by checking its help message. ```bash cd /app pip install -e . # Verify the installation by checking the help message protenix --help ``` -------------------------------- ### Clone, Build, and Install MMseqs2 Source: https://github.com/lucidrains/protenix/blob/main/scripts/msa/step2-get_msa.ipynb Clones the MMseqs2 repository, checks out a specific commit version as recommended by the ColabFold readme, builds it with CMake for release, and installs it. The MMseqs2 binary directory is then added to the PATH. ```bash git clone https://github.com/soedinglab/MMseqs2.git cd MMseqs2 git checkout 71dd32ec43e3ac4dabf111bbc4b124f1c66a85f1 # As in colabfold readme mkdir build cd build cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=. .. make make install export PATH=$(pwd)/bin/:$PATH cd ../ ``` -------------------------------- ### Install Colabfold Source: https://github.com/lucidrains/protenix/blob/main/docs/colabfold_compatible_msa.md Install Colabfold with alphafold support using pip. This is a prerequisite for using `colabfold_search`. ```bash pip install colabfold[alphafold] ``` -------------------------------- ### Build MMseqs2 from Source Source: https://github.com/lucidrains/protenix/blob/main/docs/colabfold_compatible_msa.md Compile MMseqs2 from source to use with Colabfold. This process involves downloading the source, configuring the build, and installing it. ```bash wget https://github.com/soedinglab/MMseqs2/archive/refs/tags/16-747c6.tar.gz tar xzf 16-747c6.tar.gz cd MMseqs2-16-747c6/ mkdir build && cd build cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=. .. make -j8 make install ``` -------------------------------- ### Verify Docker GPU Setup Source: https://github.com/lucidrains/protenix/blob/main/docs/docker_installation.md Run this command to ensure Docker is correctly configured with GPU support. It uses a specific NVIDIA CUDA image. ```bash docker run --rm --gpus all nvidia/cuda:12.6.3-base-ubuntu22.04 nvidia-smi ``` -------------------------------- ### Run CLI Prediction Source: https://context7.com/lucidrains/protenix/llms.txt Examples of using the protenix pred command for various inference scenarios. ```bash # Standard inference with the default v1.0.0 model protenix pred \ -i examples/input.json \ -o ./output \ -s 101 \ -n protenix_base_default_v1.0.0 \ --use_default_params true # Inference with template support (v1.0.0+ only) protenix pred \ -i examples/examples_with_template/example_9fm7.json \ -o ./output \ -n protenix_base_default_v1.0.0 \ --use_template true \ --use_seeds_in_json true # Inference with RNA MSA support (v1.0.0+ only) protenix pred \ -i examples/examples_with_rna_msa/example_9gmw_2.json \ -o ./output \ -n protenix_base_default_v1.0.0 \ --use_rna_msa true # Lightweight Mini model inference (faster, lower resource) protenix pred \ -i examples/input.json \ -o ./output \ -n protenix_mini_esm_v0.5.0 \ --use_default_params true # Custom inference parameters protenix pred \ -i examples/input.json \ -o ./output \ -s 101,102,103 \ -c 10 \ -p 200 \ -e 5 \ -d bf16 \ -n protenix_base_default_v1.0.0 \ --enable_cache true \ --enable_fusion true ``` -------------------------------- ### Run Protenix Docker Container Source: https://github.com/lucidrains/protenix/blob/main/docs/docker_installation.md Start the Protenix Docker container with GPU access and interactive mode. It mounts the current directory and shared memory for persistent storage and performance. ```bash docker run --gpus all -it \ -v "$(pwd)":/app \ -v /dev/shm:/dev/shm \ ai4s-share-public-cn-beijing.cr.volces.com/release/protenix:1.0.0.4 \ /bin/bash ``` -------------------------------- ### MSA Header Format Examples Source: https://github.com/lucidrains/protenix/blob/main/docs/msa_template_pipeline.md Required header formats for UniRef and UniProt sequences to enable correct taxonomic pairing. ```text >UniRef100_{hit_name}_{taxonomy_id}/ ``` ```text >tr|ACCESSION|ID_SPECIES/START-END [optional description] OS=Species Name OX=TaxonomyID ... ``` -------------------------------- ### Define PDB Subset File Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Example content for a subset text file containing PDB IDs, one per line. ```text 6hvq 5mqc 5zin ``` -------------------------------- ### Constraint-Guided Prediction JSON Source: https://context7.com/lucidrains/protenix/llms.txt Demonstrates how to specify contact and pocket constraints within a JSON input for guided prediction. ```json [ { "name": "constraint_example", "sequences": [ { "proteinChain": { "sequence": "YMLDLQPETTDLYCGGGGSGGGGSGGGGSIQRTPKIQVYSRHPAENGKSNFLNCYVSGFHPSDIEVDLLKNGER...", "count": 1 } }, { "proteinChain": { "sequence": "EVKLVESGGGLVQPGGSLRLSCAASGSIFSINTMGWYRQTPGKQRDLVADISSGGSTKYGDSVKGRFTISRDNTKNTVYLQMNSLKPEDTAVYYCYGLSYSNDDYWGQGTQVTVSS", "count": 1 } } ], "constraint": { "contact": [ { "entity1": 1, "copy1": 1, "position1": 169, "atom1": "CA", "entity2": 2, "copy2": 1, "position2": 1, "atom2": "C5", "max_distance": 6, "min_distance": 3 } ], "pocket": { "binder_chain": { "entity": 2, "copy": 1 }, "contact_residues": [ {"entity": 1, "copy": 1, "position": 69}, {"entity": 1, "copy": 1, "position": 72}, {"entity": 1, "copy": 1, "position": 126} ], "max_distance": 8 } } } ] ``` -------------------------------- ### Protenix Prediction Commands Source: https://context7.com/lucidrains/protenix/llms.txt Examples of using the 'protenix pred' command for inference with different base model variants. Specify input JSON and model name. ```bash protenix pred -i input.json -n protenix_base_default_v1.0.0 # Template + RNA MSA support ``` ```bash protenix pred -i input.json -n protenix_base_20250630_v1.0.0 # Latest training cutoff (2025-06-30) ``` ```bash protenix pred -i input.json -n protenix_base_default_v0.5.0 # Standard base model ``` ```bash protenix pred -i input.json -n protenix_base_constraint_v0.5.0 # With constraint support ``` -------------------------------- ### Define Protein Chain Sequence Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Example of a proteinChain entry including optional PTMs and MSA/template paths. ```json { "proteinChain": { "sequence": "PREACHINGS", "count": 1, "modifications": [ { "ptmType": "CCD_HY3", "ptmPosition": 1, }, { "ptmType": "CCD_P1L", "ptmPosition": 5 } ], "pairedMsaPath": "/path/to/pairing.a3m", "unpairedMsaPath": "/path/to/non_pairing.a3m", "templatesPath": "/path/to/hmmsearch.a3m" }, } ``` -------------------------------- ### View Preprocessing Help Source: https://github.com/lucidrains/protenix/blob/main/docs/prepare_training_data.md Displays parameter documentation for the training data preparation script. ```bash python3 scripts/prepare_training_data.py --help ``` -------------------------------- ### Run Training Demo Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Executes the training script from scratch using the provided bash demo script. ```bash bash train_demo.sh ``` -------------------------------- ### Download and Prepare Training Data Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Set the PROTENIX_ROOT_DIR environment variable to your desired data location and then run this script to download and extract full training data components. Ensure sufficient disk space (1.5T). ```bash # Set your data root directory export PROTENIX_ROOT_DIR=/path/to/your/data_root mkdir -p $PROTENIX_ROOT_DIR # Download and extract data components using the provided script # Use --inference_only (default) or --full for training/finetuning bash scripts/database/download_protenix_data.sh --full ``` -------------------------------- ### Download and Configure ColabFold Database Source: https://github.com/lucidrains/protenix/blob/main/docs/colabfold_compatible_msa.md Clone the ColabFold repository and set up the necessary databases. This step requires MMSEQS_NO_INDEX=1 environment variable to be set. ```bash git clone https://github.com/sokrypton/ColabFold.git cd ColabFold # Configure database: MMSEQS_NO_INDEX=1 ./setup_databases.sh ``` -------------------------------- ### Model Training from Scratch Source: https://context7.com/lucidrains/protenix/llms.txt Train Protenix from scratch using the training script with configurable hyperparameters. Ensure PYTHONPATH and PROTENIX_ROOT_DIR are set. ```bash export PYTHONPATH="${PYTHONPATH}:$(pwd)" export PROTENIX_ROOT_DIR="/path/to/your/data_root" # Initial training from scratch python3 ./runner/train.py \ --run_name protenix_train \ --model_name "protenix_base_default_v1.0.0" \ --seed 42 \ --base_dir ./output \ --dtype bf16 \ --project protenix \ --use_wandb false \ --diffusion_batch_size 48 \ --eval_interval 400 \ --log_interval 50 \ --checkpoint_interval 400 \ --ema_decay 0.999 \ --train_crop_size 384 \ --max_steps 100000 \ --warmup_steps 2000 \ --lr 0.001 \ --model.N_cycle 4 \ --sample_diffusion.N_step 20 \ --triangle_attention "cuequivariance" \ --triangle_multiplicative "cuequivariance" \ --data.train_sets weightedPDB_before2109_wopb_nometalc_0925 \ --data.test_sets recentPDB_1536_sample384_0925,posebusters_0925 ``` -------------------------------- ### Build and run Protenix in Docker Source: https://context7.com/lucidrains/protenix/llms.txt Build the container image and run inference with GPU support. ```bash # Build Docker image docker build -t protenix:latest . # Run inference in container docker run --gpus all -v /path/to/data:/data -v /path/to/output:/output \ protenix:latest protenix pred \ -i /data/input.json \ -o /output \ -n protenix_base_default_v1.0.0 ``` -------------------------------- ### Run Fine-tuning Demo Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Executes the fine-tuning script to load pretrained weights and train on a specific subset. ```bash bash finetune_demo.sh ``` -------------------------------- ### Run Template Search Source: https://github.com/lucidrains/protenix/blob/main/docs/msa_template_pipeline.md Command to execute the template search pipeline, which builds HMM profiles and searches the database. ```bash python3 runner/template_search.py ``` -------------------------------- ### Full Input Preprocessing Pipeline Source: https://context7.com/lucidrains/protenix/llms.txt Runs a comprehensive preprocessing pipeline including protein MSA, template search, and RNA MSA search. Requires paths to various HMMER and RNA database binaries. ```bash protenix prep \ --input examples/input.json \ --out_dir ./output \ --msa_server_mode protenix \ --hmmsearch_binary_path /usr/bin/hmmsearch \ --hmmbuild_binary_path /usr/bin/hmmbuild \ --seqres_database_path /path/to/pdb_seqres.fasta \ --nhmmer_binary_path /usr/bin/nhmmer \ --hmmalign_binary_path /usr/bin/hmmalign \ --rfam_database_path /path/to/rfam.fasta \ --rna_central_database_path /path/to/rnacentral.fasta \ --ntrna_database_path /path/to/nt_rna.fasta ``` -------------------------------- ### Generate MSA and template information via CLI Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Automates the search for MSAs and templates to update input JSON files. ```bash # Add template information to an existing JSON protenix mt -i examples/example_without_msa.json -o ./output # Add both template and RNA MSA information to an existing JSON # Note: To force a fresh search, ensure any existing 'unpairedMsaPath' fields are removed from the JSON. protenix prep -i examples/examples_with_rna_msa/example_9gmw_2.json -o ./output ``` -------------------------------- ### Run Protenix inference with CLI Source: https://context7.com/lucidrains/protenix/llms.txt Execute inference using different model variants. Mini and Tiny models do not require MSA. ```bash protenix pred -i input.json -n protenix_mini_esm_v0.5.0 # ESM embeddings (no MSA required) protenix pred -i input.json -n protenix_mini_ism_v0.5.0 # ISM embeddings (no MSA required) protenix pred -i input.json -n protenix_mini_default_v0.5.0 # Standard lightweight protenix pred -i input.json -n protenix_tiny_default_v0.5.0 ``` -------------------------------- ### Distributed Training with torchrun Source: https://context7.com/lucidrains/protenix/llms.txt Scale training across multiple GPUs using PyTorch's distributed training. This command initiates multi-GPU training with specified parameters. ```bash # Multi-GPU training with torchrun torchrun --nproc_per_node=8 runner/train.py \ --model_name "protenix_base_default_v1.0.0" \ --dtype bf16 \ --diffusion_batch_size 48 \ --train_crop_size 384 \ --triangle_attention "cuequivariance" \ --triangle_multiplicative "cuequivariance" ``` -------------------------------- ### Configure Fine-tuning Subset Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Specifies the path to a text file containing PDB IDs for fine-tuning. ```bash --data.weightedPDB_before2109_wopb_nometalc_0925.base_info.pdb_list examples/finetune_subset.txt ``` -------------------------------- ### Execute MSA Search with ColabFold Source: https://github.com/lucidrains/protenix/blob/main/scripts/msa/step2-get_msa.ipynb Sets the PYTHONPATH and creates log and result directories. It then executes the ColabFold search script using MMseqs2 with specified databases and parameters, including template usage and thread count. ```bash export PYTHONPATH=$PYTHONPATH:ColabFold mkdir -p logs mkdir -p results python3 ColabFold/colabfold/mmseqs/search.py --mmseqs=mmseqs {input_file} {db_dir} {output_dir} --db1 uniref30_2103_db --db2 pdb70_220313_db --db3 colabfold_envdb_202108_db --use-templates 1 --db-load-mode 2 --threads 32 # if you use scripts/msa/data/pdb_seqs/pdb_seq.fasta as {input_file} # you will get the following results as in scripts/msa/data/mmcif_msa_initial # 0.a3m 1.a3m 2.a3m 3.a3m pdb70_220313_db.m8 uniref_tax.m8 ``` -------------------------------- ### Perform Input Preprocessing Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Generates MSA and template information required for optimal prediction accuracy. ```bash # Full preprocessing (Protein MSA + Template + RNA MSA) protenix prep --input examples/input.json --out_dir ./output # Sequential Protein MSA and Template search protenix mt --input examples/input.json --out_dir ./output # Independent MSA search (supports JSON or Protein FASTA) protenix msa --input examples/prot.fasta --out_dir ./output --msa_server_mode protenix ``` -------------------------------- ### Clone Protenix Repository Source: https://github.com/lucidrains/protenix/blob/main/docs/docker_installation.md Clone the Protenix GitHub repository to your local machine and navigate into the project directory. ```bash git clone https://github.com/bytedance/protenix.git cd ./protenix ``` -------------------------------- ### Pull Protenix Docker Image Source: https://github.com/lucidrains/protenix/blob/main/docs/docker_installation.md Download the Protenix Docker image from the specified registry. This image includes all necessary dependencies. ```bash docker pull ai4s-share-public-cn-beijing.cr.volces.com/release/protenix:1.0.0.4 ``` -------------------------------- ### Preprocess Training Data Source: https://github.com/lucidrains/protenix/blob/main/docs/prepare_training_data.md Executes the main preprocessing script to convert CIF files into training-ready formats. ```bash python3 scripts/prepare_training_data.py -i [input_path] -o [output_csv] -b [output_dir] -c [cluster_txt] -n [num_cpu] ``` -------------------------------- ### Generate Protenix-Compatible MSA with colabfold_msa.py Source: https://github.com/lucidrains/protenix/blob/main/docs/colabfold_compatible_msa.md Use this script to post-process `colabfold_search` results by adding pseudo taxonomy IDs to paired MSAs, making them compatible with Protenix's data pipeline. Ensure Colabfold databases and MMseqs2 are correctly configured. ```bash python3 scripts/colabfold_msa.py examples/dimer.fasta dimer_colabfold_msa --db1 uniref30_2103_db --db3 colabfold_envdb_202108_db --mmseqs_path ``` -------------------------------- ### Run Distributed Training Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Utilizes PyTorch's torchrun to perform distributed training across multiple nodes. ```bash torchrun --nproc_per_node=8 runner/train.py --model_name "protenix_base_default_v1.0.0" [OTHER_ARGS] ``` -------------------------------- ### Direct Script Inference (Mini Model) Source: https://context7.com/lucidrains/protenix/llms.txt Run inference directly using the runner script with full parameter control for the mini model, optimized for fast inference. Ensure PYTHONPATH is set. ```bash export PYTHONPATH="${PYTHONPATH}:$(pwd)" # Mini model for fast inference python3 runner/inference.py \ --model_name protenix_mini_esm_v0.5.0 \ --seeds 101 \ --dump_dir ./output \ --input_json_path ./examples/input.json \ --model.N_cycle 4 \ --sample_diffusion.N_sample 1 \ --sample_diffusion.N_step 5 \ --triangle_attention "cuequivariance" \ --triangle_multiplicative "cuequivariance" ``` -------------------------------- ### Model Fine-tuning Source: https://context7.com/lucidrains/protenix/llms.txt Fine-tune a pretrained model on a specific subset of PDB structures using the training script. Specify checkpoint paths and the list of PDB IDs for fine-tuning. ```bash export PYTHONPATH="${PYTHONPATH}:$(pwd)" # Fine-tune on specific PDB IDs python3 ./runner/train.py \ --run_name protenix_finetune \ --model_name "protenix_base_default_v1.0.0" \ --load_checkpoint_path /path/to/pretrained_model.pt \ --load_ema_checkpoint_path /path/to/pretrained_ema.pt \ --seed 42 \ --base_dir ./output \ --dtype bf16 \ --diffusion_batch_size 32 \ --train_crop_size 640 \ --max_steps 10000 \ --data.weightedPDB_before2109_wopb_nometalc_0925.base_info.pdb_list examples/finetune_subset.txt ``` -------------------------------- ### Define ligand input Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Supports ligands defined by CCD codes, SMILES strings, or paths to structure files (PDB, SDF, MOL, MOL2). ```json { "ligand": { "ligand": "CCD_ATP", "count": 1 } }, { "ligand": { "ligand": "FILE_your_file_path/atp.sdf", "count": 1 } }, { "ligand": { "ligand": "Nc1ncnc2c1ncn2[C@@H]1O[C@H](CO[P@@](=O)(O)O[P@](=O)(O)OP(=O)(O)O)[C@@H](O)[C@H]1O", "count": 1 } } ``` -------------------------------- ### Run Inference Demo Script Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Use this bash script for automated inference runs. Specify the model name, input JSON path, output directory, data type, and whether to use MSA features. ```bash bash inference_demo.sh ``` -------------------------------- ### Direct Script Inference (Base Model) Source: https://context7.com/lucidrains/protenix/llms.txt Run inference directly using the runner script with full parameter control for the base model v1.0.0 with template support. Ensure PYTHONPATH is set. ```bash export PYTHONPATH="${PYTHONPATH}:$(pwd)" # Base model v1.0.0 with template support python3 runner/inference.py \ --model_name protenix_base_default_v1.0.0 \ --seeds 101 \ --dump_dir ./output \ --input_json_path ./examples/input.json \ --model.N_cycle 10 \ --sample_diffusion.N_sample 5 \ --sample_diffusion.N_step 200 \ --triangle_attention "cuequivariance" \ --triangle_multiplicative "cuequivariance" \ --use_template true ``` -------------------------------- ### Download Protein Clustering File Source: https://github.com/lucidrains/protenix/blob/main/docs/prepare_training_data.md Downloads the official RCSB PDB clustering results for sequence identity thresholds. ```bash wget https://cdn.rcsb.org/resources/sequence/clusters/clusters-by-entity-40.txt ``` -------------------------------- ### Configure Triangle Multiplicative Source: https://github.com/lucidrains/protenix/blob/main/docs/kernels.md Set the triangle multiplicative implementation in configs_base.py. ```python triangle_multiplicative = "cuequivariance" # or "torch" ``` -------------------------------- ### Ligand Input Formats in JSON Source: https://context7.com/lucidrains/protenix/llms.txt Specifies how ligands can be provided in JSON format, supporting CCD codes, SMILES strings, and file paths. ```json [ { "name": "ligand_examples", "sequences": [ { "proteinChain": { "sequence": "MAEVIRSSAFWRSFPIFEEFDSETLCELS...", "count": 1 } }, { "ligand": { "ligand": "CCD_ATP", "count": 1 } }, { "ligand": { "ligand": "CCD_NAG_BMA_BGC", "count": 1 } }, { "ligand": { "ligand": "Nc1ncnc2c1ncn2[C@@H]1O[C@H](CO[P@@](=O)(O)O[P@](=O)(O)OP(=O)(O)O)[C@@H](O)[C@H]1O", "count": 1 } }, { "ligand": { "ligand": "FILE_/path/to/molecule.sdf", "count": 1 } } ] } ] ``` -------------------------------- ### Convert PDB to JSON using Protenix CLI Source: https://context7.com/lucidrains/protenix/llms.txt Command to convert a PDB file to Protenix-compatible JSON format. Ensure the input path is correct. ```bash protenix json --input ./examples/7pzb.pdb --out_dir ./output --altloc first ``` -------------------------------- ### MSA Search from JSON Input Source: https://context7.com/lucidrains/protenix/llms.txt Performs an MSA search using a JSON file as input and updates the JSON with MSA paths. Requires specifying the MSA server mode. ```bash protenix msa --input examples/input.json --out_dir ./output --msa_server_mode protenix ``` -------------------------------- ### Run Model Inference Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Executes the prediction engine with various configuration options for models, seeds, and feature toggles. ```bash # Standard inference (using default model and parameters) protenix pred -i examples/input.json -o ./output -s 101 -n protenix_base_default_v1.0.0 --use_template true # Standard inference with seeds from JSON protenix pred -i examples/examples_with_template/example_mgyp004658859411.json --use_seeds_in_json true # Standard inference with RNA MSA, only support protenix_base_default_v1.0.0 protenix pred -i examples/examples_with_rna_msa/example_9gmw_2.json --use_rna_msa true -n protenix_base_default_v1.0.0 # Inference using Protenix-Mini (faster, lightweight) protenix pred --input examples/input.json --model_name protenix_mini_default_v0.5.0 # Customized inference: Disable MSA and use shared variable caching protenix pred --input examples/input.json --use_msa false --enable_cache true ``` -------------------------------- ### Combined MSA and Template Search Source: https://context7.com/lucidrains/protenix/llms.txt Executes sequential MSA and template searches. Requires paths to HMMER binaries and the PDB sequence database. ```bash protenix mt \ --input examples/input.json \ --out_dir ./output \ --msa_server_mode protenix \ --hmmsearch_binary_path /usr/bin/hmmsearch \ --hmmbuild_binary_path /usr/bin/hmmbuild \ --seqres_database_path /path/to/pdb_seqres.fasta ``` -------------------------------- ### Execute MSA Search Notebook Source: https://github.com/lucidrains/protenix/blob/main/docs/msa_template_pipeline.md The provided Jupyter notebook template for performing the MSA search process. ```python scripts/msa/step2-get_msa.ipynb ``` -------------------------------- ### Cite Related Foundational Works Source: https://github.com/lucidrains/protenix/blob/main/README.md BibTeX entries for foundational projects that inspired Protenix. ```bibtex @article{abramson2024accurate, title={Accurate structure prediction of biomolecular interactions with AlphaFold 3}, author={Abramson, Josh and Adler, Jonas and Dunger, Jack and Evans, Richard and Green, Tim and Pritzel, Alexander and Ronneberger, Olaf and Willmore, Lindsay and Ballard, Andrew J and Bambrick, Joshua and others}, journal={Nature}, volume={630}, number={8016}, pages={493--500}, year={2024}, publisher={Nature Publishing Group UK London} } @article{ahdritz2024openfold, title={OpenFold: Retraining AlphaFold2 yields new insights into its learning mechanisms and capacity for generalization}, author={Ahdritz, Gustaf and Bouatta, Nazim and Floristean, Christina and Kadyan, Sachin and Xia, Qinghui and Gerecke, William and O’Donnell, Timothy J and Berenberg, Daniel and Fisk, Ian and Zanichelli, Niccol{\`o} and others}, journal={Nature Methods}, volume={21}, number={8}, pages={1514--1524}, year={2024}, publisher={Nature Publishing Group US New York} } @article{mirdita2022colabfold, title={ColabFold: making protein folding accessible to all}, author={Mirdita, Milot and Sch{"u}tze, Konstantin and Moriwaki, Yoshitaka and Heo, Lim and Ovchinnikov, Sergey and Steinegger, Martin}, journal={Nature methods}, volume={19}, number={6}, pages={679--682}, year={2022}, publisher={Nature Publishing Group US New York} } ``` -------------------------------- ### Configure DeepSpeed CUTLASS Path Source: https://github.com/lucidrains/protenix/blob/main/docs/kernels.md Set the CUTLASS path for the DS4Sci_EvoformerAttention kernel via Dockerfile or environment variables. ```bash RUN git clone -b v3.5.1 https://github.com/NVIDIA/cutlass.git /opt/cutlass ENV CUTLASS_PATH=/opt/cutlass ``` ```bash git clone -b v3.5.1 https://github.com/NVIDIA/cutlass.git /path/to/cutlass export CUTLASS_PATH=/path/to/cutlass ``` -------------------------------- ### MSA Search from FASTA Input Source: https://context7.com/lucidrains/protenix/llms.txt Performs an MSA search using a FASTA file as input. Requires specifying the MSA server mode. ```bash protenix msa --input examples/prot.fasta --out_dir ./output --msa_server_mode colabfold ``` -------------------------------- ### Run RNA MSA search Source: https://github.com/lucidrains/protenix/blob/main/docs/msa_template_pipeline.md Executes the RNA MSA search pipeline using the provided runner script. ```bash python3 runner/rna_msa_search.py ``` -------------------------------- ### Process MSA Data Source: https://github.com/lucidrains/protenix/blob/main/docs/msa_template_pipeline.md Commands to append taxonomy IDs and organize the raw A3M files into the final Protenix-compatible directory structure. ```bash python3 scripts/msa/step3-uniref_add_taxid.py ``` ```bash python3 scripts/msa/step4-split_msa_to_uniref_and_others.py --input_msa_dir scripts/msa/data/mmcif_msa_with_taxid --output_msa_dir scripts/msa/data/mmcif_msa ``` -------------------------------- ### Convert CIF to JSON with Assembly ID Source: https://context7.com/lucidrains/protenix/llms.txt Command to convert a CIF file to JSON, specifying an assembly ID. Requires downloading the CIF file first. ```bash wget -P ./examples/ https://files.rcsb.org/download/7pzb.cif protenix json --input ./examples/7pzb.cif --out_dir ./output --altloc first --assembly_id 1 ``` -------------------------------- ### Run Protenix structure prediction Source: https://github.com/lucidrains/protenix/blob/main/README.md Execute a structure prediction task using a JSON input file and a specified model version. ```bash # Predict structure using a JSON input protenix pred -i examples/input.json -o ./output -n protenix_base_default_v1.0.0 ``` -------------------------------- ### Configure Triangle Attention Source: https://github.com/lucidrains/protenix/blob/main/docs/kernels.md Set the triangle attention implementation in configs_base.py. ```python triangle_attention = "cuequivariance" # or "triattention"/"deepspeed"/"torch" ``` -------------------------------- ### Convert Structural Files to JSON Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md Converts PDB or CIF files into the JSON format required by Protenix. ```bash # Convert PDB/CIF to JSON protenix json --input ./examples/7pzb.pdb --out_dir ./output --altloc first # Advanced: Specify assembly ID for biological assemblies wget -P ./examples/ https://files.rcsb.org/download/7pzb.cif protenix json --input ./examples/7pzb.cif --out_dir ./output --altloc first ``` -------------------------------- ### Python Inference with InferenceRunner Source: https://context7.com/lucidrains/protenix/llms.txt Use InferenceRunner for programmatic inference with fine-grained control over model configuration. Ensure necessary imports are present. ```python from runner.inference import InferenceRunner, infer_predict, download_inference_cache from runner.batch_inference import get_default_runner from configs.configs_base import configs as configs_base from configs.configs_inference import inference_configs from protenix.config.config import parse_configs # Quick inference using the default runner runner = get_default_runner( seeds=[101, 102, 103], n_cycle=10, n_step=200, n_sample=5, dtype="bf16", model_name="protenix_base_default_v1.0.0", use_msa=True, use_template=True, use_rna_msa=False, trimul_kernel="cuequivariance", triatt_kernel="cuequivariance", enable_cache=True, enable_fusion=True, enable_tf32=True ) # Run inference on input JSON configs = runner.configs configs["input_json_path"] = "./examples/input.json" configs["dump_dir"] = "./output" infer_predict(runner, configs) ``` -------------------------------- ### Define Protenix Inference Job Structure Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md The top-level structure of the input JSON file must be a list of dictionaries, even for a single job. ```json [ { "name": "Test Fold Job Number One", "sequences": [...], "covalent_bonds": [...] } ] ``` -------------------------------- ### Convert Directory of PDB/CIF Files to JSON Source: https://context7.com/lucidrains/protenix/llms.txt Command to convert all PDB and CIF files within a specified directory to JSON format. ```bash protenix json --input ./structures/ --out_dir ./output ``` -------------------------------- ### Update Inference Configurations Based on Token Count Source: https://github.com/lucidrains/protenix/blob/main/docs/training_inference_instructions.md This function dynamically adjusts Automatic Mixed Precision (AMP) settings for `SampleDiffusion` and `ConfidenceHead` modules to manage memory usage and prevent OOM errors for large sequences. It prioritizes accuracy by disabling AMP for smaller token counts and enables it for larger ones. ```python def update_inference_configs(configs: Any, n_token: int) -> Any: """ Adjust inference configurations based on the number of tokens to manage memory usage and prevent OOM. Args: configs (Any): Original configurations. n_token (int): Number of tokens in the sample. Returns: Any: Updated configurations. """ if n_token > 3840: # Enable AMP for both modules to save memory for extremely large sequences configs.skip_amp.confidence_head = False configs.skip_amp.sample_diffusion = False elif n_token > 2560: # Enable AMP only for ConfidenceHead configs.skip_amp.confidence_head = False configs.skip_amp.sample_diffusion = True else: # Default: Disable AMP for both (run in FP32) to prioritize accuracy configs.skip_amp.confidence_head = True configs.skip_amp.sample_diffusion = True return configs ``` -------------------------------- ### Define Input JSON Source: https://context7.com/lucidrains/protenix/llms.txt Structure of the JSON input file for defining sequences, modifications, and covalent bonds. ```json [ { "name": "protein_dna_complex", "sequences": [ { "proteinChain": { "sequence": "MGSSHHHHHHSSGLVPRGSHMSGKIQHKAVVPAPSRIPLTLSEIEDLRRKGFNQTEIAELYGVTRQAVSWHKKTYGGRLTTRQIVQQNWPWDTRKPHDKSKAFQRLRDHGEYMRVGSFRTMSEDKKKRLLSWWKMLRDNDLVLEFDPSIEPYEGMAGGGFRYVPRDISDDDLLIRVNEHTQLTAEGELLWSWPDDIEELLSEP", "count": 1, "pairedMsaPath": "/path/to/pairing.a3m", "unpairedMsaPath": "/path/to/non_pairing.a3m", "templatesPath": "/path/to/hmmsearch.a3m", "modifications": [ {"ptmType": "CCD_HY3", "ptmPosition": 1} ] } }, { "dnaSequence": { "sequence": "TTTCGGTGGCTGTCAAGCGGG", "count": 1 } }, { "rnaSequence": { "sequence": "GUACGUAC", "count": 1, "unpairedMsaPath": "/path/to/rna_msa.a3m" } }, { "ligand": { "ligand": "CCD_ATP", "count": 1 } }, { "ion": { "ion": "MG", "count": 2 } } ], "covalent_bonds": [ { "entity1": "2", "copy1": 1, "position1": "2", "atom1": "N6", "entity2": "3", "copy2": 1, "position2": "1", "atom2": "C1" } ] } ] ``` -------------------------------- ### Disable Fast Layernorm Source: https://github.com/lucidrains/protenix/blob/main/docs/kernels.md Set the environment variable to use native PyTorch layernorm instead of the default fast_layernorm. ```bash export LAYERNORM_TYPE=torch ``` -------------------------------- ### Define Token Contact Constraint Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Use this to define contact between tokens, specifying entities, copies, and positions. Minimum distance defaults to 0. ```json "contact": [ { "entity1": 1, "copy1": 1, "position1": 169, "entity2": 2, "copy2": 1, "position2": 1, "atom2": "C5", "max_distance": 6, "min_distance": 0 }, // token-contact { "entity1": 1, "copy1": 1, "position1": 169, "atom1": "CA", "entity2": 2, "copy2": 1, "position2": 1, "max_distance": 6, "min_distance": 0 }, // token-contact { "entity1": 1, "copy1": 1, "position1": 169, "entity2": 2, "copy2": 1, "position2": 1, "max_distance": 6, "min_distance": 0 }, // token-contact { "entity1": 1, "copy1": 1, "position1": 169, "atom1": "CA", "entity2": 2, "copy2": 1, "position2": 1, "atom2": "C5", "max_distance": 6, "min_distance": 3 }, // atom-contact ... ] ``` -------------------------------- ### Define ion input Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Represents ions using their CCD codes without the 'CCD_' prefix. ```json { "ion": { "ion": "MG", "count": 2 } }, { "ion": { "ion": "NA", "count": 3 } } ``` -------------------------------- ### Define Pocket Constraint Source: https://github.com/lucidrains/protenix/blob/main/docs/infer_json_format.md Use this to define a pocket constraint, specifying the binder chain, contact residues, and maximum distance. ```json "pocket": { "binder_chain": { "entity": 2, "copy": 1 }, "contact_residues": [ { "entity": 1, "copy": 1, "position": 126 }, ... ], "max_distance": 6 } ``` -------------------------------- ### Update CCD Cache Source: https://github.com/lucidrains/protenix/blob/main/docs/prepare_training_data.md Generates or updates the Chemical Component Dictionary cache for recent PDB entries. ```bash python3 scripts/gen_ccd_cache.py -c [ccd_cache_dir] -n [num_cpu] ```