Protenix Documentation

repository·main·Indexed 24 days ago

https://github.com/bytedance/protenix

An open-source framework for high-accuracy biomolecular structure prediction of proteins, RNA, and ligands. Protenix provides tools for structure prediction via CLI, support for multiple model variants (including protenix-v2 and protenix_base), and pipelines for generating Colabfold-compatible MSAs. The framework supports complex input configurations via JSON for protein chains, DNA/RNA sequences, ligands, ions, covalent bonds, and distance or pocket constraints.

Tokens
13.6K
Snippets
39
Records
58
Agent score
84%

What's inside Protenix

  1. Overview of MSA Data Structure

    main

    Protenix organizes Multiple Sequence Alignment (MSA) data using an integer-indexed directory structure. Each unique protein sequence is assigned an integer index (e.g., 0, 1, 2), which corresponds to a subdirectory under the root MSA directory.

    To resolve a sequence to its directory ID, the data loader uses a seq_to_pdb_index.json file located in a common directory.

    Directory Layout Example:

    ├── common
    │   ├── seq_to_pdb_index.json # Mapping from sequence to directory ID
    │   └── ...                   # Other metadata
    ├── mmcif_msa_template                 # Root directory for MSA files
    │   ├── 0
    │   │   ├── pairing.a3m       # MSAs paired by taxonomy ID
    │   │   ├── non_pairing.a3m   # Unpaired MSAs
    │   │   └── hmmsearch.a3m     # Templates from HMMER search
    │   ├── 1
    │   │   ├── pairing.a3m
    │   │   ├── non_pairing.a3m
    │   │   └── hmmsearch.a3m
    │   └── ...
  2. Use the Constraint model for structural priors

    main

    The protenix_base_constraint_v0.5.0 model allows you to incorporate experimental structural constraints (such as Pocket or Contact information) during inference.

    This model includes specific embedders to handle these inputs:

    • pocket_embedder: Processes binding pocket information.
    • contact_embedder: Processes contact point information.
  3. Structure of the Protenix input JSON file

    main

    The input JSON file is a list of dictionaries, where each dictionary represents a single inference job. Even for a single set of sequences, the top-level structure must be a list.

    Each job dictionary contains:

    • name: (string) The name of the inference job.
    • sequences: (list of dicts) Descriptions of entities like proteins, DNA, RNA, ligands, or ions.
    • covalent_bonds: (optional list of dicts) Definitions of covalent bonds between atoms from different entities.
    [
      {
        "name": "Test Fold Job Number One",
        "sequences": [...],
        "covalent_bonds": [...]
      }
    ]
  4. Understand Protenix model naming conventions

    main

    Protenix model names follow a structured format to identify their size, functional features, and version: protenix_{model_size}_{features}_{version}.

    • model_size: Defines the scale of the model. Options include base (full accuracy), mini (lightweight), and tiny (minimal).
    • features: Describes functional capabilities. Examples include default, constraint (supports distance constraints), and esm (includes ESM embeddings). Multiple features are separated by a hyphen (-).
    • version: The specific version number (e.g., v0.5.0, v1.0.0).
  5. Use ESM and ISM models when MSAs are unavailable

    main

    ESM and ISM models integrate single-sequence protein language models (ESM2-3B). These are ideal for scenarios where Multiple Sequence Alignments (MSAs) are unavailable.

    • ESM models: Use standard ESM2 embeddings.
    • ISM models: Use specific ISM embeddings.

    Note: For efficiency, these models do not use MSA by default.

  6. Use Protenix-Mini for high-throughput or resource-limited prediction

    main

    Protenix-Mini is a lightweight variant designed for efficient prediction of biomolecular complex structures. It achieves efficiency by using reduced network blocks and a minimal number of ODE steps (as few as one or two steps).

    Key Characteristics:

    • Efficiency: Optimized for high-throughput and resource-limited environments.
    • Accuracy: Maintains a favorable balance, typically showing only a 1–5% drop in metrics like interface LDDT, complex LDDT, and ligand RMSD success rate compared to larger models.
    • Use Case: Best suited for large-scale applications where speed and resource management are prioritized over absolute maximum precision.
  7. Use constraints for guided structure prediction

    main

    Protenix supports using constraints to provide extra guidance during structure prediction, which can significantly improve accuracy. You can specify:

    • Contacts: At both the residue and atom levels.
    • Pocket constraints

    For detailed information on the required JSON input format for these constraints, refer to the infer_json_format.md documentation.

  8. Run RNA MSA Search

    main

    Protenix provides a specialized pipeline for RNA MSA search using nhmmer.

    Execution:

    python3 runner/rna_msa_search.py

    Workflow:

    • The pipeline searches across three databases: Rfam, RNAcentral, and NT-RNA.
    • Results from all databases are merged, deduplicated, and saved as rna_msa.a3m.
    • Inference Integration: For RNA chains, reference the resulting rna_msa.a3m file in your inference JSON using the unpairedMsaPath key.

    Prerequisites:

    • hmmer must be installed with nhmmer, hmmalign, and hmmbuild in your PATH.
    • Ensure several gigabytes of free space for the search databases.

    Pre-computed Data: For RNA sequences from wwPDB, you can download pre-computed MSAs from rna_msa.tar.gz. After extraction, the structure is:

    • rna_msa/msas/: Contains .a3m files.
    • rna_msa/rna_sequence_to_pdb_chains.json: Maps RNA sequences to PDB entity IDs (e.g., {"AAAAAAAAAAUU": ["4kxt_2", "6oon_2"]}).

    To retrieve an MSA, look up the sequence in the JSON and find the file at msas/{pdb_entity_id}/{pdb_entity_id}_all.a3m.

    python3 runner/rna_msa_search.py
  9. Update the CCD (Chemical Component Dictionary) Cache

    main

    If your training data contains CCD Codes released after 2024-06-08, you must update the CCD cache to avoid missing reference conformers. Use scripts/gen_ccd_cache.py to download and process the latest CIF files from RCSB.

    Parameters:

    • -c [ccd_cache_dir]: (Optional) Directory to save the generated files. If omitted, files are saved to release_data/ccd_cache within the Protenix directory.
    • -n [num_cpu]: Number of CPUs to use.
    • -d: (Optional) Skip the CIF download step and process the existing components.cif in the specified cache directory.

    Generated Files in ccd_cache_dir:

    • components.cif: The downloaded CCD CIF file.
    • components.cif.rdkit_mol.pkl: A dictionary mapping CCD Codes to RDKit Mol objects with 3D structures.
    • components.txt: A list of all CCD Codes.

    Note: Protenix expects these files to be located at {PROTENIX_ROOT_DIR}/common/components.cif and {PROTENIX_ROOT_DIR}/common/components.cif.rdkit_mol.pkl during runtime.

    python3 scripts/gen_ccd_cache.py -c [ccd_cache_dir] -n [num_cpu]
  10. Analyze Protenix Benchmark Results

    main

    To analyze the performance of Protenix v1.0.0, follow these steps:

    1. Download: Obtain the relevant .tar.gz file from the benchmark data table.
    2. Extract: Decompress the file using tar:
      tar -xzvf <dataset_name>.tar.gz
    3. Review Data:
      • Inference Metrics: Look for CSV files containing per-prediction metrics such as LDDT, RMSD, and confidence scores for each sample.
      • Aggregated Results: Review summary reports for statistical overviews across the entire dataset to assess general performance.
    tar -xzvf <dataset_name>.tar.gz
  11. Understand Training Hyperparameters and Costs

    main

    Protenix training follows a multi-stage process similar to AlphaFold 3. Training stages vary by train_crop_size, diffusion_batch_size, and specific loss weights.

    Key Hyperparameters by Stage:

    • Initial Training: train_crop_size 384, diffusion_batch_size 48, focuses on loss.weight.smooth_lddt and loss.weight.alpha_diffusion.
    • Fine-tuning Stages 1 & 2: train_crop_size increases (640 to 768), diffusion_batch_size is 32, and loss.weight.alpha_bond is enabled (1.0).
    • Fine-tuning Stage 3: train_confidence_only is set to True, and loss.weight.alpha_pae is enabled (1.0).

    Hardware Recommendations:

    • Recommended: NVIDIA A100 (80GB), H20, or H100.
    • Initial Training: Can be done on NVIDIA A800 (40GB) using BF16 mixed-precision.
    • Low Memory GPUs (e.g., NVIDIA A30): You must reduce model.pairformer.nblocks or diffusion_batch_size to avoid OOM.
  12. Download and configure ColabFold databases

    main

    After installing the dependencies, clone the ColabFold repository and use the provided setup script to initialize the databases in your target directory.

    Steps:

    1. Clone the ColabFold repository.
    2. Run ./setup_databases.sh with MMSEQS_NO_INDEX=1 to configure the database at the specified path.
    git clone https://github.com/sokrypton/ColabFold.git
    cd ColabFold
    MMSEQS_NO_INDEX=1 ./setup_databases.sh <path/to/colabfold_db>