protcross 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. protcross-0.1.1/LICENSE +21 -0
  2. protcross-0.1.1/PKG-INFO +561 -0
  3. protcross-0.1.1/README.md +521 -0
  4. protcross-0.1.1/pyproject.toml +63 -0
  5. protcross-0.1.1/setup.cfg +4 -0
  6. protcross-0.1.1/src/evopoint_da/__init__.py +4 -0
  7. protcross-0.1.1/src/evopoint_da/assets.py +178 -0
  8. protcross-0.1.1/src/evopoint_da/cli/__init__.py +2 -0
  9. protcross-0.1.1/src/evopoint_da/cli/download_af2.py +37 -0
  10. protcross-0.1.1/src/evopoint_da/cli/main.py +42 -0
  11. protcross-0.1.1/src/evopoint_da/cli/map_labels.py +43 -0
  12. protcross-0.1.1/src/evopoint_da/cli/predict.py +156 -0
  13. protcross-0.1.1/src/evopoint_da/cli/preprocess.py +45 -0
  14. protcross-0.1.1/src/evopoint_da/cli/setup_assets.py +51 -0
  15. protcross-0.1.1/src/evopoint_da/cli/train.py +19 -0
  16. protcross-0.1.1/src/evopoint_da/data/__init__.py +19 -0
  17. protcross-0.1.1/src/evopoint_da/data/af2.py +110 -0
  18. protcross-0.1.1/src/evopoint_da/data/components.py +19 -0
  19. protcross-0.1.1/src/evopoint_da/data/datamodule.py +82 -0
  20. protcross-0.1.1/src/evopoint_da/data/dataset.py +143 -0
  21. protcross-0.1.1/src/evopoint_da/data/esm.py +91 -0
  22. protcross-0.1.1/src/evopoint_da/data/label_mapping.py +340 -0
  23. protcross-0.1.1/src/evopoint_da/data/pca.py +37 -0
  24. protcross-0.1.1/src/evopoint_da/data/preprocess.py +130 -0
  25. protcross-0.1.1/src/evopoint_da/data/structure.py +138 -0
  26. protcross-0.1.1/src/evopoint_da/evaluation/__init__.py +6 -0
  27. protcross-0.1.1/src/evopoint_da/evaluation/adaptive.py +114 -0
  28. protcross-0.1.1/src/evopoint_da/evaluation/metrics.py +78 -0
  29. protcross-0.1.1/src/evopoint_da/experiments/__init__.py +2 -0
  30. protcross-0.1.1/src/evopoint_da/experiments/multiseed_benchmark.py +157 -0
  31. protcross-0.1.1/src/evopoint_da/experiments/strategy_search.py +161 -0
  32. protcross-0.1.1/src/evopoint_da/inference/__init__.py +11 -0
  33. protcross-0.1.1/src/evopoint_da/inference/pdb.py +40 -0
  34. protcross-0.1.1/src/evopoint_da/inference/predictor.py +394 -0
  35. protcross-0.1.1/src/evopoint_da/models/__init__.py +6 -0
  36. protcross-0.1.1/src/evopoint_da/models/backbones/__init__.py +6 -0
  37. protcross-0.1.1/src/evopoint_da/models/backbones/pointnet2.py +216 -0
  38. protcross-0.1.1/src/evopoint_da/models/domain_weights.py +50 -0
  39. protcross-0.1.1/src/evopoint_da/models/heads/__init__.py +6 -0
  40. protcross-0.1.1/src/evopoint_da/models/heads/classifier.py +26 -0
  41. protcross-0.1.1/src/evopoint_da/models/module.py +181 -0
  42. protcross-0.1.1/src/evopoint_da/training/__init__.py +6 -0
  43. protcross-0.1.1/src/evopoint_da/training/run.py +62 -0
  44. protcross-0.1.1/src/protcross.egg-info/PKG-INFO +561 -0
  45. protcross-0.1.1/src/protcross.egg-info/SOURCES.txt +55 -0
  46. protcross-0.1.1/src/protcross.egg-info/dependency_links.txt +1 -0
  47. protcross-0.1.1/src/protcross.egg-info/entry_points.txt +8 -0
  48. protcross-0.1.1/src/protcross.egg-info/requires.txt +27 -0
  49. protcross-0.1.1/src/protcross.egg-info/top_level.txt +1 -0
  50. protcross-0.1.1/tests/test_assets.py +37 -0
  51. protcross-0.1.1/tests/test_checkpoint_smoke.py +31 -0
  52. protcross-0.1.1/tests/test_cli.py +68 -0
  53. protcross-0.1.1/tests/test_inference_result.py +47 -0
  54. protcross-0.1.1/tests/test_label_mapping.py +15 -0
  55. protcross-0.1.1/tests/test_metrics.py +26 -0
  56. protcross-0.1.1/tests/test_pca_and_dataset.py +40 -0
  57. protcross-0.1.1/tests/test_structure_and_pdb.py +42 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shuyu Zhong
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,561 @@
1
+ Metadata-Version: 2.4
2
+ Name: protcross
3
+ Version: 0.1.1
4
+ Summary: Domain-adaptive protein point-cloud binding-site prediction.
5
+ Author: Sheng Zhong, Yun Jiang
6
+ License-Expression: MIT
7
+ Project-URL: Publication, https://doi.org/10.1021/acs.jcim.5c03224
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: biopython
17
+ Requires-Dist: hydra-core
18
+ Requires-Dist: numpy
19
+ Requires-Dist: pandas
20
+ Requires-Dist: pytorch-lightning
21
+ Requires-Dist: requests
22
+ Requires-Dist: scikit-learn
23
+ Requires-Dist: torch
24
+ Requires-Dist: torch-geometric
25
+ Requires-Dist: torchmetrics
26
+ Requires-Dist: tqdm
27
+ Provides-Extra: esm
28
+ Requires-Dist: esm>=3.1.0; extra == "esm"
29
+ Requires-Dist: httpx; extra == "esm"
30
+ Provides-Extra: predict
31
+ Requires-Dist: esm>=3.1.0; extra == "predict"
32
+ Requires-Dist: httpx; extra == "predict"
33
+ Provides-Extra: test
34
+ Requires-Dist: pytest; extra == "test"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest; extra == "dev"
37
+ Requires-Dist: build; extra == "dev"
38
+ Requires-Dist: twine; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # ProtCross
42
+
43
+ ProtCross is a domain-adaptive protein point-cloud learning framework for binding-site prediction across experimentally solved **PDB** structures and predicted **AlphaFold2 (AF2)** structures. The model accepts structures from AlphaFold and can write per-residue binding probabilities to the **B-factor column** of a new PDB output file.
44
+
45
+ **Published paper (JCIM):** Zhong, S., & Jiang, Y. (2026). ProtCross: Bridging the PDB-AlphaFold Gap for Binding Site Prediction with Protein Point Clouds. Journal of chemical information and modeling, 66(7), 3688-3701. https://doi.org/10.1021/acs.jcim.5c03224
46
+
47
+ The codebase combines:
48
+ - residue-level structural geometry (C-alpha coordinates),
49
+ - language-model residue embeddings (ESM-C), and
50
+ - confidence-aware domain adaptation (pLDDT-weighted DANN)
51
+
52
+ to improve robustness when transferring from PDB (source domain) to AF2 (target domain).
53
+
54
+ ---
55
+
56
+ ## Quick Start
57
+
58
+ Use this path when you only want to predict binding sites for one structure.
59
+
60
+ ```bash
61
+ pip install "protcross[predict]"
62
+ protcross setup-assets
63
+ protcross predict input.pdb --output input.protcross.pdb
64
+ ```
65
+
66
+ `protcross setup-assets` installs runtime assets into `~/.cache/protcross/assets/v0.1.1` by default:
67
+
68
+ ```text
69
+ best-epoch=59.ckpt # ProtCross checkpoint from the GitHub release
70
+ pca_esmc_128.pkl # PCA reducer from the GitHub release
71
+ esmc_600m_2024_12_v0.pth # ESM-C weights from Hugging Face
72
+ ```
73
+
74
+ PyPI packages ship code only. The checkpoint and PCA file must be attached to the `v0.1.1` GitHub release with the exact filenames above, or supplied with custom URLs:
75
+
76
+ ```bash
77
+ protcross setup-assets \
78
+ --checkpoint-url https://example.org/best-epoch=59.ckpt \
79
+ --pca-url https://example.org/pca_esmc_128.pkl
80
+ ```
81
+
82
+ GitHub release assets normalize `=` in filenames, so the default checkpoint URL points to `best-epoch.59.ckpt` and saves it locally as `best-epoch=59.ckpt`.
83
+
84
+ If your system already has ESM-C weights, skip that large download and pass the path at prediction time:
85
+
86
+ ```bash
87
+ protcross setup-assets --skip-esm
88
+ protcross predict input.pdb \
89
+ --esm-weights /absolute/path/to/esmc_600m_2024_12_v0.pth \
90
+ --output input.protcross.pdb
91
+ ```
92
+
93
+ ## Table of Contents
94
+ - [Quick Start](#quick-start)
95
+ - [1. Project Overview](#1-project-overview)
96
+ - [2. Installation](#2-installation)
97
+ - [2.1 System Requirements](#21-system-requirements)
98
+ - [2.2 Create Environment](#22-create-environment)
99
+ - [2.3 Runtime Assets](#23-runtime-assets)
100
+ - [2.4 Verify Installation](#24-verify-installation)
101
+ - [3. Usage](#3-usage)
102
+ - [3.1 Apply ProtCross (Inference with Existing Model)](#31-apply-protcross-inference-with-existing-model)
103
+ - [3.1.1 Single-structure Prediction](#311-single-structure-prediction)
104
+ - [3.1.2 Batch Prediction (Multiple Structures)](#312-batch-prediction-multiple-structures)
105
+ - [3.2 Reproduce ProtCross (Training Pipeline)](#32-reproduce-protcross-training-pipeline)
106
+ - [3.2.1 Data Preparation](#321-data-preparation)
107
+ - [3.2.2 Preprocess Source (PDB) with PCA Fit](#322-preprocess-source-pdb-with-pca-fit)
108
+ - [3.2.3 Preprocess Target (AF2) with Shared PCA](#323-preprocess-target-af2-with-shared-pca)
109
+ - [3.2.4 Map Labels from PDB to AF2](#324-map-labels-from-pdb-to-af2)
110
+ - [3.2.5 Train](#325-train)
111
+ - [3.2.6 Evaluate / Test](#326-evaluate--test)
112
+ - [3.2.7 Run Multi-seed Benchmark](#327-run-multi-seed-benchmark)
113
+ - [4. Configuration Guide (Hydra)](#4-configuration-guide-hydra)
114
+ - [5. Repository Layout](#5-repository-layout)
115
+ - [6. Troubleshooting](#6-troubleshooting)
116
+ - [7. Changelog](#7-changelog)
117
+ - [8. License](#8-license)
118
+
119
+ ---
120
+
121
+ ## 1. Project Overview
122
+
123
+ ### Core capabilities
124
+ - **Binding-site segmentation on protein point clouds** with PointNet++.
125
+ - **Domain adaptation (DANN-style)** via gradient reversal and domain discriminator.
126
+ - **AF2 confidence-aware weighting** based on pLDDT.
127
+ - **ESM-C embeddings + PCA reduction** for residue features.
128
+ - **Hydra-driven experiment control** with easy command-line overrides.
129
+
130
+ ### Primary stack
131
+ - PyTorch + PyTorch Lightning
132
+ - Torch Geometric
133
+ - Hydra
134
+ - ESM (EvolutionaryScale)
135
+
136
+ ---
137
+
138
+ ## 2. Installation
139
+
140
+ ### 2.1 System Requirements
141
+
142
+ - Linux (recommended) or WSL2
143
+ - Python 3.10
144
+ - Conda (Miniconda or Anaconda)
145
+ - NVIDIA GPU + CUDA 12.1 (recommended for training and ESM-C preprocessing)
146
+
147
+ > CPU-only runs are possible for debugging/small tests but will be significantly slower.
148
+
149
+ ### 2.2 Create Environment
150
+
151
+ For development or full paper reproduction:
152
+
153
+ ```bash
154
+ conda env create -f environment.yml
155
+ conda activate evopoint_da
156
+ pip install -e ".[test,esm]"
157
+ ```
158
+
159
+ For the lightweight prediction interface from PyPI:
160
+
161
+ ```bash
162
+ pip install "protcross[predict]"
163
+ protcross setup-assets
164
+ ```
165
+
166
+ The provided environment includes:
167
+ - `pytorch==2.3.0`
168
+ - `pytorch-cuda==12.1`
169
+ - Torch Geometric and companion packages
170
+ - `esm>=3.1.0` for ESM-C APIs
171
+
172
+ #### CPU-only notes
173
+ If you do not have a CUDA-capable GPU:
174
+ 1. Remove/replace `pytorch-cuda=12.1` in `environment.yml`.
175
+ 2. Install CPU-compatible PyTorch/Torch Geometric wheels.
176
+ 3. Run preprocessing/training with `--device cpu` or CPU trainer settings.
177
+
178
+ ### 2.3 Runtime Assets
179
+
180
+ ProtCross separates code and large runtime assets. PyPI distributions include the Python package and command-line tools, while the pretrained checkpoint, PCA reducer, and ESM-C weights are downloaded after installation.
181
+
182
+ Recommended setup:
183
+
184
+ ```bash
185
+ protcross setup-assets
186
+ ```
187
+
188
+ By default this downloads:
189
+ - ESM-C 600M weights from https://huggingface.co/EvolutionaryScale/esmc-600m-2024-12
190
+ - `best-epoch.59.ckpt` from the ProtCross `v0.1.1` GitHub release, saved locally as `best-epoch=59.ckpt`
191
+ - `pca_esmc_128.pkl` from the ProtCross `v0.1.1` GitHub release
192
+
193
+ The default install location is `~/.cache/protcross/assets/v0.1.1`. You can override it with `PROTCROSS_ASSETS_DIR` or `--output-dir`:
194
+
195
+ ```bash
196
+ PROTCROSS_ASSETS_DIR=/data/protcross-assets protcross setup-assets
197
+ protcross setup-assets --output-dir /data/protcross-assets
198
+ ```
199
+
200
+ After setup, prediction can discover assets automatically:
201
+
202
+ ```bash
203
+ protcross predict input.pdb --output input.protcross.pdb
204
+ ```
205
+
206
+ For source checkouts or custom releases, explicit paths are still supported:
207
+
208
+ ```bash
209
+ protcross predict input.pdb \
210
+ --checkpoint checkpoint/best-epoch=59.ckpt \
211
+ --esm-weights /absolute/path/to/esmc_600m_2024_12_v0.pth \
212
+ --pca data/pca_esmc_128.pkl \
213
+ --output input.protcross.pdb
214
+ ```
215
+
216
+ #### What is ESM-C?
217
+ **ESM-C** is EvolutionaryScale's protein language model family for extracting residue-level sequence representations. In ProtCross, ESM-C embeddings are used as per-residue features.
218
+
219
+ Recommended checkpoint for this project:
220
+ - **ESM-C 600M (2024-12)**: https://huggingface.co/EvolutionaryScale/esmc-600m-2024-12
221
+
222
+ The ESM-C model repository uses a custom non-commercial license. Review the model terms before downloading or redistributing derived assets.
223
+
224
+ #### Manual ESM-C download fallback
225
+
226
+ If the automatic downloader is unavailable in your environment, you can download the model weights from Hugging Face in either of the following ways.
227
+
228
+ **Option A - Git LFS clone**
229
+ ```bash
230
+ # 1) Install Git LFS once (if needed)
231
+ git lfs install
232
+
233
+ # 2) Clone the model repository
234
+ git clone https://huggingface.co/EvolutionaryScale/esmc-600m-2024-12
235
+ ```
236
+
237
+ **Option B - Hugging Face CLI**
238
+ ```bash
239
+ # 1) Install CLI
240
+ pip install -U "huggingface_hub[cli]"
241
+
242
+ # 2) Download repository files to a local directory
243
+ huggingface-cli download EvolutionaryScale/esmc-600m-2024-12 \
244
+ --local-dir ./esmc-600m-2024-12
245
+ ```
246
+
247
+ After downloading, locate `data/weights/esmc_600m_2024_12_v0.pth` and pass its absolute path to `--model_name` / `--esm_weights`.
248
+
249
+ Example:
250
+ ```bash
251
+ python scripts/preprocess_esm.py \
252
+ --data_dir data/raw_pdb \
253
+ --output_dir data/processed_pdb \
254
+ --fit_pca \
255
+ --model_name /absolute/path/to/esmc_600m_2024_12_v0.pth \
256
+ --pca_model_path pca_esmc_128.pkl
257
+ ```
258
+
259
+ Important details:
260
+ - `--model_name` is treated as a local file path in current code.
261
+ - The script truncates sequences to length 1022 for ESM-C context compatibility.
262
+
263
+ ### 2.4 Verify Installation
264
+
265
+ ```bash
266
+ python -c "import torch; import torch_geometric; import pytorch_lightning; import hydra; import esm; print('OK')"
267
+ pytest -q
268
+ ```
269
+
270
+ ---
271
+
272
+ ## 3. Usage
273
+
274
+ This section is split into two workflows:
275
+ - **Apply ProtCross**: use the released checkpoint for inference.
276
+ - **Reproduce ProtCross**: rebuild datasets/features and retrain/evaluate the model.
277
+
278
+ ### 3.1 Apply ProtCross (Inference with Existing Model)
279
+
280
+ ### 3.1.1 Single-structure Prediction
281
+
282
+ You can directly run inference on one PDB structure and write per-residue probabilities to the B-factor column of a new PDB file.
283
+
284
+ The recommended 0.1.1 path for PyPI users is:
285
+
286
+ ```bash
287
+ protcross setup-assets
288
+ protcross predict examples/6fhu.pdb --output examples/6fhu.pred.pdb
289
+ ```
290
+
291
+ Add a score table or a custom threshold when needed:
292
+
293
+ ```bash
294
+ protcross predict examples/6fhu.pdb \
295
+ --output examples/6fhu.pred.pdb \
296
+ --scores-tsv examples/6fhu.scores.tsv \
297
+ --threshold 0.5
298
+ ```
299
+
300
+ You can also keep model assets in an explicit directory:
301
+
302
+ ```bash
303
+ protcross predict examples/6fhu.pdb \
304
+ --assets-dir /path/to/protcross-assets \
305
+ --output examples/6fhu.pred.pdb
306
+ ```
307
+
308
+ The asset directory should contain `best-epoch=59.ckpt`, `esmc_600m_2024_12_v0.pth`, and `pca_esmc_128.pkl`. Alternatively, set `PROTCROSS_CHECKPOINT`, `PROTCROSS_ESM_WEIGHTS`, and `PROTCROSS_PCA`.
309
+
310
+ The standalone entry point is equivalent:
311
+
312
+ ```bash
313
+ protcross-predict examples/6fhu.pdb --output examples/6fhu.pred.pdb
314
+ ```
315
+
316
+ The legacy 0.1.0 command is still supported:
317
+
318
+ ```bash
319
+ python run_Predict_ProtCross.py \
320
+ --pdb_file examples/6fhu.pdb \
321
+ --ckpt_path checkpoint/best-epoch=59.ckpt \
322
+ --esm_weights /absolute/path/to/esmc_600m_2024_12_v0.pth \
323
+ --pca_path data/pca_esmc_128.pkl \
324
+ --output_pdb examples/6fhu.pred.pdb
325
+ ```
326
+
327
+ Python API:
328
+
329
+ ```python
330
+ from evopoint_da.inference import ProtCrossPredictor, predict_pdb
331
+
332
+ result = predict_pdb("examples/6fhu.pdb", output_pdb="examples/6fhu.pred.pdb")
333
+ print(result.format_summary())
334
+
335
+ predictor = ProtCrossPredictor.from_default_assets()
336
+ result = predictor.predict("examples/6fhu.pdb", output_pdb="examples/6fhu.pred.pdb")
337
+
338
+ result = predict_pdb(
339
+ "examples/6fhu.pdb",
340
+ ckpt_path="checkpoint/best-epoch=59.ckpt",
341
+ esm_weights="/absolute/path/to/esmc_600m_2024_12_v0.pth",
342
+ pca_path="data/pca_esmc_128.pkl",
343
+ output_pdb="examples/6fhu.pred.pdb",
344
+ )
345
+ print(result.format_summary())
346
+ ```
347
+
348
+ ### 3.1.2 Batch Prediction (Multiple Structures)
349
+
350
+ `protcross-predict` predicts one structure each run. For batch inference, iterate over PDB files in a shell loop:
351
+
352
+ ```bash
353
+ protcross setup-assets
354
+ mkdir -p batch_outputs
355
+ for pdb in /path/to/pdb_dir/*.pdb; do
356
+ base="$(basename "${pdb}" .pdb)"
357
+ protcross-predict "${pdb}" \
358
+ --output "batch_outputs/${base}_pred.pdb" \
359
+ --threshold 0.5
360
+ done
361
+ ```
362
+
363
+ ### 3.2 Reproduce ProtCross (Training Pipeline)
364
+
365
+ ### 3.2.1 Data Preparation
366
+
367
+ Expected layout:
368
+
369
+ ```text
370
+ data/
371
+ |--- raw_pdb/ # input PDB/CIF structures (source)
372
+ |--- raw_af2/ # input AF2 PDB structures (target)
373
+ |--- processed_pdb/ # generated .pt files for source
374
+ `--- processed_af2/ # generated .pt files for target
375
+ ```
376
+
377
+ Optional AF2 retrieval helper:
378
+
379
+ ```bash
380
+ protcross-download-af2 \
381
+ --raw-pdb-dir data/raw_pdb \
382
+ --output-dir data/raw_af2 \
383
+ --mapping-file pdb_uniprot_mapping.json
384
+ ```
385
+
386
+ ### 3.2.2 Preprocess Source (PDB) with PCA Fit
387
+
388
+ ```bash
389
+ protcross-preprocess \
390
+ --data_dir data/raw_pdb \
391
+ --output_dir data/processed_pdb \
392
+ --fit_pca \
393
+ --model_name ~/.cache/protcross/assets/v0.1.1/esmc_600m_2024_12_v0.pth \
394
+ --pca_model_path pca_esmc_128.pkl \
395
+ --pca_dim 128
396
+ ```
397
+
398
+ ### 3.2.3 Preprocess Target (AF2) with Shared PCA
399
+
400
+ ```bash
401
+ protcross-preprocess \
402
+ --data_dir data/raw_af2 \
403
+ --output_dir data/processed_af2 \
404
+ --model_name ~/.cache/protcross/assets/v0.1.1/esmc_600m_2024_12_v0.pth \
405
+ --pca_model_path pca_esmc_128.pkl \
406
+ --is_af2
407
+ ```
408
+
409
+ ### 3.2.4 Map Labels from PDB to AF2
410
+
411
+ ```bash
412
+ protcross-map-labels \
413
+ --processed-pdb-dir data/processed_pdb \
414
+ --processed-af2-dir data/processed_af2 \
415
+ --raw-pdb-dir data/raw_pdb \
416
+ --raw-af2-dir data/raw_af2 \
417
+ --mapping-file pdb_uniprot_mapping.json
418
+ ```
419
+
420
+ ### 3.2.5 Train
421
+
422
+ Default training:
423
+
424
+ ```bash
425
+ python train.py
426
+ ```
427
+
428
+ Equivalent installed CLI:
429
+
430
+ ```bash
431
+ protcross-train
432
+ ```
433
+
434
+ Common Hydra overrides:
435
+
436
+ ```bash
437
+ # Disable domain adaptation
438
+ python train.py model.use_da=False
439
+
440
+ # Disable ESM features
441
+ python train.py model.use_esm=False
442
+
443
+ # Short debugging run
444
+ python train.py trainer.max_epochs=5
445
+
446
+ # Custom data directories
447
+ python train.py \
448
+ data.data_dir_pdb=/abs/path/to/processed_pdb \
449
+ data.data_dir_af2=/abs/path/to/processed_af2
450
+ ```
451
+
452
+ ### 3.2.6 Evaluate / Test
453
+
454
+ ```bash
455
+ python test_adaptive.py ckpt_path=checkpoint/best-epoch=59.ckpt
456
+ ```
457
+
458
+ Additional analysis scripts are available (e.g., `scripts/eval_run.py`) for task-specific reporting.
459
+
460
+ ### 3.2.7 Run Multi-seed Benchmark
461
+
462
+ ```bash
463
+ python run_multiseed_benchmark.py
464
+ ```
465
+
466
+ ---
467
+
468
+ ## 4. Configuration Guide (Hydra)
469
+
470
+ Main configuration files:
471
+ - `configs/train.yaml`: global defaults and run-level settings.
472
+ - `configs/data/protein_seg.yaml`: data module paths and loading parameters.
473
+ - `configs/model/da_module.yaml`: architecture and adaptation hyperparameters.
474
+ - `configs/trainer/default.yaml`: PyTorch Lightning trainer options.
475
+
476
+ Hydra override syntax:
477
+
478
+ ```bash
479
+ python train.py key1=value1 key2=value2
480
+ ```
481
+
482
+ Tip: keep all experiment commands in shell scripts to ensure reproducibility.
483
+
484
+ ---
485
+
486
+ ## 5. Repository Layout
487
+
488
+ ```text
489
+ ProtCross/
490
+ |--- configs/
491
+ | |--- data/protein_seg.yaml
492
+ | |--- model/da_module.yaml
493
+ | |--- trainer/default.yaml
494
+ | `--- train.yaml
495
+ |--- data/
496
+ | |--- raw_pdb/
497
+ | |--- raw_af2/
498
+ | |--- processed_pdb/
499
+ | `--- processed_af2/
500
+ |--- scripts/
501
+ | |--- preprocess_esm.py # compatibility wrapper
502
+ | |--- get_af2.py # compatibility wrapper
503
+ | |--- map_labels.py # compatibility wrapper
504
+ | `--- ... # one-off analysis and plotting utilities
505
+ |--- src/evopoint_da/
506
+ | |--- cli/ # installed command entry points
507
+ | |--- data/
508
+ | |--- experiments/ # reproduction benchmark workflows
509
+ | |--- evaluation/
510
+ | |--- inference/ # lightweight predictor API
511
+ | `--- models/
512
+ |--- train.py
513
+ |--- test_adaptive.py
514
+ |--- run_multiseed_benchmark.py
515
+ |--- run_Predict_ProtCross.py
516
+ `--- environment.yml
517
+ ```
518
+
519
+ ---
520
+
521
+ ## 6. Troubleshooting
522
+
523
+ - **`FileNotFoundError` for ESM-C weights**
524
+ - Run `protcross setup-assets`, or ensure `--esm-weights` / `--model_name` points to an existing local `.pth` checkpoint file.
525
+ - **`protcross setup-assets` cannot find GitHub release assets**
526
+ - Attach `best-epoch.59.ckpt` and `pca_esmc_128.pkl` to the `v0.1.1` GitHub release, or pass `--checkpoint-url` and `--pca-url`.
527
+ - **Torch Geometric install issues**
528
+ - Verify that your torch version and wheel index URL match the environment (torch 2.3.0 + cu121).
529
+ - **OOM during preprocessing/training**
530
+ - Reduce batch size, use shorter runs, or switch to a smaller subset first.
531
+
532
+ ---
533
+
534
+ ## 7. Changelog
535
+
536
+ ### 0.1.1
537
+
538
+ Engineering-focused reproducibility release.
539
+
540
+ - Adds installable package metadata and console commands: `protcross-predict`, `protcross-preprocess`, and `protcross-train`.
541
+ - Adds a unified `protcross` CLI plus `protcross-setup-assets`, `protcross-download-af2`, and `protcross-map-labels`.
542
+ - Adds one-command runtime asset setup for the ESM-C weights, released checkpoint, and PCA reducer.
543
+ - Splits prediction into a lightweight API (`evopoint_da.inference`) that accepts one PDB/mmCIF and writes binding probabilities to the B-factor column.
544
+ - Keeps 0.1.0 entry points (`run_Predict_ProtCross.py`, `train.py`, `scripts/preprocess_esm.py`, `scripts/get_af2.py`, `scripts/map_labels.py`) as compatibility wrappers.
545
+ - Splits shared structure parsing, ESM-C feature extraction, PCA reduction, AF2 downloads, label mapping, metrics, experiments, and domain weighting into reusable modules.
546
+ - Fixes the standard training DataModule so target-domain AF2 batches can be supplied to domain adaptation without requiring positive labels.
547
+ - Adds pytest smoke/unit tests, including checkpoint CPU forward on a published processed sample.
548
+
549
+ ### 0.1.0
550
+
551
+ Initial public release of ProtCross.
552
+
553
+ - Provides the core ProtCross framework for domain-adaptive binding-site prediction across PDB and AlphaFold2 protein structures.
554
+ - Includes PointNet++-based protein point-cloud segmentation, ESM-C residue embeddings, PCA feature reduction, pLDDT-aware target weighting, and DANN-style domain adaptation.
555
+ - Documents the full training and evaluation workflow, including preprocessing, label mapping, Hydra configuration, testing, and multi-seed benchmarking.
556
+
557
+ ---
558
+
559
+ ## 8. License
560
+
561
+ This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.