Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 103 additions & 25 deletions abfe_tutorial/abfe_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"text": [
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
"100 3092k 100 3092k 0 0 432k 0 0:00:07 0:00:07 --:--:-- 501k\n",
"100 3092k 100 3092k 0 0 1588k 0 0:00:01 0:00:01 --:--:-- 1587k\n",
"Archive: abfe_results.zip\n",
" inflating: abfe_results/README.md \n",
" inflating: abfe_results/abfe_results_single_unit/results_2/1.json \n",
Expand All @@ -53,6 +53,92 @@
"!unzip -o abfe_results.zip"
]
},
{
"cell_type": "markdown",
"id": "0e15f538-1471-440f-b590-866a2258f0c7",
"metadata": {},
"source": [
"## Analysing results from the command line\n",
"\n",
"The quickest way to get free energies out of your `openfe quickrun` results is\n",
"`openfe gather-abfe`, which reads the result JSON files and prints a report\n",
"directly. The default `--report dg` gives the overall binding free energy per\n",
"ligand; `--report raw` gives the per-leg (complex and solvent) values. Add\n",
"`-o out.tsv` to write a tab-separated file instead of printing, and\n",
"`--allow-partial` to skip incomplete edges with a warning.\n",
"\n",
"*Note: `openfe gather-abfe` is currently experimental and may change in a future\n",
"openfe release. It will also print an experimental-feature warning to stderr.*"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7bb3c09c-4aff-4e6a-9b39-4d0318b2a71b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mWARNING! Gathering of ABFE results with `openfe gather-abfe` is an experimental feature and is subject to change in a future release of openfe.\u001b[0m\n",
"┌────────┬───────────────┬────────────────────────────────┐\n",
"│\u001b[1m \u001b[0m\u001b[1mligand\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mDG (kcal/mol)\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mstd dev uncertainty (kcal/mol)\u001b[0m\u001b[1m \u001b[0m│\n",
"├────────┼───────────────┼────────────────────────────────┤\n",
"│ 1 │ -20.87 │ 0.58 │\n",
"└────────┴───────────────┴────────────────────────────────┘\n"
]
}
],
"source": [
"# overall binding free energy (DG) per ligand\n",
"!openfe gather-abfe abfe_results/abfe_results_multiple_units --report dg"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "89f51d9d-1ea8-4d12-8d7c-7bce2dd6666a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mWARNING! Gathering of ABFE results with `openfe gather-abfe` is an experimental feature and is subject to change in a future release of openfe.\u001b[0m\n",
"┌──────────────────────────┬────────┬───────────────┬──────────────────────────┐\n",
"│\u001b[1m \u001b[0m│\u001b[1m \u001b[0m│\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mMBAR uncertainty \u001b[0m\u001b[1m \u001b[0m│\n",
"│\u001b[1m \u001b[0m\u001b[1mleg \u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mligand\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1mDG (kcal/mol)\u001b[0m\u001b[1m \u001b[0m│\u001b[1m \u001b[0m\u001b[1m(kcal/mol) \u001b[0m\u001b[1m \u001b[0m│\n",
"├──────────────────────────┼────────┼───────────────┼──────────────────────────┤\n",
"│ complex │ 1 │ 36.34 │ 0.91 │\n",
"│ complex │ 1 │ 36.17 │ 0.80 │\n",
"│ complex │ 1 │ 34.77 │ 0.81 │\n",
"│ solvent │ 1 │ 6.5 │ 1.4 │\n",
"│ solvent │ 1 │ 5.4 │ 1.4 │\n",
"│ solvent │ 1 │ 5.5 │ 1.4 │\n",
"│ standard_state_correcti… │ 1 │ -8.9 │ 0.0 │\n",
"│ standard_state_correcti… │ 1 │ -9.3 │ 0.0 │\n",
"│ standard_state_correcti… │ 1 │ -9.0 │ 0.0 │\n",
"└──────────────────────────┴────────┴───────────────┴──────────────────────────┘\n"
]
}
],
"source": [
"# raw per-leg (complex, solvent, and Boresch-restraint analytical correction) values\n",
"!openfe gather-abfe abfe_results/abfe_results_multiple_units --report raw"
]
},
{
"cell_type": "markdown",
"id": "7e0ce0ab-0777-44b2-b865-7eaedaba57d9",
"metadata": {},
"source": [
"## Analysing results with the Python API\n",
"\n",
"For more control over how results are combined and analysed, you can work with\n",
"the result JSONs directly in Python, as shown in the rest of this notebook."
]
},
{
"cell_type": "markdown",
"id": "f2cff1e7-cf62-4839-b53d-62b59b7189b6",
Expand All @@ -64,7 +150,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"id": "7fbf1482-25ca-427b-a881-af88a983461c",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -95,7 +181,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"id": "08afcbcf-34a8-4450-a967-eb4ed5800ee1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -127,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"id": "04ccdedd-84e3-4ccc-ae42-4f3772acb115",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -173,7 +259,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "3733c540-de62-45a0-ba66-268397a38b49",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -241,7 +327,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "0621e3a2-7906-4661-a640-c414456f8869",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -279,7 +365,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "5821b7f7-6aed-4138-9502-44df3af52647",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -311,7 +397,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"id": "e021b2ea-db13-4e47-a6d1-cf5229b5b494",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -352,7 +438,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "b077c4e2-373a-4314-a527-186bb4683262",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -407,7 +493,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"id": "7bc49c0e-6fec-409c-a01c-42c35f57dcc6",
"metadata": {},
"outputs": [],
Expand All @@ -430,7 +516,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"id": "46996a74-709c-41f2-ac39-0f77fb33371e",
"metadata": {},
"outputs": [],
Expand All @@ -441,7 +527,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"id": "d1a6ad61-1e5a-4d8a-9067-9ed428ef145c",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -487,7 +573,7 @@
"0 1 -20.87 0.47"
]
},
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -507,7 +593,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"id": "8b2c1dd8-ffa3-4585-94a7-4a1ed1454f30",
"metadata": {},
"outputs": [],
Expand All @@ -518,7 +604,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"id": "08b72901-9c71-460b-b5da-9fb4a35e07f7",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -630,22 +716,14 @@
"8 standard_state_correction 1 -9.0 0.0"
]
},
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_raw"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf160a28-3aa1-4661-8f06-3a4a71d34ff2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -664,7 +742,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.13"
"version": "3.13.11"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Loading
Loading