from dotenv import load_dotenv
load_dotenv()
True
%load_ext autoreload
%autoreload 2
Docking a single ligand¶
This notebook shows you how to dock a single ligand to a protein.
Setup¶
First, we'll import the necessary Deep Origin drug discovery modules.
from deeporigin.drug_discovery import (
BRD_DATA_DIR,
Pocket,
Protein,
Protonation,
Docking,
Ligand,
PocketFinder,
LigandSet,
)
from deeporigin.platform import DeepOriginClient
from deeporigin import projects
projects.create("python-client-dev")
/home/runner/work/do-dd-client/do-dd-client/.venv/lib/python3.11/site-packages/jwt/api_jwt.py:149: InsecureKeyLengthWarning: The HMAC key is 6 bytes long, which is below the minimum recommended length of 32 bytes for SHA256. See RFC 7518 Section 3.2. return self._jws.encode(
'09B93956F06F4'
You don't have to explictitly initialize a client, but you can if you want:
client = DeepOriginClient()
client
DeepOrigin Platform Client name: Local User org_key: deeporigin base_url: http://127.0.0.1:4931/ project_id: 09B93956F06F4
Load protein and register on the platform¶
We use the the same BRD protein as in our other notebooks, and use the sync method to upload the PDB file and register it with the data platform:
protein = Protein.from_file(BRD_DATA_DIR / "brd.pdb")
protein.remove_water()
protein.sync()
protein.id
'brd'
Load ligand¶
We load a ligand from a SDF file on disk. You can also import a ligand from a SMILES string, etc. Once again, we use the sync method to upload the file (if any) and register with the data platform.
ligand = Ligand.from_sdf(BRD_DATA_DIR/"brd-2.sdf")
ligand.sync()
ligand
Ligand( name: cmpd 2 (methyl) id: brd-2 project: 09B93956F06F4 )
Protonate Ligand¶
We use the protonation tool to protonate the ligand and use the most probable species at that pH to dock. Note that the Protonator tool can modify our ligand.
protonator = Protonation(ligand=ligand)
protonator.run()
LigandSet with 1 ligand
SMILES: CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 PROTONATED (pH=7.4) 2D
Platform IDs: ✓ all ligands registered
Project: python-client-dev
Properties: _Name, _SMILES, initial_smiles, r_exp_dg
Use .to_dataframe() to convert to a dataframe, .show_df() to view dataframewith structures, or .show() for 3D visualization, .prepare() to prepare ligands for docking
Work with a pocket¶
The BRD structure has no co-crystallized ligand, so we find a novel pocket with the PocketFinder tool. When your structure has a crystal ligand, get its pocket from Protein Prep with find_pockets="from-crystal-ligand" instead; see the docking-crystal-pocket notebook.
pf = PocketFinder(protein=protein)
pockets = pf.run()
pocket = pockets[0]
Show pocket¶
Here, we view the pocket in the protein:
pocket.show()
pocket.show_box()
Show docking box¶
We can also view the docking box that is constructed from this pokcet:
docking = Docking(protein=protein, pocket=pockets[0], ligand=ligand)
docking.show_box(interactive=True)
IframeCommHandle(bridge_id='ca7ecad3-92ce-4d24-bd37-c18df1a23628', committed=None)
Estimate cost¶
Before running any tool, we can estimate the cost by passing quote=True as follows:
docking.run(quote=True)
docking.estimate
0.2
docking.pocket.box
PocketBox(box_size_x=22.0, box_size_y=20.0, box_size_z=21.0, rotation_deg=[5.0, 10.0, 15.0])
Dock ligand¶
We can now run the docking tool. Because we're docking a single ligand, we get back poses immediately. Docking.run (like all run methods) is a blocking synchronouse operation.
poses = docking.run()
We can view all poses in a dataframe:
poses.to_dataframe()
| id | SMILES | Binding Energy | best_pose | binding_energy | box_size_x | box_size_y | box_size_z | pocket_center | pocket_id | pose_result_id | pose_score | protein_id | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.015328 | True | -8.015328 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 089D682D3F344 | 0.904670 | brd |
| 1 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.961081 | False | -8.961081 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08CF737704160 | 0.898408 | brd |
| 2 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.692511 | False | -7.692511 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08FDDD8E1D9BF | 0.852781 | brd |
| 3 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -9.012382 | False | -9.012382 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 0844273EAAC8E | 0.807688 | brd |
| 4 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.441937 | False | -7.441937 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08759A44BC346 | 0.796831 | brd |
| 5 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.609729 | False | -8.609729 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 086E1665A4FF0 | 0.757949 | brd |
| 6 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.411566 | False | -8.411566 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 0889BE5772EFA | 0.709940 | brd |
| 7 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.697807 | False | -7.697807 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 084C74656A1EC | 0.624421 | brd |
| 8 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.191995 | False | -7.191995 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08AEF6FAF9C01 | 0.594424 | brd |
| 9 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -6.837277 | False | -6.837277 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08D0983DE7A2D | 0.585849 | brd |
| 10 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -6.739297 | False | -6.739297 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08BC53F046199 | 0.573230 | brd |
| 11 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.172841 | False | -8.172841 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 085E7BD00A4AB | 0.544384 | brd |
| 12 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.280019 | False | -7.280019 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 081C7CB45BC18 | 0.537316 | brd |
| 13 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.083034 | False | -8.083034 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 0895DB9D03187 | 0.535973 | brd |
| 14 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -7.644990 | False | -7.644990 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 08883B36D39B7 | 0.534965 | brd |
| 15 | brd-2 | CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1 | -8.500072 | False | -8.500072 | 20 | 20 | 20 | [-13.146394729614258, -5.712231636047363, 14.7... | pocket-test-id | 0862CC3541EA5 | 0.513628 | brd |
Show poses¶
To visualize the poses, we download them and show them in the protein:
poses.download()
protein.show(poses=poses)
Downloading files: 0%| | 0/16 [00:00<?, ?file/s]
Downloading files: 38%|███▊ | 6/16 [00:00<00:00, 55.28file/s]
Downloading files: 100%|██████████| 16/16 [00:00<00:00, 121.79file/s]
poses = docking.get_poses() # or poses from docking.run()
docking.show_box(poses=poses) # one pose: docking.show_box(poses=poses[0])
Downloading files: 0%| | 0/1 [00:00<?, ?file/s]
Downloading files: 100%|██████████| 1/1 [00:00<00:00, 14074.85file/s]