Getting Started

Quick start

Run your first end-to-end docking job in under five minutes.

Prerequisites#

  • Python 3.10 or newer
  • An MolHub account and an API key
  • ~50 MB free disk space (for the SDK + dependencies)

1. Install the SDK#

Install pymolhub from PyPI:

bash
pip install pymolhub

2. Set your API key#

Generate a key from API Keys and store it as an environment variable so it never lives in source control.

bash
export MOLHUB_API_KEY="mh_live_********************"
Treat API keys like passwords. Anyone with a Live key can submit jobs that count against your quota.

3. Submit a docking job#

Drop a SMILES string, point at a PDB ID, and submit. The pipeline runs ligand prep, AutoDock Vina, and SDF reassembly automatically.

dock_egfr.py
from pymolhub import MolHub
import os

mh = MolHub(api_key=os.environ["MOLHUB_API_KEY"])

mol = mh.molecules.create(
    smiles="COc1cc2ncnc(Nc3ccc(F)c(Cl)c3)c2cc1OCCCN1CCOCC1",  # Gefitinib
    generate_3d=True,
)

job = mh.docking.submit(
    receptor="1M17",       # EGFR kinase domain
    ligands=[mol.id],
    pocket="auto",
    exhaustiveness=8,
)
print("Job queued:", job.id)
job.wait(timeout=600)

4. Inspect the results#

The result includes the best affinity, an RMSD bracket, and the reassembled SDF pose — usable directly by RDKit or PyMOL.

python
results = job.results()
top = results[0]

print(f"Affinity: {top.affinity_kcal_mol} kcal/mol")
print(f"RMSD: {top.rmsd_lb} – {top.rmsd_ub} Å")

with open("pose.sdf", "w") as f:
    f.write(top.pose_sdf)
You just ran a complete MolHub pipeline. Check the full walkthrough for batch screening and Vina parameter tuning.