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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TargetAMP-Designer Finetuning
|
| 2 |
+
|
| 3 |
+
**TargetAMP-Designer** is an end-to-end pipeline for **target-specific peptide design and in silico screening**, accompanying my bachelor thesis and paper. It integrates (i) **LLM-based peptide generation via fine-tuning**, and (ii) a **multi-stage structural evaluation workflow** (structure prediction → docking → MD/MetaD → consistency validation).
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
## Highlights
|
| 8 |
+
|
| 9 |
+
- **Fine-tune** a ProGen2-style autoregressive model with labeled peptide data and generate new candidates by controllable sampling.
|
| 10 |
+
- **Multi-stage screening** using ZDOCK (rigid docking) → Rosetta (flexible refinement) → MD/Metadynamics validation.
|
| 11 |
+
- **Consistency validation** scripts for dataset similarity/identity and physicochemical property profiling.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
## Repository layout (recommended)
|
| 16 |
+
|
| 17 |
+
Adjust the paths below to match your local clone directory.
|
| 18 |
+
|
| 19 |
+
- `src/`
|
| 20 |
+
|
| 21 |
+
`data/` – training / test data
|
| 22 |
+
|
| 23 |
+
`models/weights/` – base model weights directory
|
| 24 |
+
|
| 25 |
+
`finetune.py` – model fine-tuning
|
| 26 |
+
|
| 27 |
+
`sample.py` / `sample.sh` – sequence sampling
|
| 28 |
+
|
| 29 |
+
`checkpoints/` – fine-tuned model outputs
|
| 30 |
+
|
| 31 |
+
`requirements.txt`
|
| 32 |
+
|
| 33 |
+
- `src/experiments/` – docking / simulation / analysis workflow
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
## Installation安装
|
| 38 |
+
|
| 39 |
+
Use a virtual environment (conda/venv) to avoid conflicts, then install dependencies:
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
cd src
|
| 43 |
+
pip install -r requirements.txt
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
> For GPU training/inference, ensure CUDA and a compatible PyTorch are installed in your environment.
|
| 47 |
+
>
|
| 48 |
+
> Docking / MD steps require external tools (ZDOCK, Rosetta, OpenMM, etc.) configured in `src/experiments/`
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
## Quickstart
|
| 53 |
+
|
| 54 |
+
### 1.Fine-tuning
|
| 55 |
+
|
| 56 |
+
Fine-tune on prepared train/test files (GPU recommended). The base weights are hosted on huggingface [repo](https://huggingface.co/BeanovaLi/TargetAMP-Designer). After finetuning, the model binary, config file and tokenizer are saved into the `./checkpoints/` directory.
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
python finetune.py \
|
| 60 |
+
--model=/home/TargetAMP-Designer/src/models/weights \
|
| 61 |
+
--train_file=/home/TargetAMP-Designer/src/data/train.txt \
|
| 62 |
+
--test_file=/home/TargetAMP-Designer/src/data/test.txt \
|
| 63 |
+
--device=cuda \
|
| 64 |
+
--epochs=20 \
|
| 65 |
+
--batch_size=16 \
|
| 66 |
+
--accumulation_steps=4 \
|
| 67 |
+
--lr=1e-4 \
|
| 68 |
+
--decay=cosine \
|
| 69 |
+
--warmup_steps=200 \
|
| 70 |
+
--eval_before_train
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Run `python3 finetune.py --help` to see the full list of available options and their descriptions.
|
| 74 |
+
|
| 75 |
+
### 2.Sampling
|
| 76 |
+
|
| 77 |
+
We provide **two equivalent ways** to run sequence generation:
|
| 78 |
+
|
| 79 |
+
**Option A: run the Python script with CLI arguments.**This is convenient for quick experiments and parameter sweeps.Use the `sample.py` script to generate new sequences from a model using top-k sampling with temperature.
|
| 80 |
+
|
| 81 |
+
```python
|
| 82 |
+
python sample.py
|
| 83 |
+
--model=/home/TargetAMP-Designer/src/models/weights/ \
|
| 84 |
+
--device=cuda \
|
| 85 |
+
--batch_size=100 \
|
| 86 |
+
--iters=1 \
|
| 87 |
+
--max_length=50 \
|
| 88 |
+
--t=1.0 \
|
| 89 |
+
--k=10 \
|
| 90 |
+
--prompt="1<|label|>"
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
Use the `--help` or `-h` option to see the full list of available options and their descriptions.
|
| 94 |
+
|
| 95 |
+
**Option B: run a bash script with parameters written inside.**For better reproducibility, you can also run a `.sh` script (e.g., `sample.sh`) where all arguments are predefined and version-controlled.
|
| 96 |
+
|
| 97 |
+
```bash
|
| 98 |
+
bash sample.sh
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
> Tip: We recommend using the `.sh` entrypoint for paper-level experiments, as it keeps sampling hyperparameters (temperature, top-k, prompt format, max length, batch size, random seed if applicable) explicitly recorded.
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
## Structural screening workflow(experiments)
|
| 106 |
+
|
| 107 |
+
All downstream experiments are under `./src/experiments/`.
|
| 108 |
+
|
| 109 |
+
### 3.Molecular Docking
|
| 110 |
+
|
| 111 |
+
Before molecular docking, we optionally run **Boltz-2** to predict peptide (or peptide–target) 3D structures as docking-ready inputs.
|
| 112 |
+
|
| 113 |
+
- Run ZDOCK with:
|
| 114 |
+
|
| 115 |
+
```bash
|
| 116 |
+
bash zdock_bash.sh
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
The docking results are saved as PDB files; you can change `result_base_dir` inside the script to control the output directory.
|
| 120 |
+
|
| 121 |
+
- Extract docking complexes:
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
python createpl_complex.py
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
- flexible refinement:
|
| 128 |
+
|
| 129 |
+
Relax receptor/ligand first, then run flexible docking using the provided flags and scripts.
|
| 130 |
+
|
| 131 |
+
```python
|
| 132 |
+
python relax_ligands.py
|
| 133 |
+
python relax_receptor.py
|
| 134 |
+
python dock.py
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
> We perform Rosetta-based refinement following a standard *Relax → Prepack → Dock* workflow. First, the receptor and ligand are relaxed separately using the flag files `relax_flag_ChainR` (receptor) and `relax_flag_ChainL` (ligand), executed via `relax_receptor.py` and `relax_ligands.py`, respectively. Next, the docking prepack stage is carried out using the prepack configuration `docking_prepack_flag` to optimize side-chain packing at the interface before docking. Finally, Rosetta docking is performed with the docking configuration `docking_flag` using `dock.py` to generate refined complex models and corresponding scores.
|
| 138 |
+
|
| 139 |
+
### 4.Molecular dynamics
|
| 140 |
+
|
| 141 |
+
Run the MD pipeline:
|
| 142 |
+
|
| 143 |
+
```python
|
| 144 |
+
python MD_simulation.py
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### 5.Consistency Vailidation & property profiling
|
| 148 |
+
|
| 149 |
+
- Dataset similarity/identity:
|
| 150 |
+
|
| 151 |
+
```bash
|
| 152 |
+
python needle_comp_similarity_identity.py
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
- Physicochemical properties:
|
| 156 |
+
|
| 157 |
+
```python
|
| 158 |
+
python physical_chemical_properties.py
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
## Citation
|
| 164 |
+
|
| 165 |
+
If you found this code useful, please cite:
|
| 166 |
+
|
| 167 |
+
```bash
|
| 168 |
+
|
| 169 |
+
```
|
| 170 |
+
|