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,
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(
'091B0DAEE74D4'
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: 091B0DAEE74D4
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: 091B0DAEE74D4 )
ligand.id
'brd-2'
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¶
Here, we will use a previously identified novel pocket using the PocketFinder tool.
pockets = Pocket.from_result(protein_id=protein.id)
pocket = pockets[0]
pocket
Pocket: ╭─────────────────────────┬──────────────────────────────────────╮ │ Name │ pocket_1 │ ├─────────────────────────┼──────────────────────────────────────┤ │ ID │ c002d6b3-0d66-4265-91db-8bec0392751d │ ├─────────────────────────┼──────────────────────────────────────┤ │ Protein ID │ brd │ ├─────────────────────────┼──────────────────────────────────────┤ │ Color │ red │ ├─────────────────────────┼──────────────────────────────────────┤ │ Center │ (-13.52, -4.94, 15.46) │ ├─────────────────────────┼──────────────────────────────────────┤ │ Box size (lab frame) │ 14.00 × 14.00 × 19.00 Å │ ├─────────────────────────┼──────────────────────────────────────┤ │ Docking box size │ 22.00 × 20.00 × 21.00 Å │ ├─────────────────────────┼──────────────────────────────────────┤ │ rotation_deg │ (5.00, 10.00, 15.00) │ ├─────────────────────────┼──────────────────────────────────────┤ │ Volume │ 300 ų │ ├─────────────────────────┼──────────────────────────────────────┤ │ Total SASA │ 1225.8883 Ų │ ├─────────────────────────┼──────────────────────────────────────┤ │ Polar SASA │ 309.8629 Ų │ ├─────────────────────────┼──────────────────────────────────────┤ │ Polar/Apolar SASA ratio │ 0.3382689 │ ├─────────────────────────┼──────────────────────────────────────┤ │ Hydrophobicity │ 29.92 │ ├─────────────────────────┼──────────────────────────────────────┤ │ Polarity │ 10 │ ├─────────────────────────┼──────────────────────────────────────┤ │ Drugability score │ 0.94304204 │ ├─────────────────────────┼──────────────────────────────────────┤ │ Pocket count │ 1 │ ├─────────────────────────┼──────────────────────────────────────┤ │ Pocket min size │ 30 ų │ ╰─────────────────────────┴──────────────────────────────────────╯
Show pocket¶
Here, we view the pocket in the protein:
protein.show(pockets=[pocket])
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()
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
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 | 08572E3B4668C | 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 | 0883FE43227D9 | 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 | 08E7BBDE2FBA6 | 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 | 08A5E21C49828 | 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 | 08F1BECB8E8D2 | 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 | 08C571F8DDEE3 | 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 | 08662EA0AA3EC | 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 | 08D7523B7EA89 | 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 | 08E76647AD98F | 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 | 081F066AB9791 | 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 | 08CE97CE3755D | 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 | 080ED59CD4FB0 | 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 | 081D4E846C5DD | 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 | 08232886FD3B1 | 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 | 089C3539C3731 | 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 | 086EC648FF337 | 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: 100%|██████████| 16/16 [00:00<00:00, 208.08file/s]