QPromaQ commited on
Commit
9b46ce1
·
verified ·
1 Parent(s): 504d922

Delete README_SERVER.md

Browse files
Files changed (1) hide show
  1. README_SERVER.md +0 -505
README_SERVER.md DELETED
@@ -1,505 +0,0 @@
1
- # Portable rDock Pipeline
2
-
3
- ## List known-good PDB complexes
4
- ```bash
5
- python scripts/prepare_pdb_ligand_dataset.py --list-known-good
6
- ```
7
-
8
- ## Environment and rDock installation
9
- The portable bundle no longer ships `rdock/` binaries.
10
- The runtime is rDock-only. Removed secondary and legacy backends are not part of this portable pack.
11
-
12
- `setup_server.sh` creates or updates the conda environment with:
13
- - `conda-forge` + `bioconda`
14
- - `--strict-channel-priority`
15
- - platform-independent Python/runtime packages:
16
- - `python=3.11`
17
- - `numpy pandas scipy scikit-learn matplotlib pyyaml tqdm joblib biopython pytest requests`
18
- - `rdkit`
19
- - `openbabel`
20
- - `plip`
21
-
22
- PLIP is part of the portable environment. rDock still produces the poses and native
23
- SCORE terms; PLIP is used after docking to count biological interaction classes
24
- such as hydrophobic contacts, hydrogen bonds, salt bridges, pi-stacking and related
25
- contacts. If PLIP fails for a specific pose, the row records the failure and falls
26
- back to the rDock energy/pose interaction proxy instead of silently dropping the
27
- ligand.
28
-
29
- For rDock itself, the setup script first tries the conda/bioconda `rdock=24.04.204_legacy`
30
- package. That package is available on common Linux server platforms but may not exist for
31
- every local development platform, including some Apple Silicon setups. If conda cannot
32
- install rDock, the script falls back to an existing `rbdock`/`rbcavity` installation on
33
- `PATH` and validates the detected `RBT_ROOT`.
34
-
35
- On Apple Silicon, a typical local setup is:
36
-
37
- ```bash
38
- brew install rdock
39
- ```
40
-
41
- On Linux x86_64 servers, use `setup_server.sh`; it will install the conda package when
42
- available through the configured channels.
43
-
44
- Setup exports:
45
- - `RDOCK_ROOT=$CONDA_PREFIX`
46
- - `RBT_ROOT=$CONDA_PREFIX/share/rdock` or `$CONDA_PREFIX/share` when that layout is used by the installed package
47
- - `RBT_HOME=$RBT_ROOT`
48
- - `PATH=$CONDA_PREFIX/bin:$PATH`
49
- - `LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH`
50
-
51
- `check_environment.sh` hard-fails if any required dependency is missing, including:
52
- - `rdkit`
53
- - `rdkit.Chem`
54
- - `rdkit.Chem.AllChem`
55
- - `rdkit.Chem.Descriptors`
56
- - `rdkit.Chem.rdMolDescriptors`
57
- - `plip`
58
- - `plip.structure.preparation`
59
- - `obabel`
60
- - `rbdock`
61
- - `rbcavity`
62
- - `RBT_ROOT`
63
- - `dock.prm`
64
-
65
- so the pipeline code does not need to be patched on the server.
66
-
67
- ## Setup on server
68
- ```bash
69
- bash setup_server.sh portable-rdock-pipeline
70
- conda activate portable-rdock-pipeline
71
- bash check_environment.sh
72
- ```
73
-
74
- ## Inspect hetero ligands for a PDB
75
- ```bash
76
- python scripts/prepare_pdb_ligand_dataset.py \
77
- --list-hetero \
78
- --pdb-id 1A52
79
- ```
80
-
81
- For `1A52`, the parser should confirm that the correct reference ligand is `EST`, not `MK1`. `AU` is treated as an ion/metal and ignored as a docking reference ligand.
82
-
83
- ## Prepare a dataset for one PDB complex
84
- ```bash
85
- python scripts/prepare_pdb_ligand_dataset.py \
86
- --pdb-id 4HG7 \
87
- --receptor-chain A \
88
- --reference-ligand-resname NUT \
89
- --reference-ligand-chain A \
90
- --n-ligands 1000 \
91
- --ligand-source smiles_file \
92
- --smiles-file data/examples/example_smiles_1000.smi \
93
- --out /data/datasets/rdock_4hg7_1000 \
94
- --force
95
- ```
96
-
97
- ## Prepare a dataset by fetching real similar SMILES from PubChem
98
- ```bash
99
- python scripts/prepare_pdb_ligand_dataset.py \
100
- --pdb-id 4HG7 \
101
- --receptor-chain A \
102
- --reference-ligand-resname NUT \
103
- --reference-ligand-chain A \
104
- --n-ligands 1000 \
105
- --ligand-source pubchem_similarity \
106
- --identity-threshold-start 99 \
107
- --identity-threshold-stop 85 \
108
- --allow-partial-ligand-set \
109
- --out /data/datasets/rdock_4hg7_pubchem \
110
- --force
111
- ```
112
-
113
- This fetches real PubChem compounds via the official PUG REST `fastsimilarity_2d` endpoint. If PubChem returns fewer than the requested count within the threshold range, the script keeps the available ligands, writes them into the dataset, and records a warning in `dataset_manifest.json`, `qc/preparation_report.md`, and `logs/pubchem_diagnostics.json`.
114
-
115
- You can also request larger libraries, for example `25000`, when `--ligand-source pubchem_similarity` is set explicitly. In that case the script still keeps a partial real result set if PubChem does not return enough compounds within the threshold range.
116
-
117
- ## Auto-detect the reference ligand
118
- ```bash
119
- python scripts/prepare_pdb_ligand_dataset.py \
120
- --pdb-id 1A52 \
121
- --receptor-chain A \
122
- --auto-reference-ligand \
123
- --n-ligands 1000 \
124
- --ligand-source smiles_file \
125
- --smiles-file data/examples/example_smiles_1000.smi \
126
- --out /data/datasets/rdock_1a52_1000 \
127
- --force
128
- ```
129
-
130
- ## Validate an existing dataset directory
131
- ```bash
132
- python scripts/prepare_pdb_ligand_dataset.py \
133
- --validate-only \
134
- --out /data/datasets/rdock_4hg7_1000
135
- ```
136
-
137
- or
138
-
139
- ```bash
140
- python -m docking_pipeline validate-dataset \
141
- --dataset-dir /data/datasets/rdock_4hg7_1000
142
- ```
143
-
144
- ## Resume ligand 3D preparation from an interrupted dataset
145
- If `ligands/all_ligands.smi` already exists and the build stopped during OpenBabel 3D conversion, resume only the ligand preparation step:
146
-
147
- ```bash
148
- python scripts/prepare_pdb_ligand_dataset.py \
149
- --prepare-ligands-only \
150
- --out /data/datasets/rdock_4hg7_pubchem_50k \
151
- --ligand-batch-size 250 \
152
- --ligand-jobs auto \
153
- --ligand-cpu-fraction 0.85
154
- ```
155
-
156
- This mode:
157
- - uses the existing `ligands/all_ligands.smi`
158
- - writes batch outputs under `ligands/obabel_batches/`
159
- - updates `ligands/ligand_preparation_progress.json`
160
- - skips completed batches on rerun
161
- - if only a partial `ligands/all_ligands.sdf` exists and there are no batch files yet, it resumes from the prepared prefix and builds the missing suffix
162
-
163
- Check progress with:
164
-
165
- ```bash
166
- cat /data/datasets/rdock_4hg7_pubchem_50k/ligands/ligand_preparation_progress.json
167
- ```
168
-
169
- ## Prepare a real 1000-SMILES example file
170
- ```bash
171
- python scripts/download_example_smiles.py \
172
- --n 1000 \
173
- --out data/examples/example_smiles_1000.smi
174
- ```
175
-
176
- This file contains real compounds derived from the benchmark ligand library already present in this repository. It is not a synthetic or random SMILES set.
177
-
178
- ## Large libraries
179
- For large libraries such as `50000` ligands, use a real SMILES file:
180
-
181
- ```bash
182
- python scripts/prepare_pdb_ligand_dataset.py \
183
- --pdb-id 1A52 \
184
- --receptor-chain A \
185
- --auto-reference-ligand \
186
- --n-ligands 50000 \
187
- --ligand-source smiles_file \
188
- --smiles-file /data/libraries/real_50k_library.smi \
189
- --out /data/datasets/rdock_1a52_50k \
190
- --force
191
- ```
192
-
193
- `PubChem similarity` may fail to collect 1000 analogs for some reference ligands. When that happens, the generator writes `logs/pubchem_diagnostics.json` and you should switch to `--ligand-source smiles_file`.
194
-
195
- ## Run multi-fidelity docking
196
- ```bash
197
- python -m docking_pipeline benchmark-adaptive \
198
- --dataset-dir /data/datasets/rdock_1a52_50k \
199
- --strategy multifidelity_adaptive_rdock \
200
- --fidelity-levels 5,10,15,30,50 \
201
- --cost-budget-runs 250000 \
202
- --jobs auto \
203
- --cpu-fraction 0.85 \
204
- --out /data/results/rdock_1a52_50k_mf \
205
- --resume
206
- ```
207
-
208
- ## Production screening without a reference ligand
209
- ```bash
210
- python -m docking_pipeline screen-reference-free \
211
- --dataset-dir /data/datasets/my_prepared_pocket_dataset \
212
- --strategy reference_free_active_learning_v2 \
213
- --triage-model classifier \
214
- --triage-controller auto_recall \
215
- --triage-retain-fraction 0.02 \
216
- --triage-target-recall 0.98 \
217
- --classifier-top-percentile 0.05 \
218
- --classifier-threshold-mode recall_target \
219
- --model-fallback-if-worse union_with_cluster_only \
220
- --survivor-combination-policy union \
221
- --max-retain-fraction-before-not-useful 0.5 \
222
- --calibration-size 1000 \
223
- --fidelity-validation-size 200 \
224
- --fidelity-levels 5,10,15,30,50 \
225
- --jobs 64 \
226
- --chunk-size 50 \
227
- --cpu-fraction 0.85 \
228
- --out /data/results/my_screen \
229
- --resume
230
- ```
231
-
232
- This mode:
233
- - does not require `reference_ligand.sdf`
234
- - treats any reference ligand present in the dataset as optional benchmark-only metadata
235
- - fails early with `RDKit_REQUIRED_FOR_REFERENCE_FREE_MODEL` if RDKit is unavailable
236
- - writes triage artifacts:
237
- - `tables/initial_prefilter_decisions.csv`
238
- - `tables/triage_scores.csv`
239
- - `tables/triage_survivors.csv`
240
- - `tables/triage_rejected.csv`
241
- - `metrics/triage_metrics.json`
242
- - `metrics/fidelity_reliability.json`
243
-
244
- ## Compare strategies on one shared sampled reference
245
- ```bash
246
- python -m docking_pipeline benchmark-triage-strategies \
247
- --dataset-dir /data/datasets/test_1500 \
248
- --reference-mode sampled \
249
- --reference-sample-size 300 \
250
- --reference-sample-seed 42 \
251
- --strategies cluster_only_triage,cheap_descriptor_filter_only,diverse_random_cost_balanced,single_fidelity_cost_balanced,reference_free_triage_bandit_v1,reference_free_active_learning_v2 \
252
- --triage-target-recall 0.98 \
253
- --triage-retain-fraction 0.02 \
254
- --calibration-size 300 \
255
- --fidelity-validation-size 100 \
256
- --cost-budget-runs 3000 \
257
- --seeds 1,2,3 \
258
- --jobs 10 \
259
- --chunk-size 20 \
260
- --rdock-timeout-seconds 14400 \
261
- --out /data/results/test_1500_strategy_comparison \
262
- --resume
263
- ```
264
-
265
- ## Small benchmark with full reference and the new reference-free strategy
266
- ```bash
267
- python -m docking_pipeline benchmark-adaptive \
268
- --dataset-dir /data/datasets/test_1500 \
269
- --strategy reference_free_active_learning_v2 \
270
- --reference-mode full \
271
- --evaluation-pool-mode same_pool \
272
- --triage-model classifier \
273
- --triage-controller auto_recall \
274
- --triage-retain-fraction 0.05 \
275
- --triage-target-recall 0.98 \
276
- --calibration-size 300 \
277
- --fidelity-validation-size 100 \
278
- --balanced-baselines true \
279
- --jobs 16 \
280
- --chunk-size 25 \
281
- --out /data/results/test_1500_ref_free_strategy \
282
- --resume
283
- ```
284
-
285
- ## Large 50k sampled benchmark with the new reference-free strategy
286
- ```bash
287
- python -m docking_pipeline benchmark-adaptive \
288
- --dataset-dir /data/datasets/rdock_50k \
289
- --strategy reference_free_active_learning_v2 \
290
- --reference-mode sampled \
291
- --reference-sample-size 5000 \
292
- --reference-sample-seed 42 \
293
- --evaluation-pool-mode same_pool \
294
- --triage-model classifier \
295
- --triage-controller auto_recall \
296
- --triage-retain-fraction 0.02 \
297
- --triage-target-recall 0.98 \
298
- --calibration-size 1500 \
299
- --fidelity-validation-size 300 \
300
- --balanced-baselines true \
301
- --jobs 64 \
302
- --chunk-size 50 \
303
- --cpu-fraction 0.85 \
304
- --out /data/results/rdock_50k_ref_free_strategy \
305
- --resume
306
- ```
307
-
308
- ## Repeated triage safety benchmark
309
- ```bash
310
- python -m docking_pipeline benchmark-triage-repeated \
311
- --dataset-dir /data/datasets/test_1500 \
312
- --reference-mode full \
313
- --strategy reference_free_triage_bandit_v1 \
314
- --baselines cluster_only_triage,cheap_descriptor_filter_only,diverse_random_cost_balanced \
315
- --triage-model classifier \
316
- --classifier-top-percentile 0.05 \
317
- --classifier-threshold-mode recall_target \
318
- --triage-controller auto_recall \
319
- --model-fallback-if-worse union_with_cluster_only \
320
- --survivor-combination-policy union \
321
- --triage-target-recall 0.98 \
322
- --triage-retain-fraction 0.02 \
323
- --calibration-size 300 \
324
- --fidelity-validation-size 100 \
325
- --seeds 1,2,3 \
326
- --jobs 8 \
327
- --chunk-size 20 \
328
- --cpu-fraction 0.85 \
329
- --out /data/results/test_1500_triage_repeated \
330
- --force
331
- ```
332
-
333
- ## Results layout
334
- - `target/`, `ligands/`, `rdock/`, `poses/`, `tables/`, `metrics/`, `plots/`, `checkpoints/`
335
- - `report.md`, `manifest.json`, `config.yaml`, `commands.log`
336
-
337
- ## Candidate search for a 500k run
338
- ```bash
339
- python scripts/find_pdb_ligand_candidates.py \
340
- --out configs/benchmarks/pdb_ligand_candidates_500k.tsv \
341
- --max-candidates 50 \
342
- --min-heavy-atoms 15 \
343
- --max-heavy-atoms 60 \
344
- --min-estimated-hits 500000
345
- ```
346
-
347
- ## Prepare a 500k dataset
348
- ```bash
349
- export PDB_ID=<BEST_PDB>
350
- export RECEPTOR_CHAIN=<CHAIN>
351
- export REF_LIGAND=<RESNAME>
352
- export REF_CHAIN=<CHAIN>
353
- export DATASET_DIR=/data/datasets/rdock_${PDB_ID}_pubchem_500k
354
-
355
- python scripts/prepare_pdb_ligand_dataset.py \
356
- --pdb-id $PDB_ID \
357
- --receptor-chain $RECEPTOR_CHAIN \
358
- --reference-ligand-resname $REF_LIGAND \
359
- --reference-ligand-chain $REF_CHAIN \
360
- --n-ligands 500000 \
361
- --ligand-source pubchem_similarity \
362
- --pubchem-threshold-ladder 99,95,90,85,80,75,70,65,60,55,50,45,40,35,30 \
363
- --allow-partial-ligand-set \
364
- --ligand-batch-size 100 \
365
- --ligand-jobs 60 \
366
- --ligand-cpu-fraction 0.85 \
367
- --out $DATASET_DIR \
368
- --force
369
- ```
370
-
371
- ## Validate the prepared dataset
372
- ```bash
373
- python -m docking_pipeline validate-dataset \
374
- --dataset-dir $DATASET_DIR
375
- ```
376
-
377
- ## Smoke ablation benchmark
378
- ```bash
379
- export SMOKE_OUT=/data/results/${PDB_ID}_500k_smoke_ablation
380
-
381
- python -m docking_pipeline benchmark-regressor-ablation \
382
- --dataset-dir $DATASET_DIR \
383
- --reference-mode sampled \
384
- --reference-sample-size 1000 \
385
- --reference-sample-seed 42 \
386
- --fidelity-levels 5,10,15,30,50 \
387
- --cost-budget-runs 3000 \
388
- --calibration-size 500 \
389
- --fidelity-validation-size 150 \
390
- --seeds 1 \
391
- --jobs 32 \
392
- --chunk-size 50 \
393
- --cpu-fraction 0.85 \
394
- --out $SMOKE_OUT \
395
- --resume
396
- ```
397
-
398
- ## Full regressor ablation benchmark
399
- ```bash
400
- export ABLATION_OUT=/data/results/${PDB_ID}_500k_regressor_ablation
401
-
402
- python -m docking_pipeline benchmark-regressor-ablation \
403
- --dataset-dir $DATASET_DIR \
404
- --reference-mode sampled \
405
- --reference-sample-size 5000 \
406
- --reference-sample-seed 42 \
407
- --fidelity-levels 5,10,15,30,50 \
408
- --cost-budget-runs 200000 \
409
- --calibration-size 5000 \
410
- --fidelity-validation-size 1000 \
411
- --seeds 1,2,3 \
412
- --jobs 64 \
413
- --chunk-size 100 \
414
- --cpu-fraction 0.85 \
415
- --rdock-timeout-seconds 14400 \
416
- --out $ABLATION_OUT \
417
- --resume
418
- ```
419
-
420
- ## Full strategy benchmark
421
- ```bash
422
- export STRATEGY_OUT=/data/results/${PDB_ID}_500k_strategy_benchmark
423
-
424
- python -m docking_pipeline benchmark-triage-strategies \
425
- --dataset-dir $DATASET_DIR \
426
- --reference-mode sampled \
427
- --reference-sample-size 5000 \
428
- --reference-sample-seed 42 \
429
- --strategies cluster_only_triage,cheap_descriptor_filter_only,random_cost_balanced,diverse_random_cost_balanced,single_fidelity_cost_balanced,reference_free_active_learning_v2 \
430
- --adaptive-policies cluster_bandit \
431
- --triage-target-recall 0.98 \
432
- --triage-retain-fraction 0.02 \
433
- --calibration-size 5000 \
434
- --fidelity-validation-size 1000 \
435
- --cost-budget-runs 200000 \
436
- --fidelity-levels 5,10,15,30,50 \
437
- --seeds 1,2,3 \
438
- --jobs 64 \
439
- --chunk-size 100 \
440
- --cpu-fraction 0.85 \
441
- --rdock-timeout-seconds 14400 \
442
- --out $STRATEGY_OUT \
443
- --resume
444
- ```
445
-
446
- ## Comparable adaptive benchmark
447
- Use this when you need a frozen evaluation universe and cost-comparable reporting.
448
- ```bash
449
- export COMPARABLE_OUT=/data/results/${PDB_ID}_500k_comparable_benchmark
450
-
451
- python -m docking_pipeline benchmark-comparable-adaptive \
452
- --dataset-dir $DATASET_DIR \
453
- --evaluation-universe-size 25000 \
454
- --evaluation-universe-seed 42 \
455
- --reference-mode full \
456
- --strategies adaptive_classifier_regressor,classifier_only,diverse_random_cost_balanced,cluster_only,single_fidelity_cost_balanced \
457
- --cost-budget-runs 100000 \
458
- --fidelity-levels 5,10,15,30,50 \
459
- --promotion-policy quota_ladder \
460
- --min-final-ligands 200 \
461
- --model-validation-split cluster \
462
- --jobs 120 \
463
- --chunk-size 10 \
464
- --cpu-fraction 0.85 \
465
- --rdock-timeout-seconds 1800 \
466
- --out $COMPARABLE_OUT \
467
- --resume
468
- ```
469
-
470
- Prosty wrapper shell:
471
- ```bash
472
- export DATASET_DIR=$SCRATCH/plgproma/data/rdock_${PDB_ID}_pubchem_500k
473
- export STRATEGY_OUT=$SCRATCH/plgproma/results/${PDB_ID}_500k_strategy_benchmark
474
- export JOBS=120
475
- export CHUNK_SIZE=30
476
- export CALIBRATION_SIZE=50000
477
- export FIDELITY_VALIDATION_SIZE=50
478
- export COST_BUDGET_RUNS=100000
479
- export REFERENCE_SAMPLE_SIZE=500
480
- export RDOCK_TIMEOUT_SECONDS=4000
481
-
482
- bash scripts/run_strategy_benchmark_server.sh
483
- ```
484
-
485
- ## Audits
486
- ```bash
487
- python -m docking_pipeline audit-strategy-benchmark \
488
- --run-dir $STRATEGY_OUT
489
-
490
- python -m docking_pipeline audit-regressor-ablation \
491
- --run-dir $ABLATION_OUT
492
- ```
493
-
494
- ## Resume
495
- - Re-run the same `benchmark-adaptive` command with `--resume`.
496
- - Checkpoints are written under `checkpoints/`.
497
-
498
- ## Output interpretation
499
- - `full_docking_scores.csv`: exhaustive final-fidelity docking reference.
500
- - `random_baseline_scores.csv`: random baseline at matched cost budget.
501
- - `single_fidelity_adaptive_scores.csv`: direct final-fidelity model-priority comparator.
502
- - `multifidelity_trace.csv`: per-ligand trace across fidelity levels.
503
- - `promotion_decisions.csv`: promotion and rejection reasons.
504
- - `final_hits.csv`: hit table after multi-fidelity promotion logic.
505
- - `adaptive_benchmark_metrics.json`: aggregate benchmark metrics and cost accounting.