Skip to content

Commit b73a698

Browse files
authored
Merge pull request #170 from OpenFreeEnergy/cli_tutorial_proofreading
CLI tutorial proofreading
2 parents 34fad3e + 50d3b52 commit b73a698

File tree

1 file changed

+63
-56
lines changed

1 file changed

+63
-56
lines changed

rbfe_tutorial/cli_tutorial.md

Lines changed: 63 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,66 @@
11
# Relative Free Energies with the OpenFE CLI
22

3-
This tutorial will show how to use the OpenFE command line interface to get
4-
free energies -- with no Python at all! This will work for simple setups, but you
5-
may need to use the Python interface for more complicated setups.
3+
This tutorial will show how to use the OpenFE CLI (Command Line Interface) to calculate
4+
free energies - with no Python at all! This CLI works for simple setups, but you
5+
may need to use the Python API for more complicated setups.
66

77
The entire process of running the campaign of simulations is split into 3
88
stages, each of which corresponds to a CLI command:
99

10-
1. Setting up the necessary files to describe each of the individual
11-
simulations to run
10+
1. Setting up the files necessary to run each of the simulations
1211
2. Running the simulations
13-
3. Gathering the results of separate simulations into a single table
12+
3. Gathering the results of the simulations into a single table
1413

15-
To work through this tutorial, start out with a fresh directory. You can download the tutorial materials (including this file) using the command:
14+
To work through this tutorial, start out with a fresh directory. You can download the tutorial materials (including these instructions) using the command:
1615

1716
```bash
1817
openfe fetch rbfe-tutorial
1918
```
2019

21-
Then when you run `ls`, you should see that your directory has this file,
22-
`cli_tutorial.md`, a notebook called `python_tutorial.ipynb`, and files with
23-
the molecules we'll use in this tutorial: `tyk2_ligands.sdf` and
24-
`tyk2_protein.pdb`.
20+
Then when you run `ls`, you should see that your directory has:
21+
22+
- `cli_tutorial.md`: the file containing these instructions
23+
- `python_tutorial.ipynb`: a notebook detailing how to do this analysis using the Python API, instead of the CLI shown here.
24+
- `tyk2_ligands.sdf` and `tyk2_protein.pdb` : files containing the molecules we'll use in this tutorial.
2525

2626
## Setting up the campaign
2727

28-
The CLI makes setting up the simulation very easy -- it's just a single CLI
28+
The CLI makes setting up the simulation very easy - it's just a single CLI
2929
command. There are separate commands for relative binding free energy (RBFE)
3030
and relative hydration free energy setups (RHFE).
3131

3232
For RBFE campaigns, the relevant command is `openfe plan-rbfe-network`. For
3333
RHFE, the command is `openfe plan-rhfe-network`. They work mostly the same,
3434
except that the RHFE planner does not take a protein. In this tutorial, we'll
35-
do an RBFE calculation. The only difference for RBFE is in the setup stage --
35+
do an RBFE calculation. The only difference for RHFE is in the setup stage -
3636
running the simulations and gathering the results are the same.
3737

38-
To run the command, we do the following:
39-
* Read all the ligands from the SDF by giving
40-
the option `-M tyk2_ligands.sdf`. You can also use `-M` with a directory, and
41-
it will load all molecules found in any SDF or MOL2 file in that directory.
42-
* Pass a PDB of the protein target (TYK2) with `-p tyk2_protein.pdb`.
43-
* Instruct `openfe` to output files into a directory called `network_setup`
44-
with the `-o network_setup` option.
38+
With the single command:
4539

4640
```bash
4741
openfe plan-rbfe-network -M tyk2_ligands.sdf -p tyk2_protein.pdb -o network_setup
4842
```
4943

44+
we do the following:
45+
46+
- Read all the ligands from the SDF by giving
47+
the option `-M tyk2_ligands.sdf`. You can also use `-M` with a directory, and
48+
it will load all molecules found in any SDF or MOL2 file in that directory.
49+
- Pass a PDB of the protein target (TYK2) with `-p tyk2_protein.pdb`.
50+
- Instruct `openfe` to output files into a directory called `network_setup`
51+
with the `-o network_setup` option.
52+
5053
Planning the campaign may take some time, as it tries to find the best
5154
network from all possible transformations. This will create a directory called
52-
`network_setup`, which is structured like this:
55+
`network_setup/`, which is structured like this:
5356

5457
<!-- top lines from `tree network_setup` -->
5558

5659
```text
5760
network_setup
5861
├── ligand_network.graphml
5962
├── network_setup.json
60-
└── transformations
63+
└── transformations/
6164
├── easy_rbfe_lig_ejm_31_complex_lig_ejm_42_complex.json
6265
├── easy_rbfe_lig_ejm_31_complex_lig_ejm_46_complex.json
6366
├── easy_rbfe_lig_ejm_31_complex_lig_ejm_47_complex.json
@@ -79,16 +82,18 @@ This opens an interactive viewer. You can move the ligand names around to get a
7982
better view of the structure, and if you click on the edge, you will see the
8083
mapping for that edge.
8184

82-
The files that describe each individual simulation we will run are located in the
83-
`transformations` subdirectory. Each JSON file represents a single alchemical
84-
leg to run, and contains all the necessary information to run that leg. A
85-
single RBFE between a pair of ligands requires running two legs of an alchemical cycle (JSON files):
86-
one for the ligand in solvent, and one for the ligand complexed with the
87-
protein. The results from these two simulations can then be combined to obtained a single $\Delta\Delta G$ relative binding free energy value. Filenames indicate ligand names as taken from the SDF; for example,
88-
the file `easy_rbfe_lig_ejm_31_complex_lig_ejm_42_complex.json` is the leg
85+
The files that describe each individual simulation we will run are located within
86+
`network_setup/transformations/`. Each JSON file represents a single alchemical
87+
leg to run and contains all the necessary information to run that leg.
88+
Filenames indicate ligand names as taken from the SDF; for example, the file
89+
`easy_rbfe_lig_ejm_31_complex_lig_ejm_42_complex.json` is the leg
8990
associated with the tranformation of the ligand `lig_ejm_31` into `lig_ejm_42`
9091
while in complex with the protein.
9192

93+
A single RBFE between a pair of ligands requires running two legs of an alchemical cycle (JSON files):
94+
one for the ligand in solvent, and one for the ligand complexed with the
95+
protein. The results from these two simulations can then be combined to obtained a single $\Delta\Delta G$ relative binding free energy value.
96+
9297
Note that this specific setup makes a number of choices for you. All of
9398
these choices can be customized in the Python API. Here are the specifics on
9499
how these simulation are set up:
@@ -103,13 +108,15 @@ how these simulation are set up:
103108

104109
## Customize your campaign setup
105110

106-
OpenFE contains many different options and methods for setting up a simulation campaign.
107-
The options can be easily accessed and modified by providing a settings
111+
OpenFE contains many different options and methods for setting up a simulation campaign.
112+
The options can be easily accessed and modified by providing a settings
108113
file in the `.yaml` format.
109-
Let's assume you want to exchange the LOMAP atom mapper with the Kartograf
114+
Let's assume you want to exchange the LOMAP atom mapper with the Kartograf
110115
atom mapper and the Minimal Spanning Tree
111116
Network Planner with the Maximal Network Planner, then you could do the following:
117+
112118
1. provide a file like `settings.yaml` with the desired changes:
119+
113120
```yaml
114121
mapper:
115122
method: kartograf
@@ -119,6 +126,7 @@ network:
119126
```
120127
121128
2. Plan your rbfe network with an additional `-s` flag for passing the settings:
129+
122130
```bash
123131
openfe plan-rbfe-network -M tyk2_ligands.sdf -p tyk2_protein.pdb -o network_setup -s settings.yaml
124132
```
@@ -142,9 +150,9 @@ Using Options:
142150
Networker: functools.partial(<function generate_maximal_network at 0x7fea18371260>)
143151
```
144152

145-
That concludes the straightforward process of tailoring your OpenFE setup to your specifications.
146-
Additionally, we've provided a snippet for generating YAML files with
147-
various of the current options for your convenience.
153+
That concludes the straightforward process of tailoring your OpenFE setup to your specifications.
154+
Additionally, we've provided a snippet for generating YAML files with
155+
various of the current options for your convenience.
148156

149157
Option Examples:
150158

@@ -160,7 +168,6 @@ network:
160168
# method: generate_minimal_redundant_network
161169
```
162170

163-
164171
**Customize away!**
165172

166173
## Running the simulations
@@ -279,31 +286,31 @@ gather` command from within the working directory used above:
279286
openfe gather results/ --report dg -o final_results.tsv
280287
```
281288

282-
This will write out a tab-separated table of results where the results
289+
This will write out a tab-separated table of results where the results
283290
reported are controlled by the `--report` option:
284291

285-
* `dg` (default) reports the ligand and the results are the maximum
286-
likelihood estimate of its absolute free, and the associated
287-
uncertainty from DDG replica averages and standard deviations.
288-
* `ddg` reports pairs of `ligand_i` and `ligand_j`, the calculated
289-
relative free energy `DDG(i->j) = DG(j) - DG(i)` and its uncertainty.
290-
* `raw` reports the raw results, giving the leg (`vacuum`, `solvent`, or
291-
`complex`), `ligand_i`, `ligand_j`, the raw `DG(i->j)` associated with it.
292-
292+
- `dg` (default) reports the ligand and the results are the maximum
293+
likelihood estimate of its absolute free, and the associated
294+
uncertainty from DDG replica averages and standard deviations.
295+
- `ddg` reports pairs of `ligand_i` and `ligand_j`, the calculated
296+
relative free energy `DDG(i->j) = DG(j) - DG(i)` and its uncertainty.
297+
- `raw` reports the raw results, giving the leg (`vacuum`, `solvent`, or
298+
`complex`), `ligand_i`, `ligand_j`, the raw `DG(i->j)` associated with it.
293299

294-
The resulting file looks something like this:
300+
The resulting file (`final_results.tsv`) will look something like this:
295301

296302
<!-- take top lines from `cat final_results.tsv` -->
297303

298304
```text
299-
lig_ejm_31 -0.21 0.06
300-
lig_ejm_42 0.63 0.08
301-
lig_ejm_46 -0.80 0.07
302-
lig_ejm_47 -0.1 0.2
303-
lig_ejm_48 0.6 0.3
304-
lig_ejm_50 1.0 0.1
305-
lig_ejm_43 1.9 0.1
306-
lig_jmc_23 -0.94 0.09
307-
lig_jmc_27 -0.91 0.09
308-
lig_jmc_28 -1.2 0.1
305+
ligand DG(MLE) (kcal/mol) uncertainty (kcal/mol)
306+
lig_ejm_31 -0.09 0.05
307+
lig_ejm_42 0.7 0.1
308+
lig_ejm_46 -0.98 0.05
309+
lig_ejm_47 -0.1 0.1
310+
lig_ejm_48 0.53 0.09
311+
lig_ejm_50 0.91 0.06
312+
lig_ejm_43 2.0 0.2
313+
lig_jmc_23 -0.68 0.09
314+
lig_jmc_27 -1.1 0.1
315+
lig_jmc_28 -1.25 0.08
309316
```

0 commit comments

Comments
 (0)