Skip to content

How to Use the Molecule Working Set§

Your molecule working set (MWS) is an in-memory list of small molecules that is the subject of your calculations and manipulations.

Install OpenAD§

Find more detailed installation instructions here.

Bash
pip install openad

Note

To run this tutorial from a Jupyter Notebook, make sure to enable OpenAD magic commands and prepend every command with %openad.

About the MWS§

Your "Molecule Working Set" or MWS functions like a bucket where you can add molecules from various sources, to then review, triage or manipulate them together and export them to a new file.

Warning

When you end your session or restart your Jupyter kernel, the MWS gets erased.

At any given time, you can list your molecules, or display them in the GUI (graphical user interface). In the beginning of your session, your MWS will be empty.

Bash
list molecules

Empty molecule working set in the terminal

Bash
show molecules

Empty molecule working set in the GUI

Loading Individual Molecules§

To add the molecule CCCCCC=CC=CC(=O)OCC (Ethyl decadienoate or pear flavor) to your working set, simply run the command below. This will ask for confirmation, then create the molecule and fetch any available data from PubChem.

Bash
add mol CCCCCC=CC=CC(=O)OCC

Aside from any valid SMILES or InChI, if a molecule is available on PubChem you can add it by name, InChIKey or PubChem CID.

If you're using SMILES or InChI as identifier and you don't need the enrichment from PubChem, you can add the basic clause. And If you prefer to skip the confirmation step, you can add the force clause.

Let's add a few more flavors to our molecular fruit salad.

Bash
add mol InChI=1S/C7H14O2/c1-6(2)4-5-9-7(3)8/h6H,4-5H2,1-3H3 force
Bash
add mol Isobutylbenzene force
Bash
add mol 'ethyl methylphenylglycidate' force
Bash
add mol HUMNYLRZRPPJDN-UHFFFAOYSA-N force
Bash
add mol 21648 force

Now we have pear, banana, cherry, strawberry, cherry and raspberry in our MWS. Let's list our salad.

Bash
list mols

List your molecules in the terminal

Or we can inspect them in the GUI.

Bash
show molecules

Display molecules in the browser

Loading Molecules in Batch§

Of course most of the time you'll want to load many molecules at once, sometimes from different file formats. So that's what we'll do.

Download the sample files below and copy them into your workspace. Update the file path if needed.

Bash
import from '~/Downloads/sample_molecules1.sdf' to 'sample_molecules1.sdf'
Bash
import from '~/Downloads/sample_molecules2.csv' to 'sample_molecules2.csv'
Bash
import from '~/Downloads/sample_molecules3.smi' to 'sample_molecules3.smi'

Once the files are in your workspace, you can easily load them into your MWS.

Don't forget the append clause.

Bash
load mols from file 'sample_molecules1.sdf'
Bash
load mols from file 'sample_molecules2.csv' append
Bash
load mols from file 'sample_molecules3.smi' append

Now when you inspect your MWS, you’ll see you have 34 molecules loaded.

Bash
show molecules

Display merged molecules in the browser

Continue Learning§

Want to learn more about how to work with small molecules in OpenAD?
Check out the other small molecule tutorials.