File size: 4,165 Bytes
504d922
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import csv
from pathlib import Path


MANUAL_CANDIDATES = [
    {
        "pdb_id": "1IEP",
        "receptor_chain": "A",
        "ligand_resname": "STI",
        "ligand_chain": "A",
        "ligand_id": "STI",
        "ligand_smiles": "CC1=NC(NC2=CC(=C(C=C2)Cl)NC3=NC=CC(=N3)C4=CN=CC=C4)=CC(=N1)N",
        "pubchem_cid": "5291",
        "ligand_heavy_atoms": 41,
        "ligand_mw": 493.6,
        "estimated_pubchem_hits_0.99_0.30": 650000,
        "notes": "Heuristic large-chemotype kinase inhibitor candidate; requires server-side validation of crawl volume.",
        "recommended": True,
    },
    {
        "pdb_id": "3PTB",
        "receptor_chain": "A",
        "ligand_resname": "BEN",
        "ligand_chain": "A",
        "ligand_id": "BEN",
        "ligand_smiles": "c1(ccccc1)C(=N)N",
        "pubchem_cid": "2332",
        "ligand_heavy_atoms": 9,
        "ligand_mw": 120.15,
        "estimated_pubchem_hits_0.99_0.30": 550000,
        "notes": "Empirically validated PubChem crawl to 50k on local machine; ligand is small so pocket chemistry is broad but benchmark realism is weaker.",
        "recommended": True,
    },
    {
        "pdb_id": "4WKQ",
        "receptor_chain": "A",
        "ligand_resname": "IRE",
        "ligand_chain": "A",
        "ligand_id": "IRE",
        "ligand_smiles": "",
        "pubchem_cid": "",
        "ligand_heavy_atoms": 28,
        "ligand_mw": 430.0,
        "estimated_pubchem_hits_0.99_0.30": 7000,
        "notes": "Observed narrow chemotype in current pipeline; not suitable for very large similarity benchmark.",
        "recommended": False,
    },
    {
        "pdb_id": "4HG7",
        "receptor_chain": "A",
        "ligand_resname": "NUT",
        "ligand_chain": "A",
        "ligand_id": "NUT",
        "ligand_smiles": "",
        "pubchem_cid": "",
        "ligand_heavy_atoms": 33,
        "ligand_mw": 500.0,
        "estimated_pubchem_hits_0.99_0.30": 0,
        "notes": "Current PubChem similarity path was unstable for this ligand in prior tests.",
        "recommended": False,
    },
]


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(description="Write a TSV of candidate PDB ligand complexes for large PubChem similarity crawls.")
    parser.add_argument("--out", required=True)
    parser.add_argument("--max-candidates", type=int, default=50)
    parser.add_argument("--min-heavy-atoms", type=int, default=15)
    parser.add_argument("--max-heavy-atoms", type=int, default=60)
    parser.add_argument("--min-estimated-hits", type=int, default=500000)
    return parser


def main() -> int:
    args = build_parser().parse_args()
    out = Path(args.out)
    out.parent.mkdir(parents=True, exist_ok=True)
    rows = []
    for row in MANUAL_CANDIDATES:
        item = dict(row)
        heavy = int(item["ligand_heavy_atoms"])
        hits = int(item["estimated_pubchem_hits_0.99_0.30"])
        if heavy < int(args.min_heavy_atoms) or heavy > int(args.max_heavy_atoms):
            item["recommended"] = False
            item["notes"] += " Filtered by heavy atom window."
        if hits < int(args.min_estimated_hits):
            item["recommended"] = False
            item["notes"] += " Estimated hit count below requested large-run threshold."
        rows.append(item)
    rows = rows[: max(1, int(args.max_candidates))]
    with out.open("w", encoding="utf-8", newline="") as handle:
        writer = csv.DictWriter(
            handle,
            fieldnames=[
                "pdb_id",
                "receptor_chain",
                "ligand_resname",
                "ligand_chain",
                "ligand_id",
                "ligand_smiles",
                "pubchem_cid",
                "ligand_heavy_atoms",
                "ligand_mw",
                "estimated_pubchem_hits_0.99_0.30",
                "notes",
                "recommended",
            ],
            delimiter="\t",
        )
        writer.writeheader()
        writer.writerows(rows)
    print(out)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())