In [1]:
%load_ext autoreload
%autoreload 2
In [2]:
from dotenv import load_dotenv
from deeporigin.drug_discovery import Complex, BRD_DATA_DIR, Protein, Ligand, LigandSet
load_dotenv()
Out[2]:
True

ABFE workflow¶

This notebook shows you how to run ABFE on Deep Origin, and serves as a quick tutorial for running ABFE.

In [3]:
sim = Complex.from_dir(BRD_DATA_DIR)
sim.ligands
Out[3]:

LigandSet with 8 ligands

8 unique SMILES

Properties: initial_smiles, r_exp_dg

Use .to_dataframe() to convert to a dataframe, .show_df() to view dataframewith structures, or .show() for 3D visualization

In [4]:
sim.ligands.to_dataframe()
Out[4]:
r_exp_dg SMILES
0 -7.22 COCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
1 -7.64 C=CCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
2 -9.59 CN(C)C(=O)c1cccc(-c2cn(C)c(=O)c3[nH]ccc23)c1
3 -7.09 C=CCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
4 -7.66 CCCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
5 -8.59 CCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
6 -8.64 C/C=C/Cn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
7 -7.02 CCCn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
In [5]:
# use this ligand
ligand = [ligand for ligand in sim.ligands if ligand.name == "cmpd 4 (Crotyl)"][0]
ligand
<rdkit.Chem.rdchem.Mol object at 0x7f68f10f4dd0>
Out[5]:
Ligand:
  Name: cmpd 4 (Crotyl)
SMILES: C/C=C/Cn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O
Heavy Atoms: 25
Properties:
  r_exp_dg: -8.64
  initial_smiles: C/C=C/Cn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O

Prepare system¶

In [6]:
prepared_system = sim.prepare(ligand=ligand)
prepared_system.show()

Quote ABFE¶

We can estimate the cost of an ABFE run without running it.

In [7]:
jobs = sim.abfe.run(ligands=[ligand], quote=True)
job = jobs[0]
job
Out[7]:
Job Details

ABFE run using brd and cmpd 4 (Crotyl)

Job Quoted

This job has been quoted. It is estimated to cost $84. For details look at the Billing tab. To approve and start the run, call the confirm() method.

executionID resourceID Status Started At Running Time
033ab24d-1f29-4500-99b5-8cb6f84cc6b0 d2gxn7oqyjoa8gpdvu4l Quoted None None
{}
Quoted
⚠️ This widget will not auto-update. Last updated: 2026-01-23 17:15:50

If we're happy with this price, we can confirm the job (which runs it)

In [8]:
job.confirm()
job
Out[8]:
Job Details

ABFE run using brd and cmpd 4 (Crotyl)

Initializing → Solvation FEP → Binding FEP
executionID resourceID Status Started At Running Time
033ab24d-1f29-4500-99b5-8cb6f84cc6b0 d2gxn7oqyjoa8gpdvu4l Running now None
{}
Running
⚠️ This widget will not auto-update. Last updated: 2026-01-23 17:15:50

Monitor job¶

To monitor a job, use the job.watch method:

In [9]:
job.watch()
Job Details

ABFE run using brd and cmpd 4 (Crotyl)

Job completed successfully.
ΔG = -11.312 kcal/mol
executionID resourceID Status Started At Running Time
033ab24d-1f29-4500-99b5-8cb6f84cc6b0 d2gxn7oqyjoa8gpdvu4l Succeeded 5 seconds ago 0
{ "cmd": "FEP Results", "Solvation": 67.012, "Binding": 89.79, "AnalyticalCorr": -11.465, "Std": 0.0, "Total": -11.312, "unit": "kcal/mol" }
Succeeded
⚠️ This widget will not auto-update. Last updated: 2026-01-23 17:15:56

Get results¶

In [10]:
df = sim.abfe.get_results()
df
Downloading files:   0%|          | 0/1 [00:00<?, ?file/s]
Downloading files: 100%|██████████| 1/1 [00:00<00:00, 52.00file/s]

Out[10]:
dG Std AnalyticalCorr Repeats SMILES r_exp_dg
0 -9.655832 0.0 -11.465105 1 C/C=C/Cn1cc(-c2cccc(C(=O)N(C)C)c2)c2cc[nH]c2c1=O -8.64
In [ ]: