Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +22 -10
- README.md +260 -0
- configs/__init__.py +1 -0
- configs/__pycache__/__init__.cpython-311.pyc +0 -0
- configs/dataset/__init__.py +1 -0
- configs/dataset/pdb/__init__.py +1 -0
- configs/dataset/pdb/pdb_train_motif_aa.yaml +54 -0
- configs/dataset/pdb/pdb_train_motif_tip.yaml +54 -0
- configs/dataset/pdb/pdb_train_ucond.yaml +46 -0
- configs/experiment_config/__init__.py +1 -0
- configs/experiment_config/inference_my.yaml +9 -0
- configs/generation/__init__.py +1 -0
- configs/generation/motif.yaml +76 -0
- configs/generation/motif_dict.yaml +418 -0
- configs/generation/uncond_codes.yaml +76 -0
- configs/generation/uncond_codes_800.yaml +74 -0
- configs/generation/validation_local_latents.yaml +167 -0
- configs/inference_ae.yaml +24 -0
- configs/inference_base.yaml +61 -0
- configs/inference_motif_idx_aa.yaml +16 -0
- configs/inference_motif_idx_tip.yaml +16 -0
- configs/inference_motif_uidx_aa.yaml +16 -0
- configs/inference_motif_uidx_tip.yaml +16 -0
- configs/inference_my.yaml +13 -0
- configs/inference_ucond_notri.yaml +9 -0
- configs/inference_ucond_notri_long.yaml +17 -0
- configs/inference_ucond_tri.yaml +9 -0
- configs/nn/__init__.py +1 -0
- configs/nn/local_latents_score_nn_160M.yaml +47 -0
- configs/nn/local_latents_score_nn_160M_motif_idx_aa.yaml +45 -0
- configs/nn/local_latents_score_nn_160M_motif_idx_tip.yaml +45 -0
- configs/nn/local_latents_score_nn_160M_motif_uidx.yaml +45 -0
- configs/nn/local_latents_score_nn_160M_tri.yaml +48 -0
- configs/nn_ae/__init__.py +1 -0
- configs/nn_ae/nn_130m.yaml +73 -0
- configs/training_ae.yaml +67 -0
- configs/training_local_latents.yaml +96 -0
- models/__init__.py +5 -0
- models/__pycache__/__init__.cpython-311.pyc +0 -0
- models/__pycache__/evaluate.cpython-311.pyc +0 -0
- models/__pycache__/generate.cpython-311.pyc +0 -0
- models/__pycache__/package_config.cpython-311.pyc +0 -0
- models/__pycache__/proteina.cpython-311.pyc +0 -0
- models/__pycache__/train.cpython-311.pyc +0 -0
- models/datasets/__pycache__/base_data.cpython-311.pyc +0 -0
- models/datasets/__pycache__/gen_dataset.cpython-311.pyc +0 -0
- models/datasets/__pycache__/pdb_data.cpython-311.pyc +0 -0
- models/datasets/__pycache__/transforms.cpython-311.pyc +0 -0
- models/datasets/base_data.py +205 -0
- models/datasets/gen_dataset.py +427 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,47 @@
|
|
| 1 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 4 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
| 5 |
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 6 |
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 11 |
*.model filter=lfs diff=lfs merge=lfs -text
|
| 12 |
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
| 13 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 14 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 15 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 16 |
*.pb filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
| 17 |
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 18 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 19 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 20 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 21 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 22 |
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 23 |
*.tgz filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 24 |
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 25 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.db* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.ark* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*.gguf* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.ggml filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.llamafile* filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.pt2 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 46 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -textmodels/nn/__pycache__/feature_factory.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- OneScience/la-proteina
|
| 4 |
+
frameworks:
|
| 5 |
+
- ""
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
tags:
|
| 10 |
+
- OneScience
|
| 11 |
+
- protein structure generation
|
| 12 |
+
---
|
| 13 |
+
<p align="center">
|
| 14 |
+
<strong>
|
| 15 |
+
<span style="font-size: 30px;">La-Proteina</span>
|
| 16 |
+
</strong>
|
| 17 |
+
</p>
|
| 18 |
+
|
| 19 |
+
# Model Overview
|
| 20 |
+
|
| 21 |
+
La-Proteina is a protein structure generation model based on **Partially Latent Flow Matching**. It can directly generate all-atom protein structures together with their corresponding amino acid sequences.
|
| 22 |
+
|
| 23 |
+
Paper: _La-Proteina: Atomistic Protein Generation via Partially Latent Flow Matching_ (arXiv 2025).
|
| 24 |
+
|
| 25 |
+
- [Paper link](https://arxiv.org/abs/2507.09466)
|
| 26 |
+
|
| 27 |
+
# Model Description
|
| 28 |
+
|
| 29 |
+
La-Proteina explicitly models the protein backbone (backbone CA), while sequence and atom-level details are captured through fixed-dimensional latent variables for each residue. This effectively avoids the challenges introduced by explicit side-chain representations.
|
| 30 |
+
|
| 31 |
+
# Use Cases
|
| 32 |
+
|
| 33 |
+
| Use case | Description |
|
| 34 |
+
| :---: | :---: |
|
| 35 |
+
| Protein structure generation | Generates protein backbones (backbone CA) and local latents based on flow matching. |
|
| 36 |
+
| Motif-constrained generation | Supports motif position and sequence constraints for backbone design around functional motifs. |
|
| 37 |
+
| Diffusion model training | Trains the main La-Proteina model on PDB datasets. |
|
| 38 |
+
| Autoencoder training and inference | Trains the local-latent autoencoder and performs encoding, decoding, and reconstruction evaluation on PDB structures. |
|
| 39 |
+
| Generated result evaluation | Computes metrics such as RMSD, sequence recovery, and (co-)designability. |
|
| 40 |
+
|
| 41 |
+
# Usage
|
| 42 |
+
|
| 43 |
+
## 1. Using OneCode
|
| 44 |
+
|
| 45 |
+
You can try intelligent one-click AI4S programming through the OneCode online environment:
|
| 46 |
+
|
| 47 |
+
[Try intelligent one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
|
| 48 |
+
|
| 49 |
+
## 2. Manual Installation and Usage
|
| 50 |
+
|
| 51 |
+
**Hardware Requirements**
|
| 52 |
+
|
| 53 |
+
- Running on a GPU or DCU is recommended.
|
| 54 |
+
- CPU can be used for connectivity checks, but it is relatively slow.
|
| 55 |
+
- DCU users need to install DTK in advance. DTK 25.04.2 or later is recommended, or the OneScience-recommended version that matches the current cluster.
|
| 56 |
+
|
| 57 |
+
**Software Requirements**
|
| 58 |
+
|
| 59 |
+
DCU users who want to learn more about adaptation details can contact liubiao@sugon.com.
|
| 60 |
+
|
| 61 |
+
**Environment Checks**
|
| 62 |
+
|
| 63 |
+
- NVIDIA GPU:
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
nvidia-smi
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
- Hygon DCU:
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
hy-smi
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### Environment Preparation
|
| 76 |
+
|
| 77 |
+
Optional: override the default paths through environment variables:
|
| 78 |
+
|
| 79 |
+
```bash
|
| 80 |
+
export LAPROTEINA_ROOT=/path/to/la-proteina
|
| 81 |
+
export LAPROTEINA_DATASET_DIR=/path/to/dataset
|
| 82 |
+
export LAPROTEINA_CHECKPOINTS_DIR=/path/to/checkpoints_laproteina
|
| 83 |
+
export DATA_PATH=/path/to/dataset
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Quick Start
|
| 87 |
+
|
| 88 |
+
### 1. Install the Runtime Environment
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
conda create -n onescience311 python=3.11 -y
|
| 92 |
+
conda activate onescience311
|
| 93 |
+
pip install onescience[bio] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
If the following code cannot find required libraries at runtime, activate CUDA as shown below.
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
source ${ROCM_PATH}/cuda/env.sh
|
| 100 |
+
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
|
| 101 |
+
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib/python3.11/site-packages/fastpt/torch/lib:$LD_LIBRARY_PATH"
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
### 2. Download the Model Package
|
| 105 |
+
|
| 106 |
+
```bash
|
| 107 |
+
# By default, the package is downloaded to the model folder under the current path. To change this, adjust the path after local_dir.
|
| 108 |
+
hf download --model OneScience-Sugon/La-Proteina --local-dir ./model
|
| 109 |
+
cd model
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
### Training Weights and Datasets
|
| 113 |
+
|
| 114 |
+
They will be uploaded to Hugging Face soon, and command-line downloads will be supported later.
|
| 115 |
+
|
| 116 |
+
### 3. Usage Modes
|
| 117 |
+
|
| 118 |
+
It is recommended to run the scripts under the `laproteina` directory so that outputs are managed in one place.
|
| 119 |
+
|
| 120 |
+
#### 1. Train the Main La-Proteina Model (`run_train.sh`)
|
| 121 |
+
|
| 122 |
+
```bash
|
| 123 |
+
bash scripts/run_train.sh
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
**Common Hydra parameter overrides:**
|
| 127 |
+
|
| 128 |
+
```bash
|
| 129 |
+
# Single-device debugging
|
| 130 |
+
bash scripts/run_train.sh hardware.ngpus_per_node_=1 single=true
|
| 131 |
+
|
| 132 |
+
# Specify a run name
|
| 133 |
+
bash scripts/run_train.sh run_name=my_laproteina_run
|
| 134 |
+
|
| 135 |
+
# Override dataset or network configuration (for motif training scenarios)
|
| 136 |
+
bash scripts/run_train.sh dataset=pdb/pdb_train_motif_aa nn=local_latents_score_nn_160M_motif_idx_aa
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
Output:
|
| 140 |
+
|
| 141 |
+
- `./store/<run_name>/`: training logs, checkpoints, and Hydra configurations
|
| 142 |
+
|
| 143 |
+
#### 2. Protein Structure Generation (`run_generate.sh`)
|
| 144 |
+
|
| 145 |
+
```bash
|
| 146 |
+
bash scripts/run_generate.sh
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
By default, the `inference_ucond_tri` configuration is used for unconditional generation (LD2 model + AE1).
|
| 150 |
+
|
| 151 |
+
**Switching generation configurations:**
|
| 152 |
+
|
| 153 |
+
```bash
|
| 154 |
+
# Unconditional generation without triangle attention
|
| 155 |
+
bash scripts/run_generate.sh --config_name inference_ucond_notri
|
| 156 |
+
|
| 157 |
+
# Unconditional generation for long chains (300-800 residues)
|
| 158 |
+
bash scripts/run_generate.sh --config_name inference_ucond_notri_long
|
| 159 |
+
|
| 160 |
+
# Indexed all-atom motif scaffolding
|
| 161 |
+
bash scripts/run_generate.sh --config_name inference_motif_idx_aa
|
| 162 |
+
|
| 163 |
+
# Indexed tip-atom motif scaffolding
|
| 164 |
+
bash scripts/run_generate.sh --config_name inference_motif_idx_tip
|
| 165 |
+
|
| 166 |
+
# Unindexed all-atom motif scaffolding
|
| 167 |
+
bash scripts/run_generate.sh --config_name inference_motif_uidx_aa
|
| 168 |
+
|
| 169 |
+
# Unindexed tip-atom motif scaffolding
|
| 170 |
+
bash scripts/run_generate.sh --config_name inference_motif_uidx_tip
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
Output:
|
| 174 |
+
|
| 175 |
+
- `./inference/<config_name>/`: generated protein structure files and metadata
|
| 176 |
+
|
| 177 |
+
---
|
| 178 |
+
|
| 179 |
+
#### 3. Generated Result Evaluation (`run_evaluate.sh`)
|
| 180 |
+
|
| 181 |
+
```bash
|
| 182 |
+
bash scripts/run_evaluate.sh
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
By default, this evaluates the generated results corresponding to the `inference_ucond_tri` configuration.
|
| 186 |
+
|
| 187 |
+
**Preparing ProteinMPNN weights:**
|
| 188 |
+
|
| 189 |
+
ProteinMPNN weights must be downloaded before evaluation. They can be downloaded from the Hugging Face community:
|
| 190 |
+
|
| 191 |
+
```bash
|
| 192 |
+
hf download --model OneScience-Sugon/ProteinMPNN --local-dir ./weight
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
Output:
|
| 196 |
+
|
| 197 |
+
- `./inference/<config_name>/evaluation/`: evaluation result files
|
| 198 |
+
|
| 199 |
+
---
|
| 200 |
+
|
| 201 |
+
#### 4. Autoencoder Inference (`run_ae_infer.sh`)
|
| 202 |
+
|
| 203 |
+
```bash
|
| 204 |
+
bash scripts/run_ae_infer.sh
|
| 205 |
+
```
|
| 206 |
+
|
| 207 |
+
This performs encode-decode reconstruction on the PDB dataset and evaluates reconstruction metrics, such as all-atom RMSD and sequence recovery.
|
| 208 |
+
|
| 209 |
+
The script checks whether `DATA_PATH/pdb_train` and `AE1_ucond_512.ckpt` exist.
|
| 210 |
+
|
| 211 |
+
The script internally calls:
|
| 212 |
+
|
| 213 |
+
```bash
|
| 214 |
+
python infer_laproteina_ae.py "$@"
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
Common parameter overrides:
|
| 218 |
+
|
| 219 |
+
| Environment variable | Default value | Description |
|
| 220 |
+
|----------|--------|------|
|
| 221 |
+
| `LAPROTEINA_ROOT` | `${ONESCIENCE_DATASETS_DIR}/la-proteina` | Root directory for data and weights |
|
| 222 |
+
| `LAPROTEINA_CHECKPOINTS_DIR` | `${LAPROTEINA_ROOT}/checkpoints_laproteina` | Autoencoder weight directory |
|
| 223 |
+
| `DATA_PATH` | `${LAPROTEINA_ROOT}/dataset` | Dataset directory |
|
| 224 |
+
|
| 225 |
+
Output:
|
| 226 |
+
|
| 227 |
+
- `./inference_ae/`: reconstructed structures and evaluation metrics
|
| 228 |
+
|
| 229 |
+
### Notes
|
| 230 |
+
|
| 231 |
+
- Make sure the `ONESCIENCE_DATASETS_DIR` environment variable is correctly set before running the scripts.
|
| 232 |
+
- The training script checks whether `DATA_PATH/pdb_train` and `AE1_ucond_512.ckpt` exist by default. If either is missing, it will report an error and exit.
|
| 233 |
+
- In the current integration, `dataset=pdb` is available. `dataset=genie2` and `dataset=pdb_multimer` are not packaged in the current repository snapshot, and running them will produce an explicit error.
|
| 234 |
+
- The scripts automatically set ROCm/DCU-related `LD_LIBRARY_PATH` values and can run directly on Hygon DCU platforms. On CUDA platforms, these settings can be ignored or adjusted as needed.
|
| 235 |
+
- When generating motif scaffold structures, make sure the LD model is correctly paired with the corresponding AE model. Otherwise, generation may fail due to length or task mismatch.
|
| 236 |
+
- Evaluating (co-)designability requires ProteinMPNN weights. Run `script_utils/download_pmpnn_weights.sh` in advance to download them.
|
| 237 |
+
- It is recommended to run all scripts under `examples/biosciences/laproteina` so that output directories remain unified.
|
| 238 |
+
- When overriding configurations through Hydra, you can use `+CK_PATH=...` to specify the checkpoint root path. If it is not provided, the script automatically sets it to `LAPROTEINA_ROOT`.
|
| 239 |
+
|
| 240 |
+
# Official OneScience Information
|
| 241 |
+
|
| 242 |
+
| Platform | OneScience main repository | Skills repository |
|
| 243 |
+
| --- | --- | --- |
|
| 244 |
+
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
|
| 245 |
+
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
|
| 246 |
+
|
| 247 |
+
# Citation and License
|
| 248 |
+
|
| 249 |
+
The example code is licensed under Apache 2.0. La-Proteina model weights are licensed under the [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/), and other materials are licensed under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/legalcode).
|
| 250 |
+
|
| 251 |
+
If you use La-Proteina in your research, please cite the original paper:
|
| 252 |
+
|
| 253 |
+
```bibtex
|
| 254 |
+
@article{geffner2025laproteina,
|
| 255 |
+
title={La-Proteina: Atomistic Protein Generation via Partially Latent Flow Matching},
|
| 256 |
+
author={Geffner, Tomas and Didi, Kieran and Cao, Zhonglin and Reidenbach, Danny and Zhang, Zuobai and Dallago, Christian and Kucukbenli, Emine and Kreis, Karsten and Vahdat, Arash},
|
| 257 |
+
journal={arXiv preprint arXiv:2507.09466},
|
| 258 |
+
year={2025}
|
| 259 |
+
}
|
| 260 |
+
```
|
configs/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (171 Bytes). View file
|
|
|
configs/dataset/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/dataset/pdb/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/dataset/pdb/pdb_train_motif_aa.yaml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datamodule:
|
| 2 |
+
_target_: "models.datasets.pdb_data.PDBLightningDataModule"
|
| 3 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 4 |
+
in_memory: False
|
| 5 |
+
format: "cif" # format for file download
|
| 6 |
+
overwrite: False # Whether to overwrite existing dataset files and reprocess the raw data
|
| 7 |
+
# arguments for BaseLightningDataModule class
|
| 8 |
+
batch_padding: True # whether we want a sparse PyG batch or a padded dense batch
|
| 9 |
+
sampling_mode: "cluster-random" # sample randomly inside each sequence similarity cluster during training
|
| 10 |
+
transforms:
|
| 11 |
+
- _target_: "models.datasets.transforms.CoordsToNanometers"
|
| 12 |
+
- _target_: "models.datasets.transforms.CenterStructureTransform"
|
| 13 |
+
- _target_: "models.datasets.transforms.GlobalRotationTransform"
|
| 14 |
+
- _target_: "models.datasets.transforms.ChainBreakPerResidueTransform"
|
| 15 |
+
- _target_: "models.datasets.transforms.MotifMaskTransform"
|
| 16 |
+
atom_selection_mode: "all"
|
| 17 |
+
motif_max_pct_res: 0.3
|
| 18 |
+
motif_prob: 1.0
|
| 19 |
+
- _target_: "models.datasets.transforms.CenteringTransform"
|
| 20 |
+
center_mode: "motif"
|
| 21 |
+
data_mode: "all-atom"
|
| 22 |
+
- _target_: "models.datasets.transforms.ExtractMotifCoordinatesTransform"
|
| 23 |
+
batch_size: 2 # Batch size for dataloader
|
| 24 |
+
num_workers: 16 # Number of workers for dataloader
|
| 25 |
+
pin_memory: True # Pin memory for dataloader
|
| 26 |
+
|
| 27 |
+
dataselector:
|
| 28 |
+
_target_: "models.datasets.pdb_data.PDBDataSelector"
|
| 29 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 30 |
+
fraction: 0.001 # Fraction of dataset to use
|
| 31 |
+
molecule_type: "protein" # Type of molecule for which to select
|
| 32 |
+
experiment_types: ["diffraction", "EM"] # other options are "NMR" and "other"
|
| 33 |
+
min_length: 50 # Exclude peptides of length 50
|
| 34 |
+
max_length: 256 # Exclude polypeptides greater than length 500
|
| 35 |
+
oligomeric_min: null
|
| 36 |
+
oligomeric_max: null
|
| 37 |
+
best_resolution: 0.0 # Include only proteins with resolution >= 0.0
|
| 38 |
+
worst_resolution: 5.0 # Include only proteins with resolution <= 5.0
|
| 39 |
+
has_ligands: [] # Include only proteins containing the ligand `ZN`
|
| 40 |
+
remove_ligands: [] # Exclude specific ligands from any available protein-ligand complexes
|
| 41 |
+
remove_non_standard_residues: True # Include only proteins containing standard amino acid residues
|
| 42 |
+
remove_pdb_unavailable: True # Include only proteins that are available to download
|
| 43 |
+
exclude_ids: ["9b57", "9b5p", "9b5s", "9b5n", "9b5a", "9b5k", "9b5v", "9b59", "9b5w", "9b5g", "9b5i", "9b5x", "9b5d", "9b5e", "9b5t", "9b5f",
|
| 44 |
+
"9b5o", "9b58", "9b5u", "9b5c", "9b5j", "9b5b", "9b5h", "9b5q", "9b5l", "9b56", "9b5m", "9b5l", "9b55", "9b5r", "9ij9", "9iix",
|
| 45 |
+
"2ezq", "1kld", "1crr", "2ezs", "2ezr", "1vve", "7ll9_G"] # These ids are failed to be processed
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
datasplitter:
|
| 49 |
+
_target_: "models.datasets.pdb_data.PDBDataSplitter"
|
| 50 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 51 |
+
train_val_test: [0.98, 0.019, 0.001] # Cross-validation ratios to use for train, val, and test splits
|
| 52 |
+
split_type: "sequence_similarity" # Split sequences by sequence similarity clustering, other option is "random"
|
| 53 |
+
split_sequence_similarity: 0.5 # Clustering at 50% sequence similarity (argument is ignored if split_type!="sequence_similarity")
|
| 54 |
+
overwrite_sequence_clusters: False # Previous clusterings at same sequence similarity are reused and not overwritten (argument is ignored if split_type!="sequence_similarity")
|
configs/dataset/pdb/pdb_train_motif_tip.yaml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datamodule:
|
| 2 |
+
_target_: "models.datasets.pdb_data.PDBLightningDataModule"
|
| 3 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 4 |
+
in_memory: False
|
| 5 |
+
format: "cif" # format for file download
|
| 6 |
+
overwrite: False # Whether to overwrite existing dataset files and reprocess the raw data
|
| 7 |
+
# arguments for BaseLightningDataModule class
|
| 8 |
+
batch_padding: True # whether we want a sparse PyG batch or a padded dense batch
|
| 9 |
+
sampling_mode: "cluster-random" # sample randomly inside each sequence similarity cluster during training
|
| 10 |
+
transforms:
|
| 11 |
+
- _target_: "models.datasets.transforms.CoordsToNanometers"
|
| 12 |
+
- _target_: "models.datasets.transforms.CenterStructureTransform"
|
| 13 |
+
- _target_: "models.datasets.transforms.GlobalRotationTransform"
|
| 14 |
+
- _target_: "models.datasets.transforms.ChainBreakPerResidueTransform"
|
| 15 |
+
- _target_: "models.datasets.transforms.MotifMaskTransform"
|
| 16 |
+
atom_selection_mode: "tip_atoms"
|
| 17 |
+
motif_max_pct_res: 0.3
|
| 18 |
+
motif_prob: 1.0
|
| 19 |
+
- _target_: "models.datasets.transforms.CenteringTransform"
|
| 20 |
+
center_mode: "motif"
|
| 21 |
+
data_mode: "all-atom"
|
| 22 |
+
- _target_: "models.datasets.transforms.ExtractMotifCoordinatesTransform"
|
| 23 |
+
batch_size: 2 # Batch size for dataloader
|
| 24 |
+
num_workers: 16 # Number of workers for dataloader
|
| 25 |
+
pin_memory: True # Pin memory for dataloader
|
| 26 |
+
|
| 27 |
+
dataselector:
|
| 28 |
+
_target_: "models.datasets.pdb_data.PDBDataSelector"
|
| 29 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 30 |
+
fraction: 0.001 # Fraction of dataset to use
|
| 31 |
+
molecule_type: "protein" # Type of molecule for which to select
|
| 32 |
+
experiment_types: ["diffraction", "EM"] # other options are "NMR" and "other"
|
| 33 |
+
min_length: 50 # Exclude peptides of length 50
|
| 34 |
+
max_length: 256 # Exclude polypeptides greater than length 500
|
| 35 |
+
oligomeric_min: null
|
| 36 |
+
oligomeric_max: null
|
| 37 |
+
best_resolution: 0.0 # Include only proteins with resolution >= 0.0
|
| 38 |
+
worst_resolution: 5.0 # Include only proteins with resolution <= 5.0
|
| 39 |
+
has_ligands: [] # Include only proteins containing the ligand `ZN`
|
| 40 |
+
remove_ligands: [] # Exclude specific ligands from any available protein-ligand complexes
|
| 41 |
+
remove_non_standard_residues: True # Include only proteins containing standard amino acid residues
|
| 42 |
+
remove_pdb_unavailable: True # Include only proteins that are available to download
|
| 43 |
+
exclude_ids: ["9b57", "9b5p", "9b5s", "9b5n", "9b5a", "9b5k", "9b5v", "9b59", "9b5w", "9b5g", "9b5i", "9b5x", "9b5d", "9b5e", "9b5t", "9b5f",
|
| 44 |
+
"9b5o", "9b58", "9b5u", "9b5c", "9b5j", "9b5b", "9b5h", "9b5q", "9b5l", "9b56", "9b5m", "9b5l", "9b55", "9b5r", "9ij9", "9iix",
|
| 45 |
+
"2ezq", "1kld", "1crr", "2ezs", "2ezr", "1vve", "7ll9_G"] # These ids are failed to be processed
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
datasplitter:
|
| 49 |
+
_target_: "models.datasets.pdb_data.PDBDataSplitter"
|
| 50 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 51 |
+
train_val_test: [0.98, 0.019, 0.001] # Cross-validation ratios to use for train, val, and test splits
|
| 52 |
+
split_type: "sequence_similarity" # Split sequences by sequence similarity clustering, other option is "random"
|
| 53 |
+
split_sequence_similarity: 0.5 # Clustering at 50% sequence similarity (argument is ignored if split_type!="sequence_similarity")
|
| 54 |
+
overwrite_sequence_clusters: False # Previous clusterings at same sequence similarity are reused and not overwritten (argument is ignored if split_type!="sequence_similarity")
|
configs/dataset/pdb/pdb_train_ucond.yaml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
datamodule:
|
| 2 |
+
_target_: "models.datasets.pdb_data.PDBLightningDataModule"
|
| 3 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 4 |
+
in_memory: False
|
| 5 |
+
format: "cif" # format for file download
|
| 6 |
+
overwrite: False # Whether to overwrite existing dataset files and reprocess the raw data
|
| 7 |
+
# arguments for BaseLightningDataModule class
|
| 8 |
+
batch_padding: True # whether we want a sparse PyG batch or a padded dense batch
|
| 9 |
+
sampling_mode: "cluster-random" # sample randomly inside each sequence similarity cluster during training
|
| 10 |
+
transforms:
|
| 11 |
+
- _target_: "models.datasets.transforms.CoordsToNanometers"
|
| 12 |
+
- _target_: "models.datasets.transforms.CenterStructureTransform"
|
| 13 |
+
- _target_: "models.datasets.transforms.GlobalRotationTransform" # Transforms to apply to dataset examples
|
| 14 |
+
- _target_: "models.datasets.transforms.ChainBreakPerResidueTransform"
|
| 15 |
+
batch_size: 4 # Batch size for dataloader
|
| 16 |
+
num_workers: 16 # Number of workers for dataloader
|
| 17 |
+
pin_memory: True # Pin memory for dataloader
|
| 18 |
+
|
| 19 |
+
dataselector:
|
| 20 |
+
_target_: "models.datasets.pdb_data.PDBDataSelector"
|
| 21 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 22 |
+
fraction: 0.001 # Fraction of dataset to use
|
| 23 |
+
molecule_type: "protein" # Type of molecule for which to select
|
| 24 |
+
experiment_types: ["diffraction", "EM"] # other options are "NMR" and "other"
|
| 25 |
+
min_length: 50 # Exclude peptides of length 50
|
| 26 |
+
max_length: 256 # Exclude polypeptides greater than length 500
|
| 27 |
+
oligomeric_min: null
|
| 28 |
+
oligomeric_max: null
|
| 29 |
+
best_resolution: 0.0 # Include only proteins with resolution >= 0.0
|
| 30 |
+
worst_resolution: 5.0 # Include only proteins with resolution <= 5.0
|
| 31 |
+
has_ligands: [] # Include only proteins containing the ligand `ZN`
|
| 32 |
+
remove_ligands: [] # Exclude specific ligands from any available protein-ligand complexes
|
| 33 |
+
remove_non_standard_residues: True # Include only proteins containing standard amino acid residues
|
| 34 |
+
remove_pdb_unavailable: True # Include only proteins that are available to download
|
| 35 |
+
exclude_ids: ["9b57", "9b5p", "9b5s", "9b5n", "9b5a", "9b5k", "9b5v", "9b59", "9b5w", "9b5g", "9b5i", "9b5x", "9b5d", "9b5e", "9b5t", "9b5f",
|
| 36 |
+
"9b5o", "9b58", "9b5u", "9b5c", "9b5j", "9b5b", "9b5h", "9b5q", "9b5l", "9b56", "9b5m", "9b5l", "9b55", "9b5r", "9ij9", "9iix",
|
| 37 |
+
"2ezq", "1kld", "1crr", "2ezs", "2ezr", "1vve", "7ll9_G"] # These ids are failed to be processed
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
datasplitter:
|
| 41 |
+
_target_: "models.datasets.pdb_data.PDBDataSplitter"
|
| 42 |
+
data_dir: ${oc.env:DATA_PATH}/pdb_train/ # Directory where the dataset is stored
|
| 43 |
+
train_val_test: [0.98, 0.019, 0.001] # Cross-validation ratios to use for train, val, and test splits
|
| 44 |
+
split_type: "sequence_similarity" # Split sequences by sequence similarity clustering, other option is "random"
|
| 45 |
+
split_sequence_similarity: 0.5 # Clustering at 50% sequence similarity (argument is ignored if split_type!="sequence_similarity")
|
| 46 |
+
overwrite_sequence_clusters: False # Previous clusterings at same sequence similarity are reused and not overwritten (argument is ignored if split_type!="sequence_similarity")
|
configs/experiment_config/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/experiment_config/inference_my.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: uncond_codes
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_ucond_notri
|
| 7 |
+
ckpt_path: ./store/test_release_diffusion/checkpoints
|
| 8 |
+
ckpt_name: last-EMA.ckpt
|
| 9 |
+
autoencoder_ckpt_path: ./store/test_release_ae/checkpoints/last-EMA.ckpt
|
configs/generation/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/generation/motif.yaml
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- motif_dict
|
| 3 |
+
- _self_
|
| 4 |
+
|
| 5 |
+
# General sampling params
|
| 6 |
+
args:
|
| 7 |
+
fold_cond: False # not supported
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# Sampling dataset
|
| 11 |
+
dataset:
|
| 12 |
+
# Lengths to sample. If not None, then use length-centric sampling
|
| 13 |
+
# Uses `nres_lens` if specified, otherwise arange(min_len, max_len+1, step)
|
| 14 |
+
nlens_cfg:
|
| 15 |
+
nres_lens: null
|
| 16 |
+
min_len:
|
| 17 |
+
max_len:
|
| 18 |
+
step_len:
|
| 19 |
+
|
| 20 |
+
cath_codes: null # Not supported
|
| 21 |
+
|
| 22 |
+
# Number of samples per protein length or per cath code
|
| 23 |
+
nsamples: 200
|
| 24 |
+
|
| 25 |
+
# Maximum number of samples in each batch
|
| 26 |
+
max_nsamples_per_batch: 5
|
| 27 |
+
|
| 28 |
+
# Empirical (length, cath code) distribution
|
| 29 |
+
empirical_distribution_cfg:
|
| 30 |
+
# Path to the empirical (len, cath_code) distribution file
|
| 31 |
+
len_cath_code_path: null
|
| 32 |
+
|
| 33 |
+
# Level of cath codes to generate
|
| 34 |
+
cath_code_level: null
|
| 35 |
+
|
| 36 |
+
# Arguments for bucketizing the length distribution
|
| 37 |
+
bucket_min_len: 50
|
| 38 |
+
bucket_max_len: 274
|
| 39 |
+
bucket_step_size: 25
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Sampling metrics
|
| 43 |
+
metric:
|
| 44 |
+
# Designability metrics
|
| 45 |
+
compute_designability: True
|
| 46 |
+
designability_modes: ["ca", "bb3o"] # Options: ca, bb3o
|
| 47 |
+
designability_folding_models: ["esmfold"] # List of folding models to use
|
| 48 |
+
designability_motif_eval: True # Enable motif-specific designability evaluation
|
| 49 |
+
|
| 50 |
+
# Codesignability metrics
|
| 51 |
+
compute_codesignability: True
|
| 52 |
+
codesignability_modes: ["ca", "bb3o", "all_atom"] # Options: ca, bb3o, all_atom
|
| 53 |
+
codesignability_folding_models: ["esmfold"] # List of folding models to use
|
| 54 |
+
codesignability_motif_eval: True # Enable motif-specific codesignability evaluation
|
| 55 |
+
compute_co_sequence_recovery: False
|
| 56 |
+
|
| 57 |
+
# Direct motif RMSD evaluation (generated structure vs ground truth motif)
|
| 58 |
+
compute_motif_rmsd: True
|
| 59 |
+
motif_rmsd_modes: ["ca", "bb3o", "all_atom"] # Which atom models to compute for direct motif RMSD
|
| 60 |
+
|
| 61 |
+
# Output management
|
| 62 |
+
keep_folding_outputs: True # Whether to keep folding model outputs (PDB files) after evaluation.
|
| 63 |
+
# If false (default), temporary directories containing predicted structures
|
| 64 |
+
# are deleted to save disk space. If true, all folding outputs are preserved
|
| 65 |
+
# in the temporary directories for debugging and further analysis.
|
| 66 |
+
# WARNING: Keeping outputs can consume significant disk space!
|
| 67 |
+
|
| 68 |
+
# Novelty
|
| 69 |
+
compute_novelty_pdb: False
|
| 70 |
+
compute_novelty_afdb: False
|
| 71 |
+
compute_novelty_afdb_rep_v4: False
|
| 72 |
+
compute_novelty_afdb_rep_v4_geniefilters_maxlen512: False
|
| 73 |
+
|
| 74 |
+
# FID-related metrics
|
| 75 |
+
compute_fid: False
|
| 76 |
+
metric_factory: null
|
configs/generation/motif_dict.yaml
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
dataset:
|
| 2 |
+
motif_dict_cfg:
|
| 3 |
+
1PRW_AA:
|
| 4 |
+
contig_string: 5-20/A1-20/10-25/B1-20/5-20
|
| 5 |
+
motif_pdb_path: motif_benchmark_pdb_files/1prw_aa.pdb
|
| 6 |
+
motif_only: True
|
| 7 |
+
motif_min_length: 60
|
| 8 |
+
motif_max_length: 105
|
| 9 |
+
segment_order: "A;B"
|
| 10 |
+
atom_selection_mode: "all_atom"
|
| 11 |
+
1PRW_AA_TIP:
|
| 12 |
+
contig_string: 5-20/A1-20/10-25/B1-20/5-20
|
| 13 |
+
motif_pdb_path: motif_benchmark_pdb_files/1prw_aa.pdb
|
| 14 |
+
motif_only: True
|
| 15 |
+
motif_min_length: 60
|
| 16 |
+
motif_max_length: 105
|
| 17 |
+
segment_order: "A;B"
|
| 18 |
+
atom_selection_mode: "tip_atoms"
|
| 19 |
+
1BCF_AA:
|
| 20 |
+
contig_string: 8-15/A92-99/16-30/A123-130/16-30/A47-53/17-31/A18-25/8-15
|
| 21 |
+
motif_pdb_path: motif_benchmark_pdb_files/1bcf_aa.pdb
|
| 22 |
+
motif_only: True
|
| 23 |
+
motif_min_length: 96
|
| 24 |
+
motif_max_length: 152
|
| 25 |
+
segment_order: "A;B;C;D"
|
| 26 |
+
atom_selection_mode: "all_atom"
|
| 27 |
+
1BCF_AA_TIP:
|
| 28 |
+
contig_string: 8-15/A92-99/16-30/A123-130/16-30/A47-53/17-31/A18-25/8-15
|
| 29 |
+
motif_pdb_path: motif_benchmark_pdb_files/1bcf_aa.pdb
|
| 30 |
+
motif_only: True
|
| 31 |
+
motif_min_length: 96
|
| 32 |
+
motif_max_length: 152
|
| 33 |
+
segment_order: "A;B;C;D"
|
| 34 |
+
atom_selection_mode: "tip_atoms"
|
| 35 |
+
5TPN_AA:
|
| 36 |
+
contig_string: 10-40/A163-181/10-40
|
| 37 |
+
motif_pdb_path: motif_benchmark_pdb_files/5tpn_aa.pdb
|
| 38 |
+
motif_only: True
|
| 39 |
+
motif_min_length: 50
|
| 40 |
+
motif_max_length: 75
|
| 41 |
+
segment_order: A
|
| 42 |
+
atom_selection_mode: "all_atom"
|
| 43 |
+
5TPN_AA_TIP:
|
| 44 |
+
contig_string: 10-40/A163-181/10-40
|
| 45 |
+
motif_pdb_path: motif_benchmark_pdb_files/5tpn_aa.pdb
|
| 46 |
+
motif_only: True
|
| 47 |
+
motif_min_length: 50
|
| 48 |
+
motif_max_length: 75
|
| 49 |
+
segment_order: A
|
| 50 |
+
atom_selection_mode: "tip_atoms"
|
| 51 |
+
5IUS_AA:
|
| 52 |
+
contig_string: 0-30/B119-130/1/A132-140/15-40/A63-82/0-30
|
| 53 |
+
motif_pdb_path: motif_benchmark_pdb_files/5ius_aa.pdb
|
| 54 |
+
motif_only: True
|
| 55 |
+
motif_min_length: 57
|
| 56 |
+
motif_max_length: 142
|
| 57 |
+
segment_order: "B;A"
|
| 58 |
+
atom_selection_mode: "all_atom"
|
| 59 |
+
5IUS_AA_TIP:
|
| 60 |
+
contig_string: 0-30/B119-130/1/A132-140/15-40/A63-82/0-30
|
| 61 |
+
motif_pdb_path: motif_benchmark_pdb_files/5ius_aa.pdb
|
| 62 |
+
motif_only: True
|
| 63 |
+
motif_min_length: 57
|
| 64 |
+
motif_max_length: 142
|
| 65 |
+
segment_order: "B;A"
|
| 66 |
+
atom_selection_mode: "tip_atoms"
|
| 67 |
+
3IXT_AA:
|
| 68 |
+
contig_string: 10-40/P254-277/10-40
|
| 69 |
+
motif_pdb_path: motif_benchmark_pdb_files/3ixt_aa.pdb
|
| 70 |
+
motif_only: True
|
| 71 |
+
motif_min_length: 50
|
| 72 |
+
motif_max_length: 75
|
| 73 |
+
segment_order: A
|
| 74 |
+
atom_selection_mode: "all_atom"
|
| 75 |
+
3IXT_AA_TIP:
|
| 76 |
+
contig_string: 10-40/P254-277/10-40
|
| 77 |
+
motif_pdb_path: motif_benchmark_pdb_files/3ixt_aa.pdb
|
| 78 |
+
motif_only: True
|
| 79 |
+
motif_min_length: 50
|
| 80 |
+
motif_max_length: 75
|
| 81 |
+
segment_order: A
|
| 82 |
+
atom_selection_mode: "tip_atoms"
|
| 83 |
+
5YUI_AA:
|
| 84 |
+
contig_string: 5-30/A93-97/5-20/B118-120/10-35/C198-200/10-30
|
| 85 |
+
motif_pdb_path: motif_benchmark_pdb_files/5yui_aa.pdb
|
| 86 |
+
motif_only: True
|
| 87 |
+
motif_min_length: 50
|
| 88 |
+
motif_max_length: 100
|
| 89 |
+
segment_order: "A;B;C"
|
| 90 |
+
atom_selection_mode: "all_atom"
|
| 91 |
+
5YUI_AA_TIP:
|
| 92 |
+
contig_string: 5-30/A93-97/5-20/B118-120/10-35/C198-200/10-30
|
| 93 |
+
motif_pdb_path: motif_benchmark_pdb_files/5yui_aa.pdb
|
| 94 |
+
motif_only: True
|
| 95 |
+
motif_min_length: 50
|
| 96 |
+
motif_max_length: 100
|
| 97 |
+
segment_order: "A;B;C"
|
| 98 |
+
atom_selection_mode: "tip_atoms"
|
| 99 |
+
5AOU_AA:
|
| 100 |
+
contig_string: 40-60/A1051/20-40/A2083/20-35/A2110/100-140
|
| 101 |
+
motif_pdb_path: motif_benchmark_pdb_files/5aou_aa.pdb
|
| 102 |
+
motif_only: True
|
| 103 |
+
motif_min_length: 230
|
| 104 |
+
motif_max_length: 270
|
| 105 |
+
segment_order: "A;B;C"
|
| 106 |
+
atom_selection_mode: "all_atom"
|
| 107 |
+
5AOU_AA_TIP:
|
| 108 |
+
contig_string: 40-60/A1051/20-40/A2083/20-35/A2110/100-140
|
| 109 |
+
motif_pdb_path: motif_benchmark_pdb_files/5aou_aa.pdb
|
| 110 |
+
motif_only: True
|
| 111 |
+
motif_min_length: 230
|
| 112 |
+
motif_max_length: 270
|
| 113 |
+
segment_order: "A;B;C"
|
| 114 |
+
atom_selection_mode: "tip_atoms"
|
| 115 |
+
5AOU_QUAD_AA:
|
| 116 |
+
contig_string: 40-60/A1051/20-40/A2083/20-35/A2110/60-80/A2180/40-60
|
| 117 |
+
motif_pdb_path: motif_benchmark_pdb_files/5aou_quad_aa.pdb
|
| 118 |
+
motif_only: True
|
| 119 |
+
motif_min_length: 230
|
| 120 |
+
motif_max_length: 270
|
| 121 |
+
segment_order: "A;B;C;D"
|
| 122 |
+
atom_selection_mode: "all_atom"
|
| 123 |
+
5AOU_QUAD_AA_TIP:
|
| 124 |
+
contig_string: 40-60/A1051/20-40/A2083/20-35/A2110/60-80/A2180/40-60
|
| 125 |
+
motif_pdb_path: motif_benchmark_pdb_files/5aou_quad_aa.pdb
|
| 126 |
+
motif_only: True
|
| 127 |
+
motif_min_length: 230
|
| 128 |
+
motif_max_length: 270
|
| 129 |
+
segment_order: "A;B;C;D"
|
| 130 |
+
atom_selection_mode: "tip_atoms"
|
| 131 |
+
7K4V_AA:
|
| 132 |
+
contig_string: 40-50/A44/3-8/A50/70-85/A127/150-200
|
| 133 |
+
motif_pdb_path: motif_benchmark_pdb_files/7k4v_aa.pdb
|
| 134 |
+
motif_only: True
|
| 135 |
+
motif_min_length: 280
|
| 136 |
+
motif_max_length: 320
|
| 137 |
+
segment_order: "A;B;C"
|
| 138 |
+
atom_selection_mode: "all_atom"
|
| 139 |
+
7K4V_AA_TIP:
|
| 140 |
+
contig_string: 40-50/A44/3-8/A50/70-85/A127/150-200
|
| 141 |
+
motif_pdb_path: motif_benchmark_pdb_files/7k4v_aa.pdb
|
| 142 |
+
motif_only: True
|
| 143 |
+
motif_min_length: 280
|
| 144 |
+
motif_max_length: 320
|
| 145 |
+
segment_order: "A;B;C"
|
| 146 |
+
atom_selection_mode: "tip_atoms"
|
| 147 |
+
1YCR_AA:
|
| 148 |
+
contig_string: 10-40/B19-27/10-40
|
| 149 |
+
motif_pdb_path: motif_benchmark_pdb_files/1ycr_aa.pdb
|
| 150 |
+
motif_only: True
|
| 151 |
+
motif_min_length: 40
|
| 152 |
+
motif_max_length: 100
|
| 153 |
+
segment_order: "A"
|
| 154 |
+
atom_selection_mode: "all_atom"
|
| 155 |
+
1YCR_AA_TIP:
|
| 156 |
+
contig_string: 10-40/B19-27/10-40
|
| 157 |
+
motif_pdb_path: motif_benchmark_pdb_files/1ycr_aa.pdb
|
| 158 |
+
motif_only: True
|
| 159 |
+
motif_min_length: 40
|
| 160 |
+
motif_max_length: 100
|
| 161 |
+
segment_order: "A"
|
| 162 |
+
atom_selection_mode: "tip_atoms"
|
| 163 |
+
4JHW_AA:
|
| 164 |
+
contig_string: 10-25/F196-212/15-30/F63-69/10-25
|
| 165 |
+
motif_pdb_path: motif_benchmark_pdb_files/4jhw_aa.pdb
|
| 166 |
+
motif_only: True
|
| 167 |
+
motif_min_length: 60
|
| 168 |
+
motif_max_length: 90
|
| 169 |
+
segment_order: "B;A"
|
| 170 |
+
atom_selection_mode: "all_atom"
|
| 171 |
+
4JHW_AA_TIP:
|
| 172 |
+
contig_string: 10-25/F196-212/15-30/F63-69/10-25
|
| 173 |
+
motif_pdb_path: motif_benchmark_pdb_files/4jhw_aa.pdb
|
| 174 |
+
motif_only: True
|
| 175 |
+
motif_min_length: 60
|
| 176 |
+
motif_max_length: 90
|
| 177 |
+
segment_order: "B;A"
|
| 178 |
+
atom_selection_mode: "tip_atoms"
|
| 179 |
+
5WN9_AA:
|
| 180 |
+
contig_string: 10-40/A170-186/1/A188-189/10-40
|
| 181 |
+
motif_pdb_path: motif_benchmark_pdb_files/5wn9_aa.pdb
|
| 182 |
+
motif_only: True
|
| 183 |
+
motif_min_length: 35
|
| 184 |
+
motif_max_length: 50
|
| 185 |
+
segment_order: A
|
| 186 |
+
atom_selection_mode: "all_atom"
|
| 187 |
+
5WN9_AA_TIP:
|
| 188 |
+
contig_string: 10-40/A170-186/1/A188-189/10-40
|
| 189 |
+
motif_pdb_path: motif_benchmark_pdb_files/5wn9_aa.pdb
|
| 190 |
+
motif_only: True
|
| 191 |
+
motif_min_length: 35
|
| 192 |
+
motif_max_length: 50
|
| 193 |
+
segment_order: A
|
| 194 |
+
atom_selection_mode: "tip_atoms"
|
| 195 |
+
4ZYP_AA:
|
| 196 |
+
contig_string: 10-40/A422-436/10-40
|
| 197 |
+
motif_pdb_path: motif_benchmark_pdb_files/4zyp_aa.pdb
|
| 198 |
+
motif_only: True
|
| 199 |
+
motif_min_length: 30
|
| 200 |
+
motif_max_length: 50
|
| 201 |
+
segment_order: A
|
| 202 |
+
atom_selection_mode: "all_atom"
|
| 203 |
+
4ZYP_AA_TIP:
|
| 204 |
+
contig_string: 10-40/A422-436/10-40
|
| 205 |
+
motif_pdb_path: motif_benchmark_pdb_files/4zyp_aa.pdb
|
| 206 |
+
motif_only: True
|
| 207 |
+
motif_min_length: 30
|
| 208 |
+
motif_max_length: 50
|
| 209 |
+
segment_order: A
|
| 210 |
+
atom_selection_mode: "tip_atoms"
|
| 211 |
+
6VW1_AA:
|
| 212 |
+
contig_string: 20-30/A24-42/4-10/A64-82/0-5
|
| 213 |
+
motif_pdb_path: motif_benchmark_pdb_files/6vw1_aa.pdb
|
| 214 |
+
motif_only: True
|
| 215 |
+
motif_min_length: 62
|
| 216 |
+
motif_max_length: 83
|
| 217 |
+
segment_order: A;B
|
| 218 |
+
atom_selection_mode: "all_atom"
|
| 219 |
+
6VW1_AA_TIP:
|
| 220 |
+
contig_string: 20-30/A24-42/4-10/A64-82/0-5
|
| 221 |
+
motif_pdb_path: motif_benchmark_pdb_files/6vw1_aa.pdb
|
| 222 |
+
motif_only: True
|
| 223 |
+
motif_min_length: 62
|
| 224 |
+
motif_max_length: 83
|
| 225 |
+
segment_order: A;B
|
| 226 |
+
atom_selection_mode: "tip_atoms"
|
| 227 |
+
1QJG_AA:
|
| 228 |
+
contig_string: 10-20/A38/15-30/A14/15-30/A99/10-20
|
| 229 |
+
motif_pdb_path: motif_benchmark_pdb_files/1qjg_aa.pdb
|
| 230 |
+
motif_only: False
|
| 231 |
+
motif_min_length: 53
|
| 232 |
+
motif_max_length: 103
|
| 233 |
+
segment_order: A
|
| 234 |
+
atom_selection_mode: "all_atom"
|
| 235 |
+
1QJG_AA_TIP:
|
| 236 |
+
contig_string: 10-20/A38/15-30/A14/15-30/A99/10-20
|
| 237 |
+
motif_pdb_path: motif_benchmark_pdb_files/1qjg_aa.pdb
|
| 238 |
+
motif_only: False
|
| 239 |
+
motif_min_length: 53
|
| 240 |
+
motif_max_length: 103
|
| 241 |
+
segment_order: A
|
| 242 |
+
atom_selection_mode: "tip_atoms"
|
| 243 |
+
1QJG_AA_NATIVE:
|
| 244 |
+
contig_string: 10-20/A14/15-30/A38/50-70/A99/25-30
|
| 245 |
+
motif_pdb_path: motif_benchmark_pdb_files/1qjg_aa.pdb
|
| 246 |
+
motif_only: False
|
| 247 |
+
motif_min_length: 115
|
| 248 |
+
motif_max_length: 135
|
| 249 |
+
segment_order: A
|
| 250 |
+
atom_selection_mode: "all_atom"
|
| 251 |
+
1QJG_AA_NATIVE_TIP:
|
| 252 |
+
contig_string: 10-20/A14/15-30/A38/50-70/A99/25-30
|
| 253 |
+
motif_pdb_path: motif_benchmark_pdb_files/1qjg_aa.pdb
|
| 254 |
+
motif_only: False
|
| 255 |
+
motif_min_length: 115
|
| 256 |
+
motif_max_length: 135
|
| 257 |
+
segment_order: A
|
| 258 |
+
atom_selection_mode: "tip_atoms"
|
| 259 |
+
2KL8_AA:
|
| 260 |
+
contig_string: A1-7/20/A28-79
|
| 261 |
+
motif_pdb_path: motif_benchmark_pdb_files/2kl8_aa.pdb
|
| 262 |
+
motif_only: False
|
| 263 |
+
motif_min_length: 79
|
| 264 |
+
motif_max_length: 79
|
| 265 |
+
segment_order: A
|
| 266 |
+
atom_selection_mode: "all_atom"
|
| 267 |
+
2KL8_AA_TIP:
|
| 268 |
+
contig_string: A1-7/20/A28-79
|
| 269 |
+
motif_pdb_path: motif_benchmark_pdb_files/2kl8_aa.pdb
|
| 270 |
+
motif_only: False
|
| 271 |
+
motif_min_length: 79
|
| 272 |
+
motif_max_length: 79
|
| 273 |
+
segment_order: A
|
| 274 |
+
atom_selection_mode: "tip_atoms"
|
| 275 |
+
7MRX_AA_60:
|
| 276 |
+
contig_string: 0-38/B25-46/0-38
|
| 277 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 278 |
+
motif_only: False
|
| 279 |
+
motif_min_length: 60
|
| 280 |
+
motif_max_length: 60
|
| 281 |
+
segment_order: B
|
| 282 |
+
atom_selection_mode: "all_atom"
|
| 283 |
+
7MRX_AA_60_TIP:
|
| 284 |
+
contig_string: 0-38/B25-46/0-38
|
| 285 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 286 |
+
motif_only: False
|
| 287 |
+
motif_min_length: 60
|
| 288 |
+
motif_max_length: 60
|
| 289 |
+
segment_order: B
|
| 290 |
+
atom_selection_mode: "tip_atoms"
|
| 291 |
+
7MRX_AA_85:
|
| 292 |
+
contig_string: 0-63/B25-46/0-63
|
| 293 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 294 |
+
motif_only: False
|
| 295 |
+
motif_min_length: 85
|
| 296 |
+
motif_max_length: 85
|
| 297 |
+
segment_order: B
|
| 298 |
+
atom_selection_mode: "all_atom"
|
| 299 |
+
7MRX_AA_85_TIP:
|
| 300 |
+
contig_string: 0-63/B25-46/0-63
|
| 301 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 302 |
+
motif_only: False
|
| 303 |
+
motif_min_length: 85
|
| 304 |
+
motif_max_length: 85
|
| 305 |
+
segment_order: B
|
| 306 |
+
atom_selection_mode: "tip_atoms"
|
| 307 |
+
7MRX_AA_128:
|
| 308 |
+
contig_string: 0-122/B25-46/0-122
|
| 309 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 310 |
+
motif_only: False
|
| 311 |
+
motif_min_length: 128
|
| 312 |
+
motif_max_length: 128
|
| 313 |
+
segment_order: B
|
| 314 |
+
atom_selection_mode: "all_atom"
|
| 315 |
+
7MRX_AA_128_TIP:
|
| 316 |
+
contig_string: 0-122/B25-46/0-122
|
| 317 |
+
motif_pdb_path: motif_benchmark_pdb_files/7mrx_aa.pdb
|
| 318 |
+
motif_only: False
|
| 319 |
+
motif_min_length: 128
|
| 320 |
+
motif_max_length: 128
|
| 321 |
+
segment_order: B
|
| 322 |
+
atom_selection_mode: "tip_atoms"
|
| 323 |
+
5TRV_AA_SHORT:
|
| 324 |
+
contig_string: 0-35/A46-48/1/A50-55/1/A57-58/2/A61-65/0-35
|
| 325 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 326 |
+
motif_only: False
|
| 327 |
+
motif_min_length: 56
|
| 328 |
+
motif_max_length: 56
|
| 329 |
+
segment_order: A
|
| 330 |
+
atom_selection_mode: "all_atom"
|
| 331 |
+
5TRV_AA_SHORT_TIP:
|
| 332 |
+
contig_string: 0-35/A46-48/1/A50-55/1/A57-58/2/A61-65/0-35
|
| 333 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 334 |
+
motif_only: False
|
| 335 |
+
motif_min_length: 56
|
| 336 |
+
motif_max_length: 56
|
| 337 |
+
segment_order: A
|
| 338 |
+
atom_selection_mode: "tip_atoms"
|
| 339 |
+
5TRV_AA_MED:
|
| 340 |
+
contig_string: 0-65/A46-48/1/A50-55/1/A57-58/2/A61-65/0-65
|
| 341 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 342 |
+
motif_only: False
|
| 343 |
+
motif_min_length: 86
|
| 344 |
+
motif_max_length: 86
|
| 345 |
+
segment_order: A
|
| 346 |
+
atom_selection_mode: "all_atom"
|
| 347 |
+
5TRV_AA_MED_TIP:
|
| 348 |
+
contig_string: 0-65/A46-48/1/A50-55/1/A57-58/2/A61-65/0-65
|
| 349 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 350 |
+
motif_only: False
|
| 351 |
+
motif_min_length: 86
|
| 352 |
+
motif_max_length: 86
|
| 353 |
+
segment_order: A
|
| 354 |
+
atom_selection_mode: "tip_atoms"
|
| 355 |
+
5TRV_AA_LONG:
|
| 356 |
+
contig_string: 0-95/A46-48/1/A50-55/1/A57-58/2/A61-65/0-95
|
| 357 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 358 |
+
motif_only: False
|
| 359 |
+
motif_min_length: 116
|
| 360 |
+
motif_max_length: 116
|
| 361 |
+
segment_order: A
|
| 362 |
+
atom_selection_mode: "all_atom"
|
| 363 |
+
5TRV_AA_LONG_TIP:
|
| 364 |
+
contig_string: 0-95/A46-48/1/A50-55/1/A57-58/2/A61-65/0-95
|
| 365 |
+
motif_pdb_path: motif_benchmark_pdb_files/5trv_aa.pdb
|
| 366 |
+
motif_only: False
|
| 367 |
+
motif_min_length: 116
|
| 368 |
+
motif_max_length: 116
|
| 369 |
+
segment_order: A
|
| 370 |
+
atom_selection_mode: "tip_atoms"
|
| 371 |
+
6E6R_AA_SHORT:
|
| 372 |
+
contig_string: 0-35/A23-29/1/A31-35/0-35
|
| 373 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 374 |
+
motif_only: False
|
| 375 |
+
motif_min_length: 48
|
| 376 |
+
motif_max_length: 48
|
| 377 |
+
segment_order: A
|
| 378 |
+
atom_selection_mode: "all_atom"
|
| 379 |
+
6E6R_AA_SHORT_TIP:
|
| 380 |
+
contig_string: 0-35/A23-29/1/A31-35/0-35
|
| 381 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 382 |
+
motif_only: False
|
| 383 |
+
motif_min_length: 48
|
| 384 |
+
motif_max_length: 48
|
| 385 |
+
segment_order: A
|
| 386 |
+
atom_selection_mode: "tip_atoms"
|
| 387 |
+
6E6R_AA_MED:
|
| 388 |
+
contig_string: 0-65/A23-29/1/A31-35/0-65
|
| 389 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 390 |
+
motif_only: False
|
| 391 |
+
motif_min_length: 78
|
| 392 |
+
motif_max_length: 78
|
| 393 |
+
segment_order: A
|
| 394 |
+
atom_selection_mode: "all_atom"
|
| 395 |
+
6E6R_AA_MED_TIP:
|
| 396 |
+
contig_string: 0-65/A23-29/1/A31-35/0-65
|
| 397 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 398 |
+
motif_only: False
|
| 399 |
+
motif_min_length: 78
|
| 400 |
+
motif_max_length: 78
|
| 401 |
+
segment_order: A
|
| 402 |
+
atom_selection_mode: "tip_atoms"
|
| 403 |
+
6E6R_AA_LONG:
|
| 404 |
+
contig_string: 0-95/A23-29/1/A31-35/0-95
|
| 405 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 406 |
+
motif_only: False
|
| 407 |
+
motif_min_length: 108
|
| 408 |
+
motif_max_length: 108
|
| 409 |
+
segment_order: A
|
| 410 |
+
atom_selection_mode: "all_atom"
|
| 411 |
+
6E6R_AA_LONG_TIP:
|
| 412 |
+
contig_string: 0-95/A23-29/1/A31-35/0-95
|
| 413 |
+
motif_pdb_path: motif_benchmark_pdb_files/6e6r_aa.pdb
|
| 414 |
+
motif_only: False
|
| 415 |
+
motif_min_length: 108
|
| 416 |
+
motif_max_length: 108
|
| 417 |
+
segment_order: A
|
| 418 |
+
atom_selection_mode: "tip_atoms"
|
configs/generation/uncond_codes.yaml
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# General sampling params
|
| 2 |
+
args:
|
| 3 |
+
fold_cond: False # not supported
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# Sampling dataset
|
| 7 |
+
dataset:
|
| 8 |
+
# Lengths to sample. If not None, then use length-centric sampling
|
| 9 |
+
# Uses `nres_lens` if specified, otherwise arange(min_len, max_len+1, step)
|
| 10 |
+
nlens_cfg:
|
| 11 |
+
# nres_lens: [100, 200, 300, 400, 500]
|
| 12 |
+
nres_lens: [100]
|
| 13 |
+
min_len:
|
| 14 |
+
max_len:
|
| 15 |
+
step_len:
|
| 16 |
+
|
| 17 |
+
cath_codes: null
|
| 18 |
+
|
| 19 |
+
# Number of samples per protein length or per cath code
|
| 20 |
+
# nsamples: 100
|
| 21 |
+
nsamples: 2
|
| 22 |
+
|
| 23 |
+
# Maximum number of samples in each batch
|
| 24 |
+
# max_nsamples_per_batch: 10
|
| 25 |
+
max_nsamples_per_batch: 1
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# Empirical (length, cath code) distribution
|
| 29 |
+
empirical_distribution_cfg:
|
| 30 |
+
# Path to the empirical (len, cath_code) distribution file
|
| 31 |
+
len_cath_code_path: null
|
| 32 |
+
|
| 33 |
+
# Level of cath codes to generate
|
| 34 |
+
cath_code_level: null
|
| 35 |
+
|
| 36 |
+
# Arguments for bucketizing the length distribution
|
| 37 |
+
bucket_min_len: 50
|
| 38 |
+
bucket_max_len: 274
|
| 39 |
+
bucket_step_size: 25
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Sampling metrics
|
| 43 |
+
metric:
|
| 44 |
+
# Designability
|
| 45 |
+
compute_designability: True
|
| 46 |
+
designability_folding_models: ["esmfold"] # List of folding models to use
|
| 47 |
+
|
| 48 |
+
# codesign metrics
|
| 49 |
+
compute_codesignability: True
|
| 50 |
+
codesignability_folding_models: ["esmfold"] # List of folding models to use
|
| 51 |
+
compute_co_sequence_recovery: False
|
| 52 |
+
|
| 53 |
+
# Novelty
|
| 54 |
+
compute_novelty_pdb: False
|
| 55 |
+
compute_novelty_afdb: False
|
| 56 |
+
compute_novelty_afdb_rep_v4: False
|
| 57 |
+
compute_novelty_afdb_rep_v4_geniefilters_maxlen512: False
|
| 58 |
+
|
| 59 |
+
# motif scaffolding
|
| 60 |
+
compute_motif_scaffolding: False
|
| 61 |
+
compute_motif_backbone_designability: False # backbone scRMSD
|
| 62 |
+
compute_motif_aa_designability: False # all-atom scRMSD
|
| 63 |
+
compute_motif_rmsd: False
|
| 64 |
+
|
| 65 |
+
# Output management
|
| 66 |
+
keep_folding_outputs: True
|
| 67 |
+
|
| 68 |
+
# binder design
|
| 69 |
+
compute_binder_metrics: False
|
| 70 |
+
|
| 71 |
+
# multimer generation
|
| 72 |
+
compute_multimer_metrics: False
|
| 73 |
+
|
| 74 |
+
# FID-related metrics
|
| 75 |
+
compute_fid: False
|
| 76 |
+
metric_factory: null
|
configs/generation/uncond_codes_800.yaml
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# General sampling params
|
| 2 |
+
args:
|
| 3 |
+
fold_cond: False # not supported
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# Sampling dataset
|
| 7 |
+
dataset:
|
| 8 |
+
# Lengths to sample. If not None, then use length-centric sampling
|
| 9 |
+
# Uses `nres_lens` if specified, otherwise arange(min_len, max_len+1, step)
|
| 10 |
+
nlens_cfg:
|
| 11 |
+
nres_lens: [300, 400, 500, 600, 700, 800]
|
| 12 |
+
min_len:
|
| 13 |
+
max_len:
|
| 14 |
+
step_len:
|
| 15 |
+
|
| 16 |
+
# CATH codes to sample. If not None and nlens_cfg is None, then use fold-centric sampling
|
| 17 |
+
cath_codes: null # ["1.x.x.x", "2.x.x.x", "3.x.x.x"]
|
| 18 |
+
|
| 19 |
+
# Number of samples per protein length or per cath code
|
| 20 |
+
nsamples: 100
|
| 21 |
+
|
| 22 |
+
# Maximum number of samples in each batch
|
| 23 |
+
max_nsamples_per_batch: 10
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Empirical (length, cath code) distribution
|
| 27 |
+
empirical_distribution_cfg:
|
| 28 |
+
# Path to the empirical (len, cath_code) distribution file
|
| 29 |
+
len_cath_code_path: null
|
| 30 |
+
|
| 31 |
+
# Level of cath codes to generate
|
| 32 |
+
cath_code_level: null
|
| 33 |
+
|
| 34 |
+
# Arguments for bucketizing the length distribution
|
| 35 |
+
bucket_min_len: 50
|
| 36 |
+
bucket_max_len: 274
|
| 37 |
+
bucket_step_size: 25
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Sampling metrics
|
| 41 |
+
metric:
|
| 42 |
+
# Designability
|
| 43 |
+
compute_designability: True
|
| 44 |
+
designability_folding_models: ["esmfold"] # List of folding models to use
|
| 45 |
+
|
| 46 |
+
# codesign metrics
|
| 47 |
+
compute_codesignability: True
|
| 48 |
+
codesignability_folding_models: ["esmfold"] # List of folding models to use
|
| 49 |
+
compute_co_sequence_recovery: False
|
| 50 |
+
|
| 51 |
+
# Novelty
|
| 52 |
+
compute_novelty_pdb: False
|
| 53 |
+
compute_novelty_afdb: False
|
| 54 |
+
compute_novelty_afdb_rep_v4: False
|
| 55 |
+
compute_novelty_afdb_rep_v4_geniefilters_maxlen512: False
|
| 56 |
+
|
| 57 |
+
# motif scaffolding
|
| 58 |
+
compute_motif_scaffolding: False
|
| 59 |
+
compute_motif_backbone_designability: False # backbone scRMSD
|
| 60 |
+
compute_motif_aa_designability: False # all-atom scRMSD
|
| 61 |
+
compute_motif_rmsd: False
|
| 62 |
+
|
| 63 |
+
# Output management
|
| 64 |
+
keep_folding_outputs: True
|
| 65 |
+
|
| 66 |
+
# binder design
|
| 67 |
+
compute_binder_metrics: False
|
| 68 |
+
|
| 69 |
+
# multimer generation
|
| 70 |
+
compute_multimer_metrics: False
|
| 71 |
+
|
| 72 |
+
# FID-related metrics
|
| 73 |
+
compute_fid: False
|
| 74 |
+
metric_factory: null
|
configs/generation/validation_local_latents.yaml
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# General sampling params
|
| 2 |
+
args:
|
| 3 |
+
# some params for sampling
|
| 4 |
+
nsteps: 200
|
| 5 |
+
self_cond: False
|
| 6 |
+
fold_cond: False
|
| 7 |
+
guidance_w: 1.0 # conditional model weights, 1.0 for conditional generation, 0.0 for unconditional generation. We typically set this value greater than 1
|
| 8 |
+
# Always set autoguidance as 0.0 during validation
|
| 9 |
+
ag_ratio: 0.0 # a value between 0 and 1, determining the proportion of autoguidance v.s. classifier-free guidance, 1.0 for all autoguidance, 0.0 for all CFG
|
| 10 |
+
ag_ckpt_path: null # path to bad model checkpoint
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
# Sampling dataset
|
| 14 |
+
dataset:
|
| 15 |
+
# Validation sampling dataset
|
| 16 |
+
# Lengths to sample. If not None, then use length-centric sampling
|
| 17 |
+
# Uses `nres_lens` if specified, otherwise arange(min_len, max_len+1, step)
|
| 18 |
+
nlens_cfg:
|
| 19 |
+
nres_lens: [50, 100, 150, 200, 250]
|
| 20 |
+
min_len:
|
| 21 |
+
max_len:
|
| 22 |
+
step_len:
|
| 23 |
+
|
| 24 |
+
# CATH codes to sample. If not None and nlens_cfg is None, then use fold-centric sampling
|
| 25 |
+
cath_codes: null # ["1.x.x.x", "2.x.x.x", "3.x.x.x"]
|
| 26 |
+
|
| 27 |
+
# Number of samples per protein length or per cath code
|
| 28 |
+
nsamples: 20
|
| 29 |
+
|
| 30 |
+
# Maximum number of samples in each batch
|
| 31 |
+
max_nsamples_per_batch: 5
|
| 32 |
+
|
| 33 |
+
# Empirical (length, cath code) distribution
|
| 34 |
+
empirical_distribution_cfg:
|
| 35 |
+
# Path to the empirical (len, cath_code) distribution file
|
| 36 |
+
len_cath_code_path: null
|
| 37 |
+
|
| 38 |
+
# Level of cath codes to generate
|
| 39 |
+
cath_code_level: null
|
| 40 |
+
|
| 41 |
+
# Arguments for bucketizing the length distribution
|
| 42 |
+
bucket_min_len: 50
|
| 43 |
+
bucket_max_len: 274
|
| 44 |
+
bucket_step_size: 25
|
| 45 |
+
|
| 46 |
+
model:
|
| 47 |
+
ode:
|
| 48 |
+
bb_ca:
|
| 49 |
+
schedule:
|
| 50 |
+
mode: uniform
|
| 51 |
+
p: 1.0
|
| 52 |
+
gt:
|
| 53 |
+
mode: "tan"
|
| 54 |
+
p: 1.0
|
| 55 |
+
clamp_val: null
|
| 56 |
+
simulation_step_params:
|
| 57 |
+
sampling_mode: vf
|
| 58 |
+
sc_scale_noise: 0.0
|
| 59 |
+
sc_scale_score: 0.0
|
| 60 |
+
t_lim_ode: 0.98
|
| 61 |
+
t_lim_ode_below: 0.02
|
| 62 |
+
center_every_step: True
|
| 63 |
+
local_latents:
|
| 64 |
+
schedule:
|
| 65 |
+
mode: uniform
|
| 66 |
+
p: 1.0
|
| 67 |
+
gt:
|
| 68 |
+
mode: "tan"
|
| 69 |
+
p: 1.0
|
| 70 |
+
clamp_val: null
|
| 71 |
+
simulation_step_params:
|
| 72 |
+
sampling_mode: vf
|
| 73 |
+
sc_scale_noise: 0.0
|
| 74 |
+
sc_scale_score: 0.0
|
| 75 |
+
t_lim_ode: 0.98
|
| 76 |
+
t_lim_ode_below: 0.02
|
| 77 |
+
center_every_step: False
|
| 78 |
+
|
| 79 |
+
temp_035_only_ca:
|
| 80 |
+
bb_ca:
|
| 81 |
+
schedule:
|
| 82 |
+
mode: uniform
|
| 83 |
+
p: 1.0
|
| 84 |
+
gt:
|
| 85 |
+
mode: "tan"
|
| 86 |
+
p: 1.0
|
| 87 |
+
clamp_val: null
|
| 88 |
+
simulation_step_params:
|
| 89 |
+
sampling_mode: sc
|
| 90 |
+
sc_scale_noise: 0.35
|
| 91 |
+
sc_scale_score: 1.0
|
| 92 |
+
t_lim_ode: 0.98
|
| 93 |
+
t_lim_ode_below: 0.02
|
| 94 |
+
center_every_step: True
|
| 95 |
+
local_latents:
|
| 96 |
+
schedule:
|
| 97 |
+
mode: uniform
|
| 98 |
+
p: 1.0
|
| 99 |
+
gt:
|
| 100 |
+
mode: "tan"
|
| 101 |
+
p: 1.0
|
| 102 |
+
clamp_val: null
|
| 103 |
+
simulation_step_params:
|
| 104 |
+
sampling_mode: vf
|
| 105 |
+
sc_scale_noise: 0.0
|
| 106 |
+
sc_scale_score: 0.0
|
| 107 |
+
t_lim_ode: 0.98
|
| 108 |
+
t_lim_ode_below: 0.02
|
| 109 |
+
center_every_step: False
|
| 110 |
+
|
| 111 |
+
temp_035_all:
|
| 112 |
+
bb_ca:
|
| 113 |
+
schedule:
|
| 114 |
+
mode: uniform
|
| 115 |
+
p: 1.0
|
| 116 |
+
gt:
|
| 117 |
+
mode: "tan"
|
| 118 |
+
p: 1.0
|
| 119 |
+
clamp_val: null
|
| 120 |
+
simulation_step_params:
|
| 121 |
+
sampling_mode: sc
|
| 122 |
+
sc_scale_noise: 0.35
|
| 123 |
+
sc_scale_score: 1.0
|
| 124 |
+
t_lim_ode: 0.98
|
| 125 |
+
t_lim_ode_below: 0.02
|
| 126 |
+
center_every_step: True
|
| 127 |
+
local_latents:
|
| 128 |
+
schedule:
|
| 129 |
+
mode: uniform
|
| 130 |
+
p: 1.0
|
| 131 |
+
gt:
|
| 132 |
+
mode: "tan"
|
| 133 |
+
p: 1.0
|
| 134 |
+
clamp_val: null
|
| 135 |
+
simulation_step_params:
|
| 136 |
+
sampling_mode: sc
|
| 137 |
+
sc_scale_noise: 0.35
|
| 138 |
+
sc_scale_score: 1.0
|
| 139 |
+
t_lim_ode: 0.98
|
| 140 |
+
t_lim_ode_below: 0.02
|
| 141 |
+
center_every_step: False
|
| 142 |
+
|
| 143 |
+
# Sampling metrics
|
| 144 |
+
metric:
|
| 145 |
+
# Designability
|
| 146 |
+
compute_designability: False
|
| 147 |
+
|
| 148 |
+
# Novelty
|
| 149 |
+
compute_novelty_pdb: False
|
| 150 |
+
compute_novelty_afdb: False
|
| 151 |
+
|
| 152 |
+
# FID-related metrics
|
| 153 |
+
compute_fid: True
|
| 154 |
+
metric_factory:
|
| 155 |
+
- metrics: ["FID", "fJSD_C", "fJSD_A", "fJSD_T"]
|
| 156 |
+
ckpt_path: ${oc.env:DATA_PATH}/metric_factory/model_weights/gearnet_ca.pth
|
| 157 |
+
real_features_path: ${oc.env:DATA_PATH}/metric_factory/features/pdb_eval_ca_features.pth
|
| 158 |
+
ca_only: True
|
| 159 |
+
prefix: PDB_
|
| 160 |
+
- metrics: ["FID", "fJSD_C", "fJSD_A", "fJSD_T"]
|
| 161 |
+
ckpt_path: ${oc.env:DATA_PATH}/metric_factory/model_weights/gearnet_ca.pth
|
| 162 |
+
real_features_path: ${oc.env:DATA_PATH}/metric_factory/features/afdb_eval_ca_features.pth
|
| 163 |
+
ca_only: True
|
| 164 |
+
prefix: AFDB_
|
| 165 |
+
- metrics: ["IS_C", "IS_A", "IS_T"]
|
| 166 |
+
ckpt_path: ${oc.env:DATA_PATH}/metric_factory/model_weights/gearnet_ca.pth
|
| 167 |
+
ca_only: True
|
configs/inference_ae.yaml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Checkpoint
|
| 2 |
+
#ckpt_file: ./checkpoints_laproteina/AE1_ucond_512.ckpt
|
| 3 |
+
ckpt_file: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE1_ucond_512.ckpt
|
| 4 |
+
# Job management
|
| 5 |
+
ncpus_: 24
|
| 6 |
+
seed: 5
|
| 7 |
+
|
| 8 |
+
# Which data to test autoencoder on, and how many structures
|
| 9 |
+
dataset: pdb
|
| 10 |
+
n_structs: 1000
|
| 11 |
+
bs: 20
|
| 12 |
+
|
| 13 |
+
# Stuff to compute
|
| 14 |
+
metrics:
|
| 15 |
+
bb_rmsd: false
|
| 16 |
+
all_atom_rmsd: true
|
| 17 |
+
seq_rec_rate: true
|
| 18 |
+
seq_cross_entropy: false
|
| 19 |
+
kl_latent_dist: true
|
| 20 |
+
std_latent_dist: false
|
| 21 |
+
|
| 22 |
+
plot:
|
| 23 |
+
pca_latents: false
|
| 24 |
+
pca_latents_per_residue_type: true
|
configs/inference_base.yaml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run_name_:
|
| 2 |
+
ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina
|
| 3 |
+
ckpt_name:
|
| 4 |
+
autoencoder_ckpt_path:
|
| 5 |
+
|
| 6 |
+
# Job management
|
| 7 |
+
ncpus_: 24
|
| 8 |
+
seed: 5
|
| 9 |
+
gen_njobs: 1 # Leave as 1
|
| 10 |
+
eval_njobs: 1 # Leave as 1
|
| 11 |
+
|
| 12 |
+
# All sampling arugments that we want to change frequently
|
| 13 |
+
generation:
|
| 14 |
+
n_recycle: 0 # Leave as 0
|
| 15 |
+
|
| 16 |
+
# General sampling params
|
| 17 |
+
args:
|
| 18 |
+
# nsteps: 400
|
| 19 |
+
# self_cond: True
|
| 20 |
+
nsteps: 20
|
| 21 |
+
self_cond: False
|
| 22 |
+
|
| 23 |
+
# Guidance
|
| 24 |
+
guidance_w: 1.0 # guidance model weights, 1.0 for w/o CFG and autoguidance, 0.0 for excluding the main model
|
| 25 |
+
ag_ratio: 0.0 # a value between 0 and 1, determining the proportion of autoguidance v.s. classifier-free guidance, 1.0 for all autoguidance, 0.0 for all CFG -- ag not supported for now
|
| 26 |
+
ag_ckpt_path: null # path to bad model checkpoint
|
| 27 |
+
|
| 28 |
+
save_trajectory_every: 0 # at which step interval to save trajectory snapshots of generation, 0 for no saving
|
| 29 |
+
|
| 30 |
+
# Model-specific sampling arguments
|
| 31 |
+
model:
|
| 32 |
+
bb_ca:
|
| 33 |
+
schedule:
|
| 34 |
+
mode: log
|
| 35 |
+
p: 2.0
|
| 36 |
+
gt:
|
| 37 |
+
mode: "1/t"
|
| 38 |
+
p: 1.0
|
| 39 |
+
clamp_val: null
|
| 40 |
+
simulation_step_params:
|
| 41 |
+
sampling_mode: sc # Options are: vf (plain fow matching) or sc (using score, where parameters below matter)
|
| 42 |
+
sc_scale_noise: 0.1 # scale used to multiply noise if mode == sc
|
| 43 |
+
sc_scale_score: 1.0 # scale used to multiply score if mode == sc
|
| 44 |
+
t_lim_ode: 0.98 # At what point between 0 and 1 we switch to ODE with score scaling (for sc mode)
|
| 45 |
+
t_lim_ode_below: 0.02 # Before what point between 0 and 1 we use sc mode (for vf_ss mode)
|
| 46 |
+
center_every_step: True # Whether to center the sample every step
|
| 47 |
+
local_latents:
|
| 48 |
+
schedule:
|
| 49 |
+
mode: power
|
| 50 |
+
p: 2.0
|
| 51 |
+
gt:
|
| 52 |
+
mode: "tan"
|
| 53 |
+
p: 1.0
|
| 54 |
+
clamp_val: null
|
| 55 |
+
simulation_step_params:
|
| 56 |
+
sampling_mode: sc
|
| 57 |
+
sc_scale_noise: 0.1
|
| 58 |
+
sc_scale_score: 1.0
|
| 59 |
+
t_lim_ode: 0.98
|
| 60 |
+
t_lim_ode_below: 0.02
|
| 61 |
+
center_every_step: False
|
configs/inference_motif_idx_aa.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: motif
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_motif_idx_aa
|
| 7 |
+
ckpt_name: LD4_motif_idx_aa.ckpt
|
| 8 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE3_motif.ckpt
|
| 9 |
+
|
| 10 |
+
generation:
|
| 11 |
+
model:
|
| 12 |
+
bb_ca:
|
| 13 |
+
simulation_step_params:
|
| 14 |
+
center_every_step: False # Whether to center the sample every step
|
| 15 |
+
dataset:
|
| 16 |
+
motif_task_name: 1YCR_AA
|
configs/inference_motif_idx_tip.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: motif
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_motif_idx_tip
|
| 7 |
+
ckpt_name: LD5_motif_idx_tip.ckpt
|
| 8 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE3_motif.ckpt
|
| 9 |
+
|
| 10 |
+
generation:
|
| 11 |
+
model:
|
| 12 |
+
bb_ca:
|
| 13 |
+
simulation_step_params:
|
| 14 |
+
center_every_step: False # Whether to center the sample every step
|
| 15 |
+
dataset:
|
| 16 |
+
motif_task_name: 1YCR_AA_TIP
|
configs/inference_motif_uidx_aa.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: motif
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_motif_uidx_aa
|
| 7 |
+
ckpt_name: LD6_motif_uidx_aa.ckpt
|
| 8 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE3_motif.ckpt
|
| 9 |
+
|
| 10 |
+
generation:
|
| 11 |
+
model:
|
| 12 |
+
bb_ca:
|
| 13 |
+
simulation_step_params:
|
| 14 |
+
center_every_step: False # Whether to center the sample every step
|
| 15 |
+
dataset:
|
| 16 |
+
motif_task_name: 1YCR_AA
|
configs/inference_motif_uidx_tip.yaml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: motif
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_motif_uidx_tip
|
| 7 |
+
ckpt_name: LD7_motif_uidx_tip.ckpt
|
| 8 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE3_motif.ckpt
|
| 9 |
+
|
| 10 |
+
generation:
|
| 11 |
+
model:
|
| 12 |
+
bb_ca:
|
| 13 |
+
simulation_step_params:
|
| 14 |
+
center_every_step: False # Whether to center the sample every step
|
| 15 |
+
dataset:
|
| 16 |
+
motif_task_name: 1YCR_AA_TIP
|
configs/inference_my.yaml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: uncond_codes
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_ucond_notri
|
| 7 |
+
ckpt_path: ./store/test_release_diffusion/checkpoints
|
| 8 |
+
ckpt_name: last-EMA.ckpt
|
| 9 |
+
autoencoder_ckpt_path: ./store/test_release_ae/checkpoints/last-EMA.ckpt
|
| 10 |
+
|
| 11 |
+
generation:
|
| 12 |
+
dataset:
|
| 13 |
+
max_nsamples_per_batch: 2 # 原来是 10,改成 2 或 1
|
configs/inference_ucond_notri.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: uncond_codes
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_ucond_notri
|
| 7 |
+
ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina
|
| 8 |
+
ckpt_name: LD1_ucond_notri_512.ckpt
|
| 9 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE1_ucond_512.ckpt
|
configs/inference_ucond_notri_long.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: uncond_codes_800
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_ucond_notri_long
|
| 7 |
+
ckpt_name: LD3_ucond_notri_800.ckpt
|
| 8 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/checkpoints_laproteina/AE2_ucond_800.ckpt
|
| 9 |
+
|
| 10 |
+
generation:
|
| 11 |
+
model:
|
| 12 |
+
bb_ca:
|
| 13 |
+
simulation_step_params:
|
| 14 |
+
sc_scale_noise: 0.15 # scale used to multiply noise if mode == sc
|
| 15 |
+
local_latents:
|
| 16 |
+
simulation_step_params:
|
| 17 |
+
sc_scale_noise: 0.05 # scale used to multiply noise if mode == sc
|
configs/inference_ucond_tri.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
defaults:
|
| 2 |
+
- inference_base
|
| 3 |
+
- generation: uncond_codes
|
| 4 |
+
- _self_
|
| 5 |
+
|
| 6 |
+
run_name_: laproteina_ucond_tri
|
| 7 |
+
ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina
|
| 8 |
+
ckpt_name: LD2_ucond_tri_512.ckpt
|
| 9 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE1_ucond_512.ckpt
|
configs/nn/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/nn/local_latents_score_nn_160M.yaml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: local_latents_transformer # name of architecture
|
| 2 |
+
|
| 3 |
+
output_parameterization:
|
| 4 |
+
bb_ca: v # or x_1
|
| 5 |
+
local_latents: v # or x_1
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
nlayers: 14 # number of transformer layers
|
| 9 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 10 |
+
nheads: 12 # number of attn heads 12
|
| 11 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 12 |
+
|
| 13 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 14 |
+
# If True, if some feature is not provided, then it raises an error
|
| 15 |
+
|
| 16 |
+
# feats_seq: ["res_seq_pdb_idx", "xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "x_recycle_bb_ca", "x_recycle_local_latents"] # Sequence features to include in initial representation
|
| 17 |
+
feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat"] # Sequence features to include in initial representation
|
| 18 |
+
feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 19 |
+
|
| 20 |
+
# Parameters for the features we extract
|
| 21 |
+
dim_cond: 256 # dimension of conditioning vector
|
| 22 |
+
idx_emb_dim: 256 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 23 |
+
t_emb_dim: 256 # dimension of the time embedding
|
| 24 |
+
|
| 25 |
+
# feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist", "x_recycle_bb_ca_pair_dists"] # Features to include in the pair representation
|
| 26 |
+
feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist"] # Features to include in the pair representation
|
| 27 |
+
feats_pair_cond: ["time_emb_bb_ca", "time_emb_local_latents"] # Features to include in the pair representation conditioning
|
| 28 |
+
|
| 29 |
+
# Parameters for the pair features we extract
|
| 30 |
+
# Binning for the pair distances of noisy xt
|
| 31 |
+
xt_pair_dist_dim: 30
|
| 32 |
+
xt_pair_dist_min: 0.1 # in nm (not Å)
|
| 33 |
+
xt_pair_dist_max: 3 # in nm (not Å)
|
| 34 |
+
# Binning for the pair distances for self conditioning
|
| 35 |
+
x_sc_pair_dist_dim: 30
|
| 36 |
+
x_sc_pair_dist_min: 0.1 # in nm (not Å)
|
| 37 |
+
x_sc_pair_dist_max: 3 # in nm (not Å)
|
| 38 |
+
# Relative sequence separation
|
| 39 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 40 |
+
# Dimension of final pair representation
|
| 41 |
+
pair_repr_dim: 256
|
| 42 |
+
|
| 43 |
+
update_pair_repr: False # whether to update pair representation
|
| 44 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 45 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 46 |
+
|
| 47 |
+
use_qkln: True
|
configs/nn/local_latents_score_nn_160M_motif_idx_aa.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: local_latents_transformer # name of architecture
|
| 2 |
+
|
| 3 |
+
output_parameterization:
|
| 4 |
+
bb_ca: v # or x_1
|
| 5 |
+
local_latents: v # or x_1
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
nlayers: 14 # number of transformer layers
|
| 9 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 10 |
+
nheads: 12 # number of attn heads 12
|
| 11 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 12 |
+
|
| 13 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 14 |
+
# If True, if some feature is not provided, then it raises an error
|
| 15 |
+
|
| 16 |
+
feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat", "bulk_all_atom_xmotif"] # Sequence features to include in initial representation
|
| 17 |
+
feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 18 |
+
|
| 19 |
+
# Parameters for the features we extract
|
| 20 |
+
dim_cond: 256 # dimension of conditioning vector
|
| 21 |
+
idx_emb_dim: 256 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 22 |
+
t_emb_dim: 256 # dimension of the time embedding
|
| 23 |
+
|
| 24 |
+
feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist", "x_motif_pair_dists"] # Features to include in the pair representation
|
| 25 |
+
feats_pair_cond: ["time_emb_bb_ca", "time_emb_local_latents"] # Features to include in the pair representation conditioning
|
| 26 |
+
|
| 27 |
+
# Parameters for the pair features we extract
|
| 28 |
+
# Binning for the pair distances of noisy xt
|
| 29 |
+
xt_pair_dist_dim: 30
|
| 30 |
+
xt_pair_dist_min: 0.1 # in nm (not Å)
|
| 31 |
+
xt_pair_dist_max: 3 # in nm (not Å)
|
| 32 |
+
# Binning for the pair distances for self conditioning
|
| 33 |
+
x_sc_pair_dist_dim: 30
|
| 34 |
+
x_sc_pair_dist_min: 0.1 # in nm (not Å)
|
| 35 |
+
x_sc_pair_dist_max: 3 # in nm (not Å)
|
| 36 |
+
# Relative sequence separation
|
| 37 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 38 |
+
# Dimension of final pair representation
|
| 39 |
+
pair_repr_dim: 256
|
| 40 |
+
|
| 41 |
+
update_pair_repr: False # whether to update pair representation
|
| 42 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 43 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 44 |
+
|
| 45 |
+
use_qkln: True
|
configs/nn/local_latents_score_nn_160M_motif_idx_tip.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: local_latents_transformer # name of architecture
|
| 2 |
+
|
| 3 |
+
output_parameterization:
|
| 4 |
+
bb_ca: v # or x_1
|
| 5 |
+
local_latents: v # or x_1
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
nlayers: 14 # number of transformer layers
|
| 9 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 10 |
+
nheads: 12 # number of attn heads 12
|
| 11 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 12 |
+
|
| 13 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 14 |
+
# If True, if some feature is not provided, then it raises an error
|
| 15 |
+
|
| 16 |
+
feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat", "motif_mask", "motif_abs_coords", "motif_seq"] # Sequence features to include in initial representation
|
| 17 |
+
feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 18 |
+
|
| 19 |
+
# Parameters for the features we extract
|
| 20 |
+
dim_cond: 256 # dimension of conditioning vector
|
| 21 |
+
idx_emb_dim: 256 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 22 |
+
t_emb_dim: 256 # dimension of the time embedding
|
| 23 |
+
|
| 24 |
+
feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist", "x_motif_pair_dists"] # Features to include in the pair representation #! x_motif_pair_dists was in old not in new
|
| 25 |
+
feats_pair_cond: ["time_emb_bb_ca", "time_emb_local_latents"] # Features to include in the pair representation conditioning
|
| 26 |
+
|
| 27 |
+
# Parameters for the pair features we extract
|
| 28 |
+
# Binning for the pair distances of noisy xt
|
| 29 |
+
xt_pair_dist_dim: 30
|
| 30 |
+
xt_pair_dist_min: 0.1 # in nm (not Å)
|
| 31 |
+
xt_pair_dist_max: 3 # in nm (not Å)
|
| 32 |
+
# Binning for the pair distances for self conditioning
|
| 33 |
+
x_sc_pair_dist_dim: 30
|
| 34 |
+
x_sc_pair_dist_min: 0.1 # in nm (not Å)
|
| 35 |
+
x_sc_pair_dist_max: 3 # in nm (not Å)
|
| 36 |
+
# Relative sequence separation
|
| 37 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 38 |
+
# Dimension of final pair representation
|
| 39 |
+
pair_repr_dim: 256
|
| 40 |
+
|
| 41 |
+
update_pair_repr: False # whether to update pair representation
|
| 42 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 43 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 44 |
+
|
| 45 |
+
use_qkln: True
|
configs/nn/local_latents_score_nn_160M_motif_uidx.yaml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: local_latents_transformer_motif_uidx # name of architecture
|
| 2 |
+
|
| 3 |
+
output_parameterization:
|
| 4 |
+
bb_ca: v # or x_1
|
| 5 |
+
local_latents: v # or x_1
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
nlayers: 14 # number of transformer layers
|
| 9 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 10 |
+
nheads: 12 # number of attn heads 12
|
| 11 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 12 |
+
|
| 13 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 14 |
+
# If True, if some feature is not provided, then it raises an error
|
| 15 |
+
|
| 16 |
+
feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat", "motif_mask", "motif_abs_coords", "motif_seq"] # Sequence features to include in initial representation
|
| 17 |
+
feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 18 |
+
|
| 19 |
+
# Parameters for the features we extract
|
| 20 |
+
dim_cond: 256 # dimension of conditioning vector
|
| 21 |
+
idx_emb_dim: 256 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 22 |
+
t_emb_dim: 256 # dimension of the time embedding
|
| 23 |
+
|
| 24 |
+
feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist", "x_motif_pair_dists"] # Features to include in the pair representation #! x_motif_pair_dists was in old not in new
|
| 25 |
+
feats_pair_cond: ["time_emb_bb_ca", "time_emb_local_latents"] # Features to include in the pair representation conditioning
|
| 26 |
+
|
| 27 |
+
# Parameters for the pair features we extract
|
| 28 |
+
# Binning for the pair distances of noisy xt
|
| 29 |
+
xt_pair_dist_dim: 30
|
| 30 |
+
xt_pair_dist_min: 0.1 # in nm (not Å)
|
| 31 |
+
xt_pair_dist_max: 3 # in nm (not Å)
|
| 32 |
+
# Binning for the pair distances for self conditioning
|
| 33 |
+
x_sc_pair_dist_dim: 30
|
| 34 |
+
x_sc_pair_dist_min: 0.1 # in nm (not Å)
|
| 35 |
+
x_sc_pair_dist_max: 3 # in nm (not Å)
|
| 36 |
+
# Relative sequence separation
|
| 37 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 38 |
+
# Dimension of final pair representation
|
| 39 |
+
pair_repr_dim: 256
|
| 40 |
+
|
| 41 |
+
update_pair_repr: False # whether to update pair representation
|
| 42 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 43 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 44 |
+
|
| 45 |
+
use_qkln: True
|
configs/nn/local_latents_score_nn_160M_tri.yaml
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: local_latents_transformer # name of architecture
|
| 2 |
+
|
| 3 |
+
output_parameterization:
|
| 4 |
+
bb_ca: v # or x_1
|
| 5 |
+
local_latents: v # or x_1
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
nlayers: 14 # number of transformer layers
|
| 9 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 10 |
+
nheads: 12 # number of attn heads 12
|
| 11 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 12 |
+
|
| 13 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 14 |
+
# If True, if some feature is not provided, then it raises an error
|
| 15 |
+
|
| 16 |
+
# feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat"] # Sequence features to include in initial representation
|
| 17 |
+
# feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 18 |
+
|
| 19 |
+
feats_seq: ["xt_bb_ca", "xt_local_latents", "x_sc_bb_ca", "x_sc_local_latents", "optional_ca_coors_nm_seq_feat", "optional_res_type_seq_feat"] # Sequence features to include in initial representation
|
| 20 |
+
feats_cond_seq: ["time_emb_bb_ca", "time_emb_local_latents"] # Sequence features to include in conditioning variables
|
| 21 |
+
|
| 22 |
+
# Parameters for the features we extract
|
| 23 |
+
dim_cond: 256 # dimension of conditioning vector
|
| 24 |
+
idx_emb_dim: 256 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 25 |
+
t_emb_dim: 256 # dimension of the time embedding
|
| 26 |
+
|
| 27 |
+
feats_pair_repr: ["rel_seq_sep", "xt_bb_ca_pair_dists", "x_sc_bb_ca_pair_dists", "optional_ca_pair_dist"] # Features to include in the pair representation
|
| 28 |
+
feats_pair_cond: ["time_emb_bb_ca", "time_emb_local_latents"] # Features to include in the pair representation conditioning
|
| 29 |
+
|
| 30 |
+
# Parameters for the pair features we extract
|
| 31 |
+
# Binning for the pair distances of noisy xt
|
| 32 |
+
xt_pair_dist_dim: 30
|
| 33 |
+
xt_pair_dist_min: 0.1 # in nm (not Å)
|
| 34 |
+
xt_pair_dist_max: 3 # in nm (not Å)
|
| 35 |
+
# Binning for the pair distances for self conditioning
|
| 36 |
+
x_sc_pair_dist_dim: 30
|
| 37 |
+
x_sc_pair_dist_min: 0.1 # in nm (not Å)
|
| 38 |
+
x_sc_pair_dist_max: 3 # in nm (not Å)
|
| 39 |
+
# Relative sequence separation
|
| 40 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 41 |
+
# Dimension of final pair representation
|
| 42 |
+
pair_repr_dim: 256
|
| 43 |
+
|
| 44 |
+
update_pair_repr: True # whether to update pair representation
|
| 45 |
+
update_pair_repr_every_n: 2 # Update the pair representation every n layers
|
| 46 |
+
use_tri_mult: True # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 47 |
+
|
| 48 |
+
use_qkln: True
|
configs/nn_ae/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
configs/nn_ae/nn_130m.yaml
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: transformer_ae # name of architecture
|
| 2 |
+
|
| 3 |
+
latent_z_dim: &latent_z_dim 8
|
| 4 |
+
|
| 5 |
+
encoder:
|
| 6 |
+
nlayers: 12 # number of transformer layers
|
| 7 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 8 |
+
nheads: 12 # number of attn heads
|
| 9 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 10 |
+
|
| 11 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 12 |
+
# If True, if some feature is not provided, then it raises an error
|
| 13 |
+
|
| 14 |
+
# feats_seq: ["res_seq_pdb_idx", "chain_break_per_res", "x1_aatype", "x1_a37coors_nm", "x1_a37coors_nm_rel", "x1_bb_angles", "x1_sidechain_angles"] # Sequence features to include in initial representation
|
| 15 |
+
feats_seq: ["chain_break_per_res", "x1_aatype", "x1_a37coors_nm", "x1_a37coors_nm_rel", "x1_bb_angles", "x1_sidechain_angles", "chain_idx_seq"] # Sequence features to include in initial representation
|
| 16 |
+
# feats_seq: ["chain_break_per_res", "x1_aatype", "x1_bb_angles", "x1_sidechain_angles"] # Sequence features to include in initial representation
|
| 17 |
+
feats_cond_seq: # Sequence features to include in conditioning variables
|
| 18 |
+
|
| 19 |
+
# Parameters for the features we extract
|
| 20 |
+
dim_cond: 128 # dimension of conditioning vector
|
| 21 |
+
idx_emb_dim: 128 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 22 |
+
|
| 23 |
+
feats_pair_repr: ["rel_seq_sep", "x1_bb_pair_dists_nm", "x1_bb_pair_orientation", "chain_idx_pair"] # Features to include in the pair representation
|
| 24 |
+
# feats_pair_repr: ["rel_seq_sep", "x1_bb_pair_dists_nm"] # Features to include in the pair representation
|
| 25 |
+
|
| 26 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 27 |
+
pair_repr_dim: 256
|
| 28 |
+
|
| 29 |
+
update_pair_repr: False # whether to update pair representation
|
| 30 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 31 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 32 |
+
|
| 33 |
+
use_qkln: True
|
| 34 |
+
|
| 35 |
+
normalize_latent: false
|
| 36 |
+
latent_z_dim: *latent_z_dim
|
| 37 |
+
|
| 38 |
+
decoder:
|
| 39 |
+
nlayers: 12 # number of transformer layers
|
| 40 |
+
token_dim: 768 # dimension of the tokens in the sequence
|
| 41 |
+
|
| 42 |
+
abs_coors: False # Compute absolute coors or use relative to CA
|
| 43 |
+
|
| 44 |
+
# type: ff_local
|
| 45 |
+
# # This for 7m params
|
| 46 |
+
# nlayers: 12 # number of transformer layers
|
| 47 |
+
# token_dim: 768 # dimension of the tokens dim in the sequence
|
| 48 |
+
|
| 49 |
+
nheads: 12 # number of attn heads
|
| 50 |
+
parallel_mha_transition: False # whether to compute mha and transition as parallel and add them up (AF3 style) or sequentially (normal transofrmers)
|
| 51 |
+
|
| 52 |
+
strict_feats: False # if False, then fills missing features with default values (e.g. chain break with zero, residue sequence index by [0, 1, 2, ...], etc)
|
| 53 |
+
# If True, if some feature is not provided, then it raises an error
|
| 54 |
+
|
| 55 |
+
feats_seq: ["ca_coors_nm", "z_latent_seq"] # Sequence features to include in initial representation
|
| 56 |
+
feats_cond_seq: # Sequence features to include in conditioning variables
|
| 57 |
+
|
| 58 |
+
# Parameters for the features we extract
|
| 59 |
+
dim_cond: 128 # dimension of conditioning vector
|
| 60 |
+
idx_emb_dim: 128 # dimension of the sequence position [0, 1, 2, ...] (if contiguous residues) embeddings
|
| 61 |
+
|
| 62 |
+
feats_pair_repr: ["rel_seq_sep", "ca_coors_nm_pair_dists"] # Features to include in the pair representation
|
| 63 |
+
|
| 64 |
+
seq_sep_dim: 127 # should be odd >= 5
|
| 65 |
+
pair_repr_dim: 256
|
| 66 |
+
|
| 67 |
+
update_pair_repr: False # whether to update pair representation
|
| 68 |
+
update_pair_repr_every_n: 3 # Update the pair representation every n layers
|
| 69 |
+
use_tri_mult: False # whether to use triangular multiplication layers in pair update, ignored if not updating pair representation
|
| 70 |
+
|
| 71 |
+
use_qkln: True
|
| 72 |
+
latent_z_dim: *latent_z_dim
|
| 73 |
+
|
configs/training_ae.yaml
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run_name_: test_release_ae
|
| 2 |
+
|
| 3 |
+
hardware:
|
| 4 |
+
ncpus_per_task_train_: 24 # Number of CPUs per tast during training
|
| 5 |
+
ncpus_per_task_prepro_: 32 # Number of CPUs used for data preprocessing run
|
| 6 |
+
accelerator: gpu
|
| 7 |
+
ngpus_per_node_: 1 # Number of GPUs per node
|
| 8 |
+
nnodes_: 1 # Number of nodes
|
| 9 |
+
|
| 10 |
+
defaults:
|
| 11 |
+
- nn_ae: nn_130m
|
| 12 |
+
- dataset: pdb/pdb_train_ucond
|
| 13 |
+
- _self_
|
| 14 |
+
|
| 15 |
+
# Pre-training checkpoint to start from there
|
| 16 |
+
pretrain_ckpt_path:
|
| 17 |
+
|
| 18 |
+
# Loss
|
| 19 |
+
loss:
|
| 20 |
+
kl:
|
| 21 |
+
weight: 1e-4
|
| 22 |
+
anneal: false
|
| 23 |
+
patience: 10000
|
| 24 |
+
struct:
|
| 25 |
+
type: l2
|
| 26 |
+
# type: l2cut_0.01
|
| 27 |
+
weight: 1.0
|
| 28 |
+
seq:
|
| 29 |
+
weight: 1.0
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# Precision
|
| 33 |
+
force_precision_f32: False # If false will use bf16-mixed precision
|
| 34 |
+
|
| 35 |
+
# Optimization
|
| 36 |
+
opt:
|
| 37 |
+
lr: 0.0001
|
| 38 |
+
max_epochs: 10000000
|
| 39 |
+
accumulate_grad_batches: 1
|
| 40 |
+
skip_nan_grad: False # Skip updates with nan gradient
|
| 41 |
+
grad_and_weight_analysis: True # Log some statistics of gradients and weights
|
| 42 |
+
dist_strategy: ddp # For multi GPU training, do not change
|
| 43 |
+
val_check_interval: 5000 # Number of training steps after which we check validation loss
|
| 44 |
+
skip_large_grad_updates:
|
| 45 |
+
use: False # Do not skip updates large gradients
|
| 46 |
+
moving_avg_size: 100
|
| 47 |
+
factor_threshold: 10
|
| 48 |
+
min_opt_steps: 1500
|
| 49 |
+
|
| 50 |
+
# wandb logging and checkpoints
|
| 51 |
+
log:
|
| 52 |
+
wandb_project: protein_ae
|
| 53 |
+
log_wandb: False # whether to log to wandb
|
| 54 |
+
log_every_n_steps: 1 # wandb logging frequency
|
| 55 |
+
checkpoint: True # whether to store checkpoints
|
| 56 |
+
checkpoint_every_n_steps: 10000 # How often we store a checkpoint, should be greater than val_check_interval in `opt`
|
| 57 |
+
last_ckpt_every_n_steps: 1500 # How often do we update our last ckpt, needed for requeuing without losing progress
|
| 58 |
+
|
| 59 |
+
seed: 42
|
| 60 |
+
|
| 61 |
+
ema:
|
| 62 |
+
decay: 0.999 # 0 means no EMA, so all the EMA machinery is unused and no EMA checkpoints are stored
|
| 63 |
+
validate_original_weights: False # Whether to run validation on regular or EMA weights
|
| 64 |
+
every_n_steps: 1 # Frequency of EMA updates
|
| 65 |
+
cpu_offload: False # Whether to offload EMA weights to cpu
|
| 66 |
+
|
| 67 |
+
|
configs/training_local_latents.yaml
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run_name_: test_release_diffusion
|
| 2 |
+
|
| 3 |
+
hardware:
|
| 4 |
+
ncpus_per_task_train_: 24 # Number of CPUs per tast during training
|
| 5 |
+
ncpus_per_task_prepro_: 32 # Number of CPUs used for data preprocessing run
|
| 6 |
+
accelerator: gpu
|
| 7 |
+
ngpus_per_node_: 1 ##2026 UPDATE
|
| 8 |
+
nnodes_: 1
|
| 9 |
+
|
| 10 |
+
defaults:
|
| 11 |
+
- dataset: pdb/pdb_train_ucond
|
| 12 |
+
- nn: local_latents_score_nn_160M
|
| 13 |
+
- generation: validation_local_latents # specifies all arguments for validation
|
| 14 |
+
- _self_
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Pre-training checkpoint to start from there
|
| 18 |
+
pretrain_ckpt_path:
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Modalities to use
|
| 22 |
+
product_flowmatcher:
|
| 23 |
+
bb_ca:
|
| 24 |
+
zero_com_noise: True # whether to center noise samples
|
| 25 |
+
guidance_enabled: True # whether this modality can use guidance
|
| 26 |
+
dim: 3 # Only CA atoms in bb_ca
|
| 27 |
+
local_latents:
|
| 28 |
+
zero_com_noise: False # whether to center noise samples
|
| 29 |
+
guidance_enabled: True
|
| 30 |
+
dim: null # Overwritten in the code by the correct value loaded from the autoencoder (likely 4 or 8)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
#autoencoder_ckpt_path: ./checkpoints_laproteina/AE1_ucond_512.ckpt
|
| 34 |
+
autoencoder_ckpt_path: ${oc.env:ONESCIENCE_DATASETS_DIR}/la-proteina/checkpoints_laproteina/AE1_ucond_512.ckpt
|
| 35 |
+
|
| 36 |
+
# Loss
|
| 37 |
+
loss:
|
| 38 |
+
t_distribution:
|
| 39 |
+
bb_ca:
|
| 40 |
+
name: mix_unif_beta
|
| 41 |
+
p1: 1.9
|
| 42 |
+
p2: 1.0
|
| 43 |
+
p3: 0.02
|
| 44 |
+
local_latents:
|
| 45 |
+
name: mix_unif_beta
|
| 46 |
+
p1: 1.0
|
| 47 |
+
p2: 1.5
|
| 48 |
+
p3: 0.2
|
| 49 |
+
|
| 50 |
+
shared_groups:
|
| 51 |
+
|
| 52 |
+
# Precision
|
| 53 |
+
force_precision_f32: False # If false will use bf16-mixed precision
|
| 54 |
+
|
| 55 |
+
# Training
|
| 56 |
+
training:
|
| 57 |
+
n_recycle: 0
|
| 58 |
+
motif_conditioning: False
|
| 59 |
+
self_cond: True
|
| 60 |
+
p_folding_n_inv_folding_iters: 0.1
|
| 61 |
+
|
| 62 |
+
# LoRA
|
| 63 |
+
lora:
|
| 64 |
+
r: null # Rank of low-rank adpation of matrices. Set r as null to turn off lora
|
| 65 |
+
lora_alpha: 32.0 # Scaling of lora matrices
|
| 66 |
+
lora_dropout: 0.0 # Dropout of lora inputs
|
| 67 |
+
train_bias: none # Fine-tune bias or not. ['none', 'all', 'lora_only']
|
| 68 |
+
|
| 69 |
+
# Optimization
|
| 70 |
+
opt:
|
| 71 |
+
lr: 0.0001
|
| 72 |
+
max_epochs: 10000000
|
| 73 |
+
accumulate_grad_batches: 1
|
| 74 |
+
skip_nan_grad: False # Skip updates with nan gradient
|
| 75 |
+
grad_and_weight_analysis: False # Log some statistics of gradients and weights
|
| 76 |
+
dist_strategy: ddp # For multi GPU training, do not change
|
| 77 |
+
val_check_interval: 5000 # Number of training steps after which we check validation loss
|
| 78 |
+
|
| 79 |
+
# wandb logging and checkpoints
|
| 80 |
+
log:
|
| 81 |
+
wandb_project: laproteina
|
| 82 |
+
log_wandb: False # whether to log to wandb
|
| 83 |
+
log_every_n_steps: 10 # wandb logging frequency
|
| 84 |
+
checkpoint: True # whether to store checkpoints
|
| 85 |
+
checkpoint_every_n_steps: 10000 # How often we store a checkpoint, should be greater than val_check_interval in `opt`
|
| 86 |
+
last_ckpt_every_n_steps: 1500 # How often do we update our last ckpt, needed for requeuing without losing progress
|
| 87 |
+
|
| 88 |
+
seed: 42
|
| 89 |
+
|
| 90 |
+
ema:
|
| 91 |
+
decay: 0.999 # 0 means no EMA, so all the EMA machinery is unused and no EMA checkpoints are stored
|
| 92 |
+
validate_original_weights: False # Whether to run validation on regular or EMA weights
|
| 93 |
+
every_n_steps: 1 # Frequency of EMA updates
|
| 94 |
+
cpu_offload: False # Whether to offload EMA weights to cpu
|
| 95 |
+
|
| 96 |
+
|
models/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Embedded La-Proteina model package for OneScience."""
|
| 2 |
+
|
| 3 |
+
from models import datasets, utils
|
| 4 |
+
|
| 5 |
+
__all__ = ["datasets", "utils"]
|
models/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (351 Bytes). View file
|
|
|
models/__pycache__/evaluate.cpython-311.pyc
ADDED
|
Binary file (19.4 kB). View file
|
|
|
models/__pycache__/generate.cpython-311.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
models/__pycache__/package_config.cpython-311.pyc
ADDED
|
Binary file (713 Bytes). View file
|
|
|
models/__pycache__/proteina.cpython-311.pyc
ADDED
|
Binary file (31.8 kB). View file
|
|
|
models/__pycache__/train.cpython-311.pyc
ADDED
|
Binary file (15.1 kB). View file
|
|
|
models/datasets/__pycache__/base_data.cpython-311.pyc
ADDED
|
Binary file (10.5 kB). View file
|
|
|
models/datasets/__pycache__/gen_dataset.cpython-311.pyc
ADDED
|
Binary file (24.2 kB). View file
|
|
|
models/datasets/__pycache__/pdb_data.cpython-311.pyc
ADDED
|
Binary file (43.3 kB). View file
|
|
|
models/datasets/__pycache__/transforms.cpython-311.pyc
ADDED
|
Binary file (39.1 kB). View file
|
|
|
models/datasets/base_data.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from abc import ABC, abstractmethod
|
| 2 |
+
from typing import Callable, Dict, Iterable, List, Literal, Optional
|
| 3 |
+
|
| 4 |
+
import lightning as L
|
| 5 |
+
from loguru import logger
|
| 6 |
+
from torch_geometric import transforms as T
|
| 7 |
+
from torch_geometric.data import Dataset
|
| 8 |
+
from torch_geometric.loader import DataLoader
|
| 9 |
+
|
| 10 |
+
from models.utils.cluster_utils import ClusterSampler
|
| 11 |
+
from models.utils.dense_padding_data_loader import DensePaddingDataLoader
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class BaseLightningDataModule(L.LightningDataModule, ABC):
|
| 15 |
+
"""Base class for all datamodules"""
|
| 16 |
+
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
batch_padding: bool = True,
|
| 20 |
+
sampling_mode: Literal["random", "cluster-random", "cluster-reps"] = "random",
|
| 21 |
+
transforms: Optional[List[Callable]] = None,
|
| 22 |
+
pre_transforms: Optional[List[Callable]] = None,
|
| 23 |
+
pre_filters: Optional[List[Callable]] = None,
|
| 24 |
+
batch_size: int = 32,
|
| 25 |
+
num_workers: int = 32,
|
| 26 |
+
pin_memory: bool = False,
|
| 27 |
+
):
|
| 28 |
+
"""Initialising the base data module class.
|
| 29 |
+
|
| 30 |
+
Args:
|
| 31 |
+
batch_padding (bool, optional): Whether batches should be padded to a dense representation
|
| 32 |
+
with the length being either a pre-specified max length or the maximum length of the
|
| 33 |
+
sample in the batch (base PyTorch batch) or whether a sparse representation should be
|
| 34 |
+
used (PyG batch). Defaults to True (base PyTorch batch).
|
| 35 |
+
sampling_mode (Literal["random", "cluster-random", "cluster-reps"], optional): How the data should be
|
| 36 |
+
sampled from the dataset later on:
|
| 37 |
+
- "random": Select a random sequence and ignore clusters.
|
| 38 |
+
- "cluster-random": Select a random sequence from each cluster. Keep all samples for each cluster.
|
| 39 |
+
- "cluster-reps": Select the cluster representative from each cluster. Only keep the representative for each cluster.
|
| 40 |
+
Defaults to "random".
|
| 41 |
+
transforms (List[Callable]): List of transforms applied to each example.
|
| 42 |
+
pre_transforms (List[Callable]): List of transforms applied to each example before processing.
|
| 43 |
+
pre_filters (List[Callable]): List of filters applied to each example before processing.
|
| 44 |
+
batch_size (int, optional): Batch size used for dataloaders. Defaults to 32.
|
| 45 |
+
num_workers (int, optional): Number of workers used for dataloading. Defaults to 32.
|
| 46 |
+
pin_memory (bool, optional): Whether memory should be pinned. Defaults to False.
|
| 47 |
+
"""
|
| 48 |
+
super().__init__()
|
| 49 |
+
self.batch_padding = batch_padding
|
| 50 |
+
self.sampling_mode = sampling_mode
|
| 51 |
+
self.transform = (
|
| 52 |
+
self._compose_transforms(transforms) if transforms is not None else None
|
| 53 |
+
)
|
| 54 |
+
self.pre_transform = (
|
| 55 |
+
self._compose_transforms(pre_transforms)
|
| 56 |
+
if pre_transforms is not None
|
| 57 |
+
else None
|
| 58 |
+
)
|
| 59 |
+
self.pre_filter = (
|
| 60 |
+
self._compose_filters(pre_filters) if pre_filters is not None else None
|
| 61 |
+
)
|
| 62 |
+
self.batch_size = batch_size
|
| 63 |
+
self.num_workers = num_workers
|
| 64 |
+
self.pin_memory = pin_memory
|
| 65 |
+
self.train_ds = None
|
| 66 |
+
self.val_ds = None
|
| 67 |
+
self.test_ds = None
|
| 68 |
+
self.clusterid_to_seqid_mappings = None # for cluster sampling
|
| 69 |
+
|
| 70 |
+
def setup(self, stage: Optional[str] = None):
|
| 71 |
+
if stage == "fit" or stage is None:
|
| 72 |
+
self.train_ds = self.train_dataset()
|
| 73 |
+
elif stage == "validation":
|
| 74 |
+
self.val_ds = self.val_dataset()
|
| 75 |
+
elif stage == "test":
|
| 76 |
+
self.test_ds = self.test_dataset()
|
| 77 |
+
|
| 78 |
+
def _compose_transforms(self, transforms: Iterable[Callable]) -> T.Compose:
|
| 79 |
+
try:
|
| 80 |
+
return T.Compose(list(transforms.values()))
|
| 81 |
+
except Exception:
|
| 82 |
+
return T.Compose(transforms)
|
| 83 |
+
|
| 84 |
+
def _compose_filters(self, filters: Iterable[Callable]) -> T.ComposeFilters:
|
| 85 |
+
try:
|
| 86 |
+
return T.ComposeFilters(list(filters.values()))
|
| 87 |
+
except Exception:
|
| 88 |
+
return T.ComposeFilters(filters)
|
| 89 |
+
|
| 90 |
+
@abstractmethod
|
| 91 |
+
def _get_dataset(self, split: str) -> Dataset:
|
| 92 |
+
"""Creates a dataset given a split.
|
| 93 |
+
|
| 94 |
+
Args:
|
| 95 |
+
split (str): Split for which to get the dataset, with options "train", "val" or "test"
|
| 96 |
+
|
| 97 |
+
Returns:
|
| 98 |
+
Dataset: Dataset created for the respective split
|
| 99 |
+
"""
|
| 100 |
+
...
|
| 101 |
+
|
| 102 |
+
def train_dataset(self) -> Dataset:
|
| 103 |
+
return self._get_dataset("train")
|
| 104 |
+
|
| 105 |
+
def val_dataset(self) -> Dataset:
|
| 106 |
+
return self._get_dataset("val")
|
| 107 |
+
|
| 108 |
+
def test_dataset(self) -> Dataset:
|
| 109 |
+
return self._get_dataset("test")
|
| 110 |
+
|
| 111 |
+
def _get_dataloader(
|
| 112 |
+
self,
|
| 113 |
+
dataset: Dataset,
|
| 114 |
+
shuffle: bool = False,
|
| 115 |
+
clusterid_to_seqid_mapping: Dict[str, List[str]] = None,
|
| 116 |
+
) -> DataLoader:
|
| 117 |
+
"""Returns the dataloader for the corresponding dataset.
|
| 118 |
+
|
| 119 |
+
Args:
|
| 120 |
+
dataset (Dataset): PyG dataset for which the dataloader will be created.
|
| 121 |
+
shuffle (bool, optional): Whether the dataloader should be shuffled. Defaults to False. False when cluster_id mapping is given.
|
| 122 |
+
clusterid_to_seqid_mapping (Dict[str, List[str]], optional): Maps cluster ids to sequence ids. Defaults to None.
|
| 123 |
+
|
| 124 |
+
Returns:
|
| 125 |
+
DataLoader: Dataloader to be used by model.
|
| 126 |
+
"""
|
| 127 |
+
if self.sampling_mode is None:
|
| 128 |
+
raise ValueError(
|
| 129 |
+
"Sampling mode not set, should be one of 'random', 'cluster-random' or 'cluster-reps'"
|
| 130 |
+
)
|
| 131 |
+
if clusterid_to_seqid_mapping and self.sampling_mode != "random":
|
| 132 |
+
sampler = ClusterSampler(
|
| 133 |
+
dataset=dataset,
|
| 134 |
+
clusterid_to_seqid_mapping=clusterid_to_seqid_mapping,
|
| 135 |
+
sampling_mode=self.sampling_mode,
|
| 136 |
+
)
|
| 137 |
+
shuffle = False
|
| 138 |
+
elif self.sampling_mode == "random":
|
| 139 |
+
sampler = None
|
| 140 |
+
shuffle = shuffle
|
| 141 |
+
else:
|
| 142 |
+
raise ValueError(
|
| 143 |
+
f"Sampling mode is {self.sampling_mode}, but clusterid_to_seqid_mapping is {clusterid_to_seqid_mapping}"
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
dataloader_class = DensePaddingDataLoader if self.batch_padding else DataLoader
|
| 147 |
+
|
| 148 |
+
return dataloader_class(
|
| 149 |
+
dataset,
|
| 150 |
+
batch_size=self.batch_size,
|
| 151 |
+
sampler=sampler,
|
| 152 |
+
shuffle=shuffle,
|
| 153 |
+
num_workers=self.num_workers,
|
| 154 |
+
pin_memory=self.pin_memory,
|
| 155 |
+
drop_last=True,
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
def train_dataloader(self) -> DataLoader:
|
| 159 |
+
if self.train_ds is None:
|
| 160 |
+
self.train_ds = self.train_dataset()
|
| 161 |
+
clusterid_to_seqid_mapping = (
|
| 162 |
+
self.clusterid_to_seqid_mappings["train"]
|
| 163 |
+
if self.clusterid_to_seqid_mappings
|
| 164 |
+
else None
|
| 165 |
+
)
|
| 166 |
+
shuffle = True
|
| 167 |
+
train_dl = self._get_dataloader(
|
| 168 |
+
dataset=self.train_ds,
|
| 169 |
+
shuffle=shuffle,
|
| 170 |
+
clusterid_to_seqid_mapping=clusterid_to_seqid_mapping,
|
| 171 |
+
)
|
| 172 |
+
return train_dl
|
| 173 |
+
|
| 174 |
+
def val_dataloader(self) -> DataLoader:
|
| 175 |
+
if self.val_ds is None:
|
| 176 |
+
self.val_ds = self.val_dataset()
|
| 177 |
+
clusterid_to_seqid_mapping = (
|
| 178 |
+
self.clusterid_to_seqid_mappings["val"]
|
| 179 |
+
if self.clusterid_to_seqid_mappings
|
| 180 |
+
else None
|
| 181 |
+
)
|
| 182 |
+
shuffle = False
|
| 183 |
+
logger.info(f"Length of validation set: {len(self.val_ds)}")
|
| 184 |
+
val_dl = self._get_dataloader(
|
| 185 |
+
dataset=self.val_ds,
|
| 186 |
+
shuffle=shuffle,
|
| 187 |
+
clusterid_to_seqid_mapping=clusterid_to_seqid_mapping,
|
| 188 |
+
)
|
| 189 |
+
return val_dl
|
| 190 |
+
|
| 191 |
+
def test_dataloader(self) -> DataLoader:
|
| 192 |
+
if self.test_ds is None:
|
| 193 |
+
self.test_ds = self.test_dataset()
|
| 194 |
+
clusterid_to_seqid_mapping = (
|
| 195 |
+
self.clusterid_to_seqid_mappings["test"]
|
| 196 |
+
if self.clusterid_to_seqid_mappings
|
| 197 |
+
else None
|
| 198 |
+
)
|
| 199 |
+
shuffle = False
|
| 200 |
+
test_dl = self._get_dataloader(
|
| 201 |
+
dataset=self.test_ds,
|
| 202 |
+
shuffle=shuffle,
|
| 203 |
+
clusterid_to_seqid_mapping=clusterid_to_seqid_mapping,
|
| 204 |
+
)
|
| 205 |
+
return test_dl
|
models/datasets/gen_dataset.py
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import random
|
| 2 |
+
from collections import defaultdict
|
| 3 |
+
from typing import Dict, List, Optional, Tuple
|
| 4 |
+
|
| 5 |
+
import numpy as np
|
| 6 |
+
import torch
|
| 7 |
+
from loguru import logger
|
| 8 |
+
from torch.utils.data import Dataset
|
| 9 |
+
|
| 10 |
+
from models.utils.align_utils import mean_w_mask
|
| 11 |
+
from models.utils.fold_utils import mask_cath_code_by_level
|
| 12 |
+
from models.utils.motif_utils import parse_motif, save_motif_csv
|
| 13 |
+
from models.utils.coors_utils import ang_to_nm
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class GenDataset(Dataset):
|
| 17 |
+
"""
|
| 18 |
+
This class provides length-centric and fold-centric sampling for unconditional
|
| 19 |
+
and conditional protein structure generation. Each returned item is a dictionary
|
| 20 |
+
with key information for generation, which contains the length of proteins, the
|
| 21 |
+
number of proteins and cath codes if conditional sampling is used.
|
| 22 |
+
|
| 23 |
+
If length distribution is specified, sample `nsamples` proteins for each length,
|
| 24 |
+
cath codes are randomly sampled based on empirical distribution.
|
| 25 |
+
Otherwise, if cath code set is specified, sample `nsamples` proteins for each cath code,
|
| 26 |
+
lengths are randomly sampled based on empirical distribution.
|
| 27 |
+
|
| 28 |
+
Each sample returned by this dataset is a 2-tuple (L, nsamples) or 3-tuple (L, nsamples, cath_code) where
|
| 29 |
+
- nres (int) is the number of residues in the proteins to be samples
|
| 30 |
+
- nsamples (int) is the number of proteins to generate (happens in parallel),
|
| 31 |
+
so if nsamples=10 it means that it will produce 10 proteins of length L (all sampled in parallel)
|
| 32 |
+
- cath_code (List[str]) is the cath code for the nsamples if conditional generation is used
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
def __init__(
|
| 36 |
+
self,
|
| 37 |
+
nlens_cfg: Optional[Dict] = None,
|
| 38 |
+
cath_codes: Optional[List[str]] = None,
|
| 39 |
+
empirical_distribution_cfg: Optional[Dict] = None,
|
| 40 |
+
motif_dict_cfg: Optional[Dict] = None,
|
| 41 |
+
motif_task_name: Optional[str] = None,
|
| 42 |
+
motif_csv_path: Optional[str] = None,
|
| 43 |
+
target_as_features: bool = False,
|
| 44 |
+
nsamples: Optional[int] = 1,
|
| 45 |
+
max_nsamples_per_batch: Optional[int] = 1,
|
| 46 |
+
n_replicas: int = 1,
|
| 47 |
+
):
|
| 48 |
+
"""
|
| 49 |
+
Args:
|
| 50 |
+
nlens_cfg (Optional[Dict]): Config dict for specifying length distribution. If not None, use length-centric sampling.
|
| 51 |
+
Defaults to None.
|
| 52 |
+
cath_codes (Optional[List[str]]): List of cath codes to sample.. If not None and nlens_cfg is None, use fold-centric sampling.
|
| 53 |
+
Defaults to None.
|
| 54 |
+
empirical_distribution_cfg (Optional[Dict]): Config dict for specifying (length, cath code) distribution.
|
| 55 |
+
Defaults to None.
|
| 56 |
+
motif_dict_cfg (Optional[Dict]): Config dict for all motif configs.
|
| 57 |
+
Defaults to None.
|
| 58 |
+
motif_task_name (Optional[str]): Name of the motif task to sample.
|
| 59 |
+
Defaults to None.
|
| 60 |
+
motif_csv_path (Optional[str]): Path to the motif csv file.
|
| 61 |
+
Defaults to None.
|
| 62 |
+
|
| 63 |
+
nsamples (Optional[int]): Number of samples to generate for each length or each cath code.
|
| 64 |
+
Defaults to 1.
|
| 65 |
+
max_nsamples_per_batch (Optional[int]): Maximum number of samples for each batch.
|
| 66 |
+
Defaults to 1.
|
| 67 |
+
n_replicas (Optional[int]): Number of devices. Used for validation on multiple devices.
|
| 68 |
+
Defaults to 1.
|
| 69 |
+
"""
|
| 70 |
+
super(GenDataset, self).__init__()
|
| 71 |
+
##################################################################################
|
| 72 |
+
################### 1. Parse length and cath codes ###############################
|
| 73 |
+
##################################################################################
|
| 74 |
+
nres = self.parse_nlens_cfg(nlens_cfg)
|
| 75 |
+
self.target_as_features = target_as_features
|
| 76 |
+
self.motif_task_name = motif_task_name
|
| 77 |
+
if nres is not None:
|
| 78 |
+
logger.info("Use length-centric sampling.")
|
| 79 |
+
nsamples = [nsamples] * len(nres)
|
| 80 |
+
elif motif_task_name:
|
| 81 |
+
logger.info("Use motif-conditioned sampling.")
|
| 82 |
+
if motif_task_name in motif_dict_cfg:
|
| 83 |
+
motif_cfg = motif_dict_cfg[motif_task_name]
|
| 84 |
+
else:
|
| 85 |
+
raise ValueError(
|
| 86 |
+
f"Motif task name {motif_task_name} not found in motif_dict_cfg"
|
| 87 |
+
)
|
| 88 |
+
nsamples = [nsamples]
|
| 89 |
+
else:
|
| 90 |
+
raise ValueError("Error in GenDataset init.")
|
| 91 |
+
|
| 92 |
+
##################################################################################
|
| 93 |
+
################### 2. Parse and bucketize empirical distribution ################
|
| 94 |
+
##################################################################################
|
| 95 |
+
if empirical_distribution_cfg:
|
| 96 |
+
self.parse_empirical_distribution_cfg(empirical_distribution_cfg)
|
| 97 |
+
self.bucketize()
|
| 98 |
+
|
| 99 |
+
##################################################################################
|
| 100 |
+
################### 3. Generate data points ######################################
|
| 101 |
+
##################################################################################
|
| 102 |
+
self.motif_masks = [None] * len(nsamples)
|
| 103 |
+
self.x_motifs = [None] * len(nsamples)
|
| 104 |
+
self.masks = [None] * len(nsamples)
|
| 105 |
+
if nres is not None:
|
| 106 |
+
# Length-centric generation
|
| 107 |
+
self.nres, self.cath_codes, self.nsamples = (
|
| 108 |
+
self.generate_cath_code_given_len(nres, nsamples)
|
| 109 |
+
)
|
| 110 |
+
elif cath_codes:
|
| 111 |
+
# Fold-centric generation
|
| 112 |
+
self.nres, self.cath_codes, self.nsamples = (
|
| 113 |
+
self.generate_len_given_cath_code(cath_codes, nsamples)
|
| 114 |
+
)
|
| 115 |
+
else:
|
| 116 |
+
self.nsamples = nsamples
|
| 117 |
+
self.cath_codes = [None] * len(nsamples)
|
| 118 |
+
self.motif_masks, self.x_motifs, self.residue_types = (
|
| 119 |
+
self.generate_motif_info(motif_cfg, nsamples[0], motif_csv_path)
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
##################################################################################
|
| 123 |
+
# 4. Make sure the nsamples for each data point is not greater than max_nsamples #
|
| 124 |
+
##################################################################################
|
| 125 |
+
if max_nsamples_per_batch:
|
| 126 |
+
if nres is not None or cath_codes:
|
| 127 |
+
self.nres, self.cath_codes, self.nsamples = self.flatten(
|
| 128 |
+
max_nsamples_per_batch
|
| 129 |
+
)
|
| 130 |
+
else:
|
| 131 |
+
(
|
| 132 |
+
self.nres,
|
| 133 |
+
self.cath_codes,
|
| 134 |
+
self.nsamples,
|
| 135 |
+
self.masks,
|
| 136 |
+
self.motif_masks,
|
| 137 |
+
self.x_motifs,
|
| 138 |
+
self.residue_types,
|
| 139 |
+
) = self.flatten_motif(max_nsamples_per_batch)
|
| 140 |
+
|
| 141 |
+
##################################################################################
|
| 142 |
+
# 5. Make sure this won't cause an error during validation on multiple devices ###
|
| 143 |
+
##################################################################################
|
| 144 |
+
if n_replicas > 1:
|
| 145 |
+
self.pad_nlens(n_replicas)
|
| 146 |
+
assert all(
|
| 147 |
+
[n <= max_nsamples_per_batch for n in self.nsamples]
|
| 148 |
+
), f"The nsamples for each len shouldn't be greater than {max_nsamples_per_batch}"
|
| 149 |
+
assert (
|
| 150 |
+
len(self.nsamples) % n_replicas == 0
|
| 151 |
+
), f"Should be evenly splitable over {n_replicas} devices"
|
| 152 |
+
|
| 153 |
+
logger.info(
|
| 154 |
+
f"Adding generation dataset to sample {self.nsamples} sequences of length {self.nres}."
|
| 155 |
+
)
|
| 156 |
+
|
| 157 |
+
def bucketize(self):
|
| 158 |
+
"""Build length buckets for cath_codes. Record the cath_code distribution given length bucket and the reverse"""
|
| 159 |
+
if self.len_cath_codes is None:
|
| 160 |
+
self.cath_codes_given_len_bucket = None
|
| 161 |
+
self.len_bucket_given_cath_codes = None
|
| 162 |
+
return
|
| 163 |
+
|
| 164 |
+
bucket = list(
|
| 165 |
+
range(self.bucket_min_len, self.bucket_max_len, self.bucket_step_size)
|
| 166 |
+
)
|
| 167 |
+
cath_codes_given_len_bucket = [[] for _ in range(len(bucket))]
|
| 168 |
+
len_bucket_given_cath_codes = defaultdict(set)
|
| 169 |
+
for _len, codes in self.len_cath_codes:
|
| 170 |
+
if len(codes) == 0:
|
| 171 |
+
continue
|
| 172 |
+
bucket_idx = (_len - self.bucket_min_len) // self.bucket_step_size
|
| 173 |
+
bucket_idx = min(bucket_idx, self.bucket_size - 1) # Boundary cutoff
|
| 174 |
+
bucket_idx = max(bucket_idx, 0)
|
| 175 |
+
|
| 176 |
+
# Record all possible cath codes for each bucket
|
| 177 |
+
cath_codes_given_len_bucket[bucket_idx].append(codes)
|
| 178 |
+
|
| 179 |
+
# Record all possible len bucket for each cath code
|
| 180 |
+
for code in codes:
|
| 181 |
+
for level in ["C", "A", "T"]:
|
| 182 |
+
ns = {"C": 3, "A": 2, "T": 1}
|
| 183 |
+
level_code = code.rsplit(".", ns[level])[0] + ".x" * ns[level]
|
| 184 |
+
len_bucket_given_cath_codes[level_code].add(bucket_idx)
|
| 185 |
+
|
| 186 |
+
for k, v in len_bucket_given_cath_codes.items():
|
| 187 |
+
len_bucket_given_cath_codes[k] = tuple(v)
|
| 188 |
+
|
| 189 |
+
self.cath_codes_given_len_bucket = cath_codes_given_len_bucket
|
| 190 |
+
self.len_bucket_given_cath_codes = len_bucket_given_cath_codes
|
| 191 |
+
|
| 192 |
+
def generate_cath_code_given_len(self, nres: List[int], nsamples: List[int]):
|
| 193 |
+
"""Pre-generate corresponding cath codes for each length"""
|
| 194 |
+
cath_codes = []
|
| 195 |
+
for i in range(len(nres)):
|
| 196 |
+
if self.cath_codes_given_len_bucket is None:
|
| 197 |
+
cath_code = None
|
| 198 |
+
else:
|
| 199 |
+
if nres[i] <= self.bucket_max_len:
|
| 200 |
+
bucket_idx = (
|
| 201 |
+
nres[i] - self.bucket_min_len
|
| 202 |
+
) // self.bucket_step_size
|
| 203 |
+
else:
|
| 204 |
+
bucket_idx = -1
|
| 205 |
+
cath_code = random.choices(
|
| 206 |
+
self.cath_codes_given_len_bucket[bucket_idx], k=nsamples[i]
|
| 207 |
+
)
|
| 208 |
+
cath_codes.append(cath_code)
|
| 209 |
+
return nres, cath_codes, nsamples
|
| 210 |
+
|
| 211 |
+
def generate_len_given_cath_code(self, cath_codes: List[str], nsamples: List[int]):
|
| 212 |
+
"""Pre-generate corresponding lengths for each cath code, then gather proteins of the same length as one batch"""
|
| 213 |
+
assert (
|
| 214 |
+
self.len_bucket_given_cath_codes is not None
|
| 215 |
+
), "Need len_cath_code distribution for fold-centric generation"
|
| 216 |
+
tmp_nres = []
|
| 217 |
+
tmp_cath_codes = []
|
| 218 |
+
for i in range(len(cath_codes)):
|
| 219 |
+
for _ in range(nsamples[i]):
|
| 220 |
+
if cath_codes[i] not in self.len_bucket_given_cath_codes:
|
| 221 |
+
raise ValueError(
|
| 222 |
+
f"CATH code {cath_codes[i]} not in the empirical distribution"
|
| 223 |
+
)
|
| 224 |
+
bucket_idx = random.choices(
|
| 225 |
+
self.len_bucket_given_cath_codes[cath_codes[i]], k=1
|
| 226 |
+
)[0]
|
| 227 |
+
_len = self.bucket_min_len + bucket_idx * self.bucket_step_size
|
| 228 |
+
|
| 229 |
+
tmp_nres.append(_len)
|
| 230 |
+
tmp_cath_codes.append([cath_codes[i]])
|
| 231 |
+
|
| 232 |
+
# Gather the same lengths, as we need to generate proteins of the same length together
|
| 233 |
+
len_bucket = defaultdict(list)
|
| 234 |
+
out_nres, out_cath_codes, out_nsamples = [], [], []
|
| 235 |
+
for n, code in zip(tmp_nres, tmp_cath_codes):
|
| 236 |
+
len_bucket[n].append(code)
|
| 237 |
+
|
| 238 |
+
for n, code in len_bucket.items():
|
| 239 |
+
out_nres.append(n)
|
| 240 |
+
out_cath_codes.append(code)
|
| 241 |
+
out_nsamples.append(len(code))
|
| 242 |
+
|
| 243 |
+
return out_nres, out_cath_codes, out_nsamples
|
| 244 |
+
|
| 245 |
+
def generate_motif_info(self, motif_cfg, nsamples, motif_csv_path):
|
| 246 |
+
# Always return motif_masks, x_motifs, residue_types as lists of tensors, regardless of input type
|
| 247 |
+
lengths, motif_masks, x_motifs, residue_types, outstrs = parse_motif(
|
| 248 |
+
nsamples=nsamples, **motif_cfg
|
| 249 |
+
)
|
| 250 |
+
idx = np.argsort(lengths)
|
| 251 |
+
motif_masks = [motif_masks[i] for i in idx]
|
| 252 |
+
x_motifs = [x_motifs[i] for i in idx]
|
| 253 |
+
residue_types = [residue_types[i] for i in idx]
|
| 254 |
+
# center motifs to origin
|
| 255 |
+
for i in range(len(x_motifs)):
|
| 256 |
+
motif_center = mean_w_mask(
|
| 257 |
+
x_motifs[i].flatten(0, 1), motif_masks[i].flatten(0, 1)
|
| 258 |
+
).unsqueeze(0)
|
| 259 |
+
x_motifs[i] = x_motifs[i] - motif_center
|
| 260 |
+
x_motifs[i] = x_motifs[i] * motif_masks[i][..., None]
|
| 261 |
+
# Only save CSV for contig_string (residue/range) case
|
| 262 |
+
if "motif_atom_spec" not in motif_cfg or motif_cfg["motif_atom_spec"] is None:
|
| 263 |
+
outstrs = [outstrs[i] for i in idx]
|
| 264 |
+
save_motif_csv(
|
| 265 |
+
motif_cfg["motif_pdb_path"],
|
| 266 |
+
self.motif_task_name,
|
| 267 |
+
outstrs,
|
| 268 |
+
outpath=motif_csv_path,
|
| 269 |
+
segment_order=motif_cfg["segment_order"],
|
| 270 |
+
)
|
| 271 |
+
return motif_masks, x_motifs, residue_types
|
| 272 |
+
|
| 273 |
+
def flatten(self, max_nsamples: int):
|
| 274 |
+
"""Flatten the list to make sure each data point have no more than max_nsamples"""
|
| 275 |
+
nres, cath_codes, nsamples = [], [], []
|
| 276 |
+
for i in range(len(self.nsamples)):
|
| 277 |
+
for j in range(0, self.nsamples[i], max_nsamples):
|
| 278 |
+
nres.append(self.nres[i])
|
| 279 |
+
if self.cath_codes[i] is not None:
|
| 280 |
+
cath_codes.append(self.cath_codes[i][j : j + max_nsamples])
|
| 281 |
+
else:
|
| 282 |
+
cath_codes.append(None)
|
| 283 |
+
if j + max_nsamples <= self.nsamples[i]:
|
| 284 |
+
nsamples.append(max_nsamples)
|
| 285 |
+
else:
|
| 286 |
+
nsamples.append(self.nsamples[i] - j)
|
| 287 |
+
return nres, cath_codes, nsamples
|
| 288 |
+
|
| 289 |
+
def flatten_motif(self, max_nsamples: int):
|
| 290 |
+
"""Flatten the list to make sure each data point have no more than max_nsamples"""
|
| 291 |
+
nres, cath_codes, nsamples = [], [], []
|
| 292 |
+
masks, motif_masks = [], []
|
| 293 |
+
x_motifs, residue_types = [], []
|
| 294 |
+
for i in range(len(self.nsamples)):
|
| 295 |
+
for j in range(0, self.nsamples[i], max_nsamples):
|
| 296 |
+
|
| 297 |
+
if self.cath_codes[i] is not None:
|
| 298 |
+
cath_codes.append(self.cath_codes[i][j : j + max_nsamples])
|
| 299 |
+
else:
|
| 300 |
+
cath_codes.append(None)
|
| 301 |
+
if j + max_nsamples <= self.nsamples[i]:
|
| 302 |
+
nsamples.append(max_nsamples)
|
| 303 |
+
motif_mask = self.motif_masks[j : j + max_nsamples]
|
| 304 |
+
x_motif = self.x_motifs[j : j + max_nsamples]
|
| 305 |
+
residue_type = self.residue_types[j : j + max_nsamples]
|
| 306 |
+
else:
|
| 307 |
+
nsamples.append(self.nsamples[i] - j)
|
| 308 |
+
motif_mask = self.motif_masks[j : self.nsamples[i]]
|
| 309 |
+
x_motif = self.x_motifs[j : self.nsamples[i]]
|
| 310 |
+
residue_type = self.residue_types[j : self.nsamples[i]]
|
| 311 |
+
mask = [torch.Tensor([True] * x.shape[0]) for x in motif_mask]
|
| 312 |
+
padded_mask = torch.nn.utils.rnn.pad_sequence(
|
| 313 |
+
mask, batch_first=True, padding_value=False
|
| 314 |
+
)
|
| 315 |
+
padded_motif_mask = torch.nn.utils.rnn.pad_sequence(
|
| 316 |
+
motif_mask, batch_first=True, padding_value=False
|
| 317 |
+
)
|
| 318 |
+
padded_x_motif = torch.nn.utils.rnn.pad_sequence(
|
| 319 |
+
x_motif, batch_first=True, padding_value=0
|
| 320 |
+
)
|
| 321 |
+
padded_residue_type = torch.nn.utils.rnn.pad_sequence(
|
| 322 |
+
residue_type, batch_first=True, padding_value=0
|
| 323 |
+
)
|
| 324 |
+
masks.append(padded_mask)
|
| 325 |
+
motif_masks.append(padded_motif_mask)
|
| 326 |
+
x_motifs.append(padded_x_motif)
|
| 327 |
+
residue_types.append(padded_residue_type)
|
| 328 |
+
nres.append(padded_mask.shape[1])
|
| 329 |
+
return nres, cath_codes, nsamples, masks, motif_masks, x_motifs, residue_types
|
| 330 |
+
|
| 331 |
+
def pad_nlens(self, n_replicas: int):
|
| 332 |
+
"""Split nlens into data points (len, nsample) as val dataset and guarantee that
|
| 333 |
+
1. len(val_dataset) should be a multiple of n_replica, to ensure that we don't introduce additional samples for multi-gpu validation
|
| 334 |
+
2. nsample should be the same for all data points if n_replica > 1 (multi-gpu)
|
| 335 |
+
"""
|
| 336 |
+
# Add samples to the small bins
|
| 337 |
+
max_nsamples = max(self.nsamples)
|
| 338 |
+
for i in range(len(self.nsamples)):
|
| 339 |
+
while self.cath_codes[i] != None and len(self.cath_codes[i]) < max_nsamples:
|
| 340 |
+
self.cath_codes[i] += self.cath_codes[i][
|
| 341 |
+
: (max_nsamples - len(self.cath_codes[i]))
|
| 342 |
+
]
|
| 343 |
+
self.nsamples[i] += max_nsamples - self.nsamples[i]
|
| 344 |
+
|
| 345 |
+
# Keep adding lengths in the dataset to make it a multiple of n_replica
|
| 346 |
+
while len(self.nres) % n_replicas != 0:
|
| 347 |
+
self.nres.append(self.nres[-1])
|
| 348 |
+
self.nsamples.append(max_nsamples)
|
| 349 |
+
self.cath_codes.append(self.cath_codes[-1])
|
| 350 |
+
self.cath_codes.append(self.cath_codes[-1])
|
| 351 |
+
if hasattr(self, "chain_masks"):
|
| 352 |
+
self.chain_masks.append(self.chain_masks[-1])
|
| 353 |
+
if hasattr(self, "general_masks"):
|
| 354 |
+
self.general_masks.append(self.general_masks[-1])
|
| 355 |
+
if hasattr(self, "structures"):
|
| 356 |
+
self.structures.append(self.structures[-1])
|
| 357 |
+
|
| 358 |
+
def parse_empirical_distribution_cfg(self, cfg: Dict):
|
| 359 |
+
"""Load empirical (len, cath_codes) joint distribution. Apply mask according to the guidance cath code level"""
|
| 360 |
+
if cfg.len_cath_code_path is not None:
|
| 361 |
+
logger.info(
|
| 362 |
+
f"Loading empirical (length, cath_code) distribution from {cfg.len_cath_code_path}"
|
| 363 |
+
)
|
| 364 |
+
raw_len_cath_codes = torch.load(cfg.len_cath_code_path)
|
| 365 |
+
|
| 366 |
+
# By applying mask to the cath code distribution, we can control the level we want to sample
|
| 367 |
+
level = cfg.cath_code_level
|
| 368 |
+
self.len_cath_codes = []
|
| 369 |
+
for i in range(len(raw_len_cath_codes)):
|
| 370 |
+
_len, code = raw_len_cath_codes[i]
|
| 371 |
+
code = mask_cath_code_by_level(code, level="H")
|
| 372 |
+
if level == "A" or level == "C":
|
| 373 |
+
code = mask_cath_code_by_level(code, level="T")
|
| 374 |
+
if level == "C":
|
| 375 |
+
code = mask_cath_code_by_level(code, level="A")
|
| 376 |
+
self.len_cath_codes.append((_len, code))
|
| 377 |
+
|
| 378 |
+
self.bucket_min_len = cfg.bucket_min_len
|
| 379 |
+
self.bucket_max_len = cfg.bucket_max_len
|
| 380 |
+
self.bucket_step_size = cfg.bucket_step_size
|
| 381 |
+
self.bucket_size = (
|
| 382 |
+
self.bucket_max_len - self.bucket_min_len
|
| 383 |
+
) // self.bucket_step_size + 1
|
| 384 |
+
else:
|
| 385 |
+
logger.info(
|
| 386 |
+
"No empirical (length, cath_code) distribution provided. Use unconditional training."
|
| 387 |
+
)
|
| 388 |
+
self.len_cath_codes = None
|
| 389 |
+
|
| 390 |
+
def parse_nlens_cfg(self, cfg: Dict):
|
| 391 |
+
"""Load nlens config."""
|
| 392 |
+
if cfg is None:
|
| 393 |
+
return None
|
| 394 |
+
if cfg.nres_lens:
|
| 395 |
+
nres = [int(n) for n in cfg.nres_lens]
|
| 396 |
+
elif cfg.min_len:
|
| 397 |
+
nres = np.arange(cfg.min_len, cfg.max_len + 1, cfg.step_len).tolist()
|
| 398 |
+
else:
|
| 399 |
+
nres = None
|
| 400 |
+
return nres
|
| 401 |
+
|
| 402 |
+
def __len__(self):
|
| 403 |
+
return len(self.nres)
|
| 404 |
+
|
| 405 |
+
def __getitem__(self, index: int):
|
| 406 |
+
result = {
|
| 407 |
+
"nres": self.nres[index],
|
| 408 |
+
"nsamples": self.nsamples[index],
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
# Add CATH codes if available
|
| 412 |
+
if self.cath_codes[index] is not None:
|
| 413 |
+
result["cath_code"] = self.cath_codes[index]
|
| 414 |
+
# Motif-conditioned
|
| 415 |
+
if self.motif_task_name is not None:
|
| 416 |
+
# Assume motif_mask, x_motif, seq_motif_mask, seq_motif are available
|
| 417 |
+
result["motif_mask"] = self.motif_masks[index].bool() # [bs, num_res, 37]
|
| 418 |
+
result["x_motif"] = self.x_motifs[index] # [bs, num_res, 37, 3]
|
| 419 |
+
result["seq_motif_mask"] = (
|
| 420 |
+
self.motif_masks[index].sum(dim=-1).bool()
|
| 421 |
+
) # [bs, num_res]
|
| 422 |
+
result["seq_motif"] = self.residue_types[index] # [bs, num_res]
|
| 423 |
+
result["mask"] = self.masks[index].bool() # [bs, num_res]
|
| 424 |
+
return result
|
| 425 |
+
|
| 426 |
+
# Fallback: unconditional
|
| 427 |
+
return result
|