Download scripts/find_pdb_ligand_candidates.py from QPromaQ/Docking_project: direct link, hf CLI and curl.
- Browser
- Download file 4.17 kB
-
https://huggingface.co/datasets/QPromaQ/Docking_project/resolve/main/scripts/find_pdb_ligand_candidates.py
- Command line
-
hf download hf://datasets/QPromaQ/Docking_project/scripts/find_pdb_ligand_candidates.py
-
curl -L -o find_pdb_ligand_candidates.py https://huggingface.co/datasets/QPromaQ/Docking_project/resolve/main/scripts/find_pdb_ligand_candidates.py
4.17 kB
| #!/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()) | |