File size: 14,444 Bytes
d766458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# PXDesignBench: A Unified Evaluation Suite for Protein Design

This repository provides a comprehensive suite of tools for protein design evaluation, integrating multiple state-of-the-art models with standardized pipelines. It supports both monomer and binder design, enabling thorough assessment across diverse aspects of protein design.


## πŸ“‚ Repository Structure

The codebase is organized into three main components:

- `metrics`: Scripts for evaluating multiple aspects of protein design, including sequence quality, structure quality, and designability.

- `tasks`: Pipelines for executing specific protein design evaluations (e.g., monomer, binder).

- `tools`: Wrappers for external models (e.g., Protenix, ProteinMPNN, AlphaFold2, ESMFold) to streamline integration.

### Supported Tasks & Tools
| **Task**   | **Sequence Generation** | **Structure Consistency**             |
|------------|-------------------------|---------------------------------------|
| **Monomer**| ProteinMPNN             | πŸ”Ή ESMFold                            |
| **Binder** | ProteinMPNN             | πŸ”Ή AlphaFold2 <br> πŸ”Ή Protenix         |

---
<a name="install"></a>
## πŸ“¦ Installation

PXDesignBench supports two installation methods:

- βœ… **One-click installation script (Recommended)**
- 🐳 **Docker-based installation**

---

<a name="one-click-install"></a>
### βœ… One-Click Installation Script (Recommended)

We provide an installation script ``install.sh`` that sets up an  environment and installs all dependencies.

#### What the installer will do

1. Create a dedicated conda / mamba / micromamba environment  
2. Install **PyTorch** matching your specified CUDA version  
3. Install **Protenix**
4. Install **PXDesignBench**
5. Run **basic import sanity checks**  

#### Supported options

```bash

--env <name>           Environment name (default: pxdbench)

--pkg_manager <tool>   conda | mamba | micromamba (default: conda)

--cuda-version <ver>   CUDA version string, e.g. 12.1, 12.2, 12.4

                        Required. Must be >= 12.1.

```

Example:

```bash

bash install.sh --env pxdbench --pkg_manager conda --cuda-version 12.1

```

---

<a name="install-docker"></a>
### 🐳 Docker-Based Installation

#### Step 1: Build the Docker Image

```bash

docker build -t pxdbench -f Dockerfile .

```

#### Step 2: Start the Container

```bash

docker run -it --gpus all pxdbench bash

```

#### Step 3: Install PXDesignBench in the Container

Inside the container:

```bash

git clone https://github.com/bytedance/PXDesignBench.git

cd PXDesignBench

pip install -e .

```


## πŸ“₯ Download Required Model Weights (**Required**)

PXDesignBench relies on several external pretrained models (e.g., AF2, ProteinMPNN, etc.) for evaluation.  
These **weights are not bundled with the Python package and must be downloaded manually**.

After installing PXDesignBench, run:

```bash

bash download_tool_weights.sh

```

This script will automatically download and organize all required pretrained weights for:

- AlphaFold2
- ESMFold
- ProteinMPNN

Model weights for external tools are expected to be organized in a directory as follows:
```

β”œβ”€β”€ af2

β”‚   β”œβ”€β”€ LICENSE

β”‚   β”œβ”€β”€ params_model_{1..5}.npz

β”‚   β”œβ”€β”€ params_model_{1..5}_ptm.npz

β”‚   β”œβ”€β”€ params_model_{1..5}_multimer_v3.npz

β”‚

β”œβ”€β”€ esmfold

β”‚   β”œβ”€β”€ config.json

β”‚   β”œβ”€β”€ pytorch_model.bin

β”‚   β”œβ”€β”€ special_tokens_map.json

β”‚   β”œβ”€β”€ tokenizer_config.json

β”‚   └── vocab.txt

β”‚

β”œβ”€β”€ mpnn

β”‚   β”œβ”€β”€ ca_model_weights/...

β”‚   β”œβ”€β”€ soluble_model_weights/...

β”‚   └── vanilla_model_weights/...

```
**Note:** Required Protenix files (weights, CCD files, etc.) will be auto-downloaded on the first evaluation run.

---
## πŸš€ Running the Evaluation
We provide demo scripts for both monomer and binder design evaluation.
**Monomer evaluation example:**
```bash

bash monomer_eval_demo.sh

```

**Binder evaluation example:**
```bash

bash binder_eval_demo.sh

```

### Input Formats

PXDesignBench supports multiple input modes, allowing you to evaluate protein designs flexibly.  
The basic CLI arguments are:
- ``--data_dir``: Directory containing input structures.
- ``--dump_dir``: Output directory for evaluation results.
- ``--is_mmcif``: Flag indicating whether input files are in **mmCIF** format (otherwise assumed **PDB**).

**JSON-based Input**
One can also provide a JSON configuration file describing the evaluation task. This format allows fine-grained control over task parameters and is particularly useful for batch evaluation.

Example JSON:
```python

{

    "task": ...,          # "monomer" or "binder"

    "pdb_dir": ...,       # directory containing the input PDB structures

    "name": ...,          # name of the task; used to locate "{pdb_dir}/{pdb_name}.pdb"

    "pdb_names": ...,     # list of PDB file names to evaluate 

    "cond_chains": ...,   # list of condition chains (only for binder evaluation)

    "binder_chains": ..., # list of binder chains (binder evaluation only; currently supports **one** binder chain)

    "out_dir": ...        # directory to store evaluation results

}

```
Key points:

- Binder tasks require `binder_chains` to be explicitly specified.
- Currently only one binder chain is supported; all other chains will be treated as condition chains.
- `pdb_names` defines the exact structures to evaluate. If omitted, all files in `pdb_dir` with valid suffixes will be evaluated.

**Directory-based Input**
Instead of JSON, one may provide a directory path directly to `--data_dir`.
In this case:

- If `file_name_list` is provided, only matching files will be evaluated.
- Otherwise, all files in the directory with valid extensions will be included.


### Binder Evaluation with Additional Metadata

Binder evaluation supports passing a JSON file to specify additional metadata beyond the default inputs.  
This is useful for advanced scenarios such as:

1. **Evaluating cropped sequences**  
   - If the sequence to be evaluated is a cropped segment of an original sequence, you can provide the **full original sequence** along with a `crop` field to specify the range used in evaluation.  
   - The crop range can be multiple ranges such as `"1-120,130-150"` (comma-separated ranges, 1-based indexing, inclusive).

2. **Providing precomputed MSA for Protenix filter**  
   - The Protenix filter requires the target chain's MSA.  
   - By default, the evaluation script will automatically call the Protenix MSA server to compute the MSA.  
   - If you have already computed the MSA locally, you can skip the server call by specifying the `msa` field with:
     - `precomputed_msa_dir`: Path to the local MSA directory.
     - `pairing_db`: `uniref100`.

**Example JSON input:**
```json

[

    {

        "proteinChain": {

            "sequence": "NAFTVTVPKDLYVVEYGSNMTIECKFPVEKQLDLAALIVYWEMEDKNIIQFVHGEEDLKVQHSSYRQRARLLKDQLSLGNAALQITDVKLQDAGVYRCMISYGGADYKRITVKVNA",

            "label_asym_id": ["A0"],

            "use_msa": true,

            "msa": {

                "precomputed_msa_dir": "examples/msa/PDL1/0",

                "pairing_db": "uniref100"

            },

            "crop": "1-116"

        }

    }

]

```

### Multi-GPU / Distributed Evaluation
PXDesignBench exposes device IDs for each integrated model, enabling:
- Deployment across multiple GPUs for **parallel evaluation**.
- Integration into **DDP (Distributed Data Parallel)** training pipelines for **online evaluation tracking**.

For example, the following is a pseudocode snippet illustrating online evaluation tracking in the DDP model training pipeline:
```python

from pxdbench.run import run_task

from protenix.utils.distributed import DIST_WRAPPER



@torch.no_grad()

def _evaluate_design(self):

    # Sampling stage

    self._inference_design()

    DIST_WRAPPER.barrier()



    # Load task list

    with open(self._get_eval_json_path(), "r") as f:

        all_eval_tasks = json.load(f)



    # Distribute tasks among workers

    task_indices = list(range(len(all_eval_tasks)))[DIST_WRAPPER.rank::DIST_WRAPPER.world_size]

    if not task_indices:

        self.local_print("No task to evaluate, skipping.")

        results = []

    else:

        self.local_print(f"Running {len(task_indices)} tasks...")

        results = [

            run_task(all_eval_tasks[i], self.configs.eval, device_id=DIST_WRAPPER.local_rank)

            for i in task_indices

        ]



    # Gather results

    all_eval_results = DIST_WRAPPER.all_gather_object(results)

    # Custom logging...

```

### Evaluation Process

- If `use_gt_seq=True`, the sequence from the input structure is used directly.
- If `use_gt_seq=False`, the tool will first run the assigned sequence generation model (e.g., ProteinMPNN) to generate sequences.
- Structure quality is then assessed using the corresponding structure prediction models:
  - Monomer β†’ ESMFold
  - Binder β†’ AlphaFold2 / Protenix
- Metrics include:
  - Self-consistency between predicted structures
  - Confidence scores from structure predictors (e.g., pLDDT, ipTM)
  - Shape-based metrics, e.g. secondary structure content (Ξ±-helix, Ξ²-sheet, loop ratios), radius of gyration, etc.
- Results are stored in a summary CSV for downstream analysis.

### Post-processing
PXDesignBench provides scripts for analyzing the **diversity** and **novelty** of generated protein structures.
To enable Foldseek-based diversity and novelty calculations, you must first install **Foldseek**, a structural alignment and similarity search tool.  
Foldseek is **not** bundled with PXDesignBench and must be installed separately.  
Please follow the official guide here: [Foldseek Installation](https://github.com/steineggerlab/foldseek#installation).

**Examples:**

- **Monomer post-processing**
```bash

python3 pxdbench/scripts/postprocess_monomer.py --input_dir examples/monomer

```
- **Binder post-processing**
```bash

python3 pxdbench/scripts/postprocess_binder.py --input_dir examples/binder --is_mmcif true

```

---

## πŸ“š Citing Related Work
If you use this repository, please cite the following works:

<details>
<summary>PXDesign</summary>

```bibtex

@article{ren2025pxdesign,

  title={PXDesign: Fast, Modular, and Accurate De Novo Design of Protein Binders},

  author={Ren, Milong and Sun, Jinyuan and Guan, Jiaqi and Liu, Cong and Gong, Chengyue and Wang, Yuzhe and Wang, Lan and Cai, Qixu and Chen, Xinshi and Xiao, Wenzhi},

  journal={bioRxiv},

  pages={2025--08},

  year={2025},

  publisher={Cold Spring Harbor Laboratory}

}

```
</details>

<details>
<summary>Protenix</summary>

```bibtex

@article{bytedance2025protenix,

  title={Protenix - Advancing Structure Prediction Through a Comprehensive AlphaFold3 Reproduction},

  author={ByteDance AML AI4Science Team and Chen, Xinshi and Zhang, Yuxuan and Lu, Chan and Ma, Wenzhi and Guan, Jiaqi and Gong, Chengyue and Yang, Jincai and Zhang, Hanyu and Zhang, Ke and Wu, Shenghao and Zhou, Kuangqi and Yang, Yanping and Liu, Zhenyu and Wang, Lan and Shi, Bo and Shi, Shaochen and Xiao, Wenzhi},

  year={2025},

  journal={bioRxiv},

  publisher={Cold Spring Harbor Laboratory},

  doi={10.1101/2025.01.08.631967},

  URL={https://www.biorxiv.org/content/early/2025/01/11/2025.01.08.631967},

  elocation-id={2025.01.08.631967},

  eprint={https://www.biorxiv.org/content/early/2025/01/11/2025.01.08.631967.full.pdf},

}

```
</details>

<details>
<summary>ProteinMPNN</summary>

```bibtex

@article{dauparas2022robust,

  title={Robust deep learning--based protein sequence design using ProteinMPNN},

  author={Dauparas, Justas and Anishchenko, Ivan and Bennett, Nathaniel and Bai, Hua and Ragotte, Robert J and Milles, Lukas F and Wicky, Basile IM and Courbet, Alexis and de Haas, Rob J and Bethel, Neville and others},

  journal={Science},

  volume={378},

  number={6615},

  pages={49--56},

  year={2022},

  publisher={American Association for the Advancement of Science}

}

```
</details>

<details>
<summary>ESMFold</summary>

```bibtex

@article{lin2023evolutionary,

  title={Evolutionary-scale prediction of atomic-level protein structure with a language model},

  author={Lin, Zeming and Akin, Halil and Rao, Roshan and Hie, Brian and Zhu, Zhongkai and Lu, Wenting and Smetanin, Nikita and Verkuil, Robert and Kabeli, Ori and Shmueli, Yaniv and others},

  journal={Science},

  volume={379},

  number={6637},

  pages={1123--1130},

  year={2023},

  publisher={American Association for the Advancement of Science}

}

```
</details>

<details>
<summary>AlphaFold2</summary>

```bibtex

@article{jumper2021highly,

  title={Highly accurate protein structure prediction with AlphaFold},

  author={Jumper, John and Evans, Richard and Pritzel, Alexander and Green, Tim and Figurnov, Michael and Ronneberger, Olaf and Tunyasuvunakool, Kathryn and Bates, Russ and {\v{Z}}{\'\i}dek, Augustin and Potapenko, Anna and others},

  journal={nature},

  volume={596},

  number={7873},

  pages={583--589},

  year={2021},

  publisher={Nature Publishing Group UK London}

}

```
</details>

## Contributing 

We welcome contributions from the community to help improve the evaluation tool!

πŸ“„ Check out the [Contributing Guide](CONTRIBUTING.md) to get started.

βœ… Code Quality: 
We use `pre-commit` hooks to ensure consistency and code quality. Please install them before making commits:

```bash

pip install pre-commit

pre-commit install

```

## Code of Conduct

We are committed to fostering a welcoming and inclusive environment.
Please review our [Code of Conduct](CODE_OF_CONDUCT.md) for guidelines on how to participate respectfully.


## Security

If you discover a potential security issue in this project, or think you may
have discovered a security issue, we ask that you notify Bytedance Security via our [security center](https://security.bytedance.com/src) or [vulnerability reporting email](sec@bytedance.com).

Please do **not** create a public GitHub issue.

## License

This project is licensed under the [Apache 2.0 License](./LICENSE). It is free for both academic research and commercial use.