Skip to content

Getting Started with OpenAD§

Tl;dr§

Get started in your terminal:

Bash
openad

Get started with Jupyter Notebook examples:

Bash
init_magic
Bash
init_examples
Bash
jupyter lab ~/openad_notebooks/Table_of_Contents.ipynb

Warning

If you get an error when running init_magic, you may first need to setup the default iPython profile for magic commands.

Bash
ipython profile create

Getting Started - CLI§

  • Enter the virtual environment

    Bash
    source ~/ad-venv/bin/activate
    
  • Enter the command shell

    Here you'll find further instructions on how to use OpenAD.

    Bash
    openad
    

    OpenAD CLI

  • Exit the command shell
    Hit ctrl+c or run:

    Bash
    exit
    
  • Run a single command from outside the command shell

    Bash
    openad <command>
    
  • Exit the virtual environment

    Bash
    deactivate
    
  • Running Bash Commands

    To run a command in bash mode, prepend it with openad and make sure to escape quotes.

    Bash
    openad show molecules using file \'base_molecules.sdf\'
    

Getting Started - Jupyter§

Setting up Jupyter§

The following commands only need to be run once after installation:

  1. Activate your virtual environment

    Bash
    source ~/ad-venv/bin/activate
    
  2. Create an iPython kernel
    This ports your virtual environment to Jupyter.

    Bash
    python -m ipykernel install --user --name=ad-venv
    

    Note: List your installed iPython kernels: jupyter kernelspec list
    Remove a kernel: jupyter kernelspec uninstall ad-venv

  3. Install the magic commands
    This enables OpenAD commands to be run within a Jupyter Notebook.

    Bash
    init_magic
    
Alternative: Manually add magic commands
If you don't want to activate magic commands in all Notebooks, you can instead activate them for individual Notebooks. - Run `init_examples` - Copy the file `~/openad_notebooks/openad.ipynb` to the same directory as the Notebook you wish to activate. - In your Notebook, run this inside a code cell: `!run openad.ipynb`
  1. Install example Notebooks
    This installs our example Notebooks at ~/openad_notebooks.

    Bash
    init_examples
    


Launching OpenAD in Jupyter§

  1. Open any Notebook
    Launch Jupyter lab to create a fresh notebook, or get started with our example Notebook:

    Bash
    jupyter lab
    
    Bash
    jupyter lab ~/openad_notebooks/Table_of_Contents.ipynb
    

  2. Select the kernel
    Make sure to select the "ad-venv" iPython kernel you just created. You can do this under Kernel > Change Kernel, or by clicking the kernel name in the top right hand corner. If you don't see your iPython kernel, make sure you followed the Jupyter Setup instructions listed above.

    Jupyter Lab kernel

  3. Magic Commands
    Magic commands let you access any OpenAD CLI command from within Jupyter. They are invoked by the %openad prefix. Try listing your files as a test:

    Python
    %openad list files
    

    If you wish to retrieve data from an OpenAD command, you can use the %openadd prefix instead. This will return raw, unstyled data for further processing. For example:

    Python
    my_data = %openadd display data 'my_data_file.csv'
    
    for item in my_data:
        print(item.smiles)
    

    To see the available commands, you consult the Commands page, or you can request inline help:

    Python
    %openad ?