$npx -y skills add adaptyvbio/protein-design-skills --skill chaiStructure prediction using Chai-1, a foundation model for molecular structure. Use this skill when: (1) Predicting protein-protein complex structures, (2) Validating designed binders, (3) Predicting protein-ligand complexes, (4) Using the Chai API for high-throughput prediction,
| 1 | # Chai-1 Structure Prediction |
| 2 | |
| 3 | ## Prerequisites |
| 4 | |
| 5 | | Requirement | Minimum | Recommended | |
| 6 | |-------------|---------|-------------| |
| 7 | | Python | 3.10+ | 3.11 | |
| 8 | | CUDA | 12.0+ | 12.1+ | |
| 9 | | GPU VRAM | 24GB | 40GB (A100) | |
| 10 | | RAM | 32GB | 64GB | |
| 11 | |
| 12 | ## How to run |
| 13 | |
| 14 | > **First time?** See [Getting started](../../docs/getting-started.md) to set up Modal and biomodals. |
| 15 | |
| 16 | ### Option 1: Modal |
| 17 | ```bash |
| 18 | cd biomodals |
| 19 | modal run modal_chai1.py \ |
| 20 | --input-faa complex.fasta \ |
| 21 | --out-dir predictions/ |
| 22 | ``` |
| 23 | |
| 24 | **GPU**: A100 (40GB) | **Timeout**: 30min default |
| 25 | |
| 26 | ### Option 2: Chai API (recommended) |
| 27 | ```bash |
| 28 | pip install chai_lab |
| 29 | |
| 30 | python -c " |
| 31 | import chai_lab |
| 32 | from chai_lab.chai1 import run_inference |
| 33 | |
| 34 | # Run prediction |
| 35 | run_inference( |
| 36 | fasta_file='complex.fasta', |
| 37 | output_dir='predictions/', |
| 38 | num_trunk_recycles=3 |
| 39 | ) |
| 40 | " |
| 41 | ``` |
| 42 | |
| 43 | ### Option 3: Local installation |
| 44 | ```bash |
| 45 | git clone https://github.com/chaidiscovery/chai-lab.git |
| 46 | cd chai-lab |
| 47 | pip install -e . |
| 48 | |
| 49 | chai-lab predict \ |
| 50 | --fasta complex.fasta \ |
| 51 | --output predictions/ |
| 52 | ``` |
| 53 | |
| 54 | ## FASTA Format |
| 55 | |
| 56 | ### Protein complex |
| 57 | ``` |
| 58 | >binder |
| 59 | MKTAYIAKQRQISFVKSHFSRQLE... |
| 60 | >target |
| 61 | MVLSPADKTNVKAAWGKVGAHAGE... |
| 62 | ``` |
| 63 | |
| 64 | ### Protein + ligand |
| 65 | ``` |
| 66 | >protein |
| 67 | MKTAYIAKQRQISFVKSHFSRQLE... |
| 68 | >ligand|smiles |
| 69 | CCO |
| 70 | ``` |
| 71 | |
| 72 | ### Protein + DNA/RNA |
| 73 | ``` |
| 74 | >protein |
| 75 | MKTAYIAKQRQISFVKSHFSRQLE... |
| 76 | >dna |
| 77 | ATCGATCGATCG |
| 78 | ``` |
| 79 | |
| 80 | ## Key parameters |
| 81 | |
| 82 | | Parameter | Default | Range | Description | |
| 83 | |-----------|---------|-------|-------------| |
| 84 | | `num_trunk_recycles` | 3 | 1-10 | Recycles (more = better) | |
| 85 | | `num_diffn_timesteps` | 200 | 50-500 | Diffusion steps | |
| 86 | | `seed` | 0 | int | Random seed | |
| 87 | |
| 88 | ## Output format |
| 89 | |
| 90 | ``` |
| 91 | predictions/ |
| 92 | ├── pred.model_idx_0.cif # Best model (CIF format) |
| 93 | ├── pred.model_idx_1.cif # Second model |
| 94 | ├── scores.json # Confidence scores |
| 95 | ├── pae.npy # PAE matrix |
| 96 | └── plddt.npy # pLDDT values |
| 97 | ``` |
| 98 | |
| 99 | **Note**: Chai-1 outputs CIF format. Convert to PDB if needed: |
| 100 | ```python |
| 101 | from Bio.PDB import MMCIFParser, PDBIO |
| 102 | parser = MMCIFParser() |
| 103 | structure = parser.get_structure("pred", "pred.model_idx_0.cif") |
| 104 | io = PDBIO() |
| 105 | io.set_structure(structure) |
| 106 | io.save("pred.model_idx_0.pdb") |
| 107 | ``` |
| 108 | |
| 109 | ### Extracting metrics |
| 110 | ```python |
| 111 | import numpy as np |
| 112 | import json |
| 113 | |
| 114 | # Load scores |
| 115 | with open('predictions/scores.json') as f: |
| 116 | scores = json.load(f) |
| 117 | |
| 118 | plddt = np.load('predictions/plddt.npy') |
| 119 | pae = np.load('predictions/pae.npy') |
| 120 | |
| 121 | print(f"pLDDT: {plddt.mean():.3f}") |
| 122 | print(f"pTM: {scores['ptm']:.3f}") |
| 123 | print(f"ipTM: {scores.get('iptm', 'N/A')}") |
| 124 | ``` |
| 125 | |
| 126 | ## Use cases |
| 127 | |
| 128 | ### Binder validation |
| 129 | ```python |
| 130 | # Predict complex with Chai |
| 131 | chai-lab predict --fasta binder_target.fasta --output val/ |
| 132 | |
| 133 | # Check ipTM > 0.5 |
| 134 | scores = json.load(open('val/scores.json')) |
| 135 | if scores['iptm'] > 0.5: |
| 136 | print("Design passes validation") |
| 137 | ``` |
| 138 | |
| 139 | ### Protein-ligand complex |
| 140 | ```python |
| 141 | # FASTA with SMILES |
| 142 | fasta = """ |
| 143 | >protein |
| 144 | MKTA... |
| 145 | >ligand|smiles |
| 146 | CCO |
| 147 | """ |
| 148 | |
| 149 | # Chai handles both protein and small molecules |
| 150 | ``` |
| 151 | |
| 152 | ### Batch prediction |
| 153 | ```bash |
| 154 | # Multiple sequences |
| 155 | for fasta in sequences/*.fasta; do |
| 156 | chai-lab predict \ |
| 157 | --fasta "$fasta" \ |
| 158 | --output "predictions/$(basename $fasta .fasta)" |
| 159 | done |
| 160 | ``` |
| 161 | |
| 162 | ## Comparison with AF2 |
| 163 | |
| 164 | | Aspect | Chai-1 | AlphaFold2 | |
| 165 | |--------|--------|------------| |
| 166 | | MSA required | No | Yes | |
| 167 | | Small molecules | Yes | No | |
| 168 | | DNA/RNA | Yes | Limited | |
| 169 | | Speed | Faster | Slower | |
| 170 | | Accuracy | Comparable | Reference | |
| 171 | |
| 172 | ## Sample output |
| 173 | |
| 174 | ### Successful run |
| 175 | ``` |
| 176 | $ chai-lab predict --fasta complex.fasta --output predictions/ |
| 177 | [INFO] Loading Chai-1 model... |
| 178 | [INFO] Running inference... |
| 179 | [INFO] Saved 5 models to predictions/ |
| 180 | |
| 181 | predictions/scores.json: |
| 182 | { |
| 183 | "ptm": 0.82, |
| 184 | "iptm": 0.71, |
| 185 | "ranking_score": 0.76 |
| 186 | } |
| 187 | ``` |
| 188 | |
| 189 | **What good output looks like:** |
| 190 | - pTM: > 0.7 (confident global structure) |
| 191 | - ipTM: > 0.5 (confident interface, > 0.7 for high confidence) |
| 192 | - CIF files with reasonable atom positions |
| 193 | |
| 194 | ## Decision tree |
| 195 | |
| 196 | ``` |
| 197 | Should I use Chai? |
| 198 | │ |
| 199 | ├─ What are you predicting? |
| 200 | │ ├─ Protein-protein complex → Chai ✓ or ColabFold |
| 201 | │ ├─ Protein + small molecule → Chai ✓ |
| 202 | │ ├─ Protein + DNA/RNA → Chai ✓ |
| 203 | │ └─ Single protein only → Use ESMFold (faster) |
| 204 | │ |
| 205 | ├─ Need MSA? |
| 206 | │ ├─ No / want speed → Chai ✓ |
| 207 | │ └─ Yes / want accuracy → ColabFold |
| 208 | │ |
| 209 | └─ Priority? |
| 210 | ├─ Highest accuracy → ColabFold with MSA |
| 211 | ├─ Speed / no MSA → Chai ✓ |
| 212 | └─ Ligand binding → Chai ✓ |
| 213 | ``` |
| 214 | |
| 215 | ## Typical performance |
| 216 | |
| 217 | | Campaign Size | Time (A100) | Cost (Modal) | Notes | |
| 218 | |---------------|-------------|--------------|-------| |