Home

Awesome

Metis - A Python-Based User Interface to Collect Expert Feedback for Generative Chemistry Models


Metis is GUI to enable the collection of accurate and detailed feedback on small molecules. At its core, it is built around Esben Bjerrums rdEditor using PySide2.

You can find the preprint at ChemRxiv


Table of Contents


Set up

Installation

Download the repository and navigate to the download location. You can install metis with pip install .. Make sure the environment you want to install into is activated and has python >= 3.9, <3.11 installed.

If you wish to use REINVENT 3 in the backend, also install REINVENT 3 on a remote machine.

Dependencies

Some notes on the dependencies.

PySide 2

Getting the environment set up with PySide2 can be somewhat challenging. It is planned to move to PySide6. There already exists a branch for it, which you can try out. It works but has not yet completely been tested.

scikit-learn

The version scikit-learn constraints are only set to make sure that the examples given here work. In theory, you could use any scikit-learn version. If you want to use Reinvent in the backend, you need to make sure that the version of scikit-learn Reinvent is using on the remote machine should be updated to the version that matches your local installation used by metis.

cairosvg

Depending on the OS you are running installing cairosvg through pip can cause issues, as cairo is not found. On MacOS you can solve this by installing cairo using homebrew, or you can install cairosvg using conda-

SSH

It is assumed you have a working version of Reinvent on a Server instance that is running Slurm and ssh.

  1. Change the ssh settings in the example_project/de_novo_files/ssh_settings.yml file.

    • ssh_login: your login to SSH e.g. username@remote_server you should be able to access your remote server without a password, for example, using an RSA Key
    • path_remote_folder: path on the remote machine, from where Reinvent files will be loaded and stored.
    • de_novo_json: specify which default reinvent.json file to use
    • default_slurm: specify which default Slurm job to use
  2. Copy and unzip the metis_reinvent.zip to the remote machine. Make sure that the path_remote_folder in the ssh_settings.yml file matches with the folder location and also in the initial_reinvent.json.

Usage

After installation simply run:

metis -f path/to/settings.yml --output /path/where/to/save/

This will start the GUI. Examples can be found below.

Examples

UI Only

In the most simple example, only the GUI will be started to collect feedback. No models are trained and no de novo run started.

- If you want to show the atom contributions to the predictions/model explanation
- (show_atom_contributions: render: true)
- you will experience heavy slowdowns when switching to a new molecule.
- The only solution at the moment is not to show them.
- You can set show_atom_contributions: render: False.
- This will yield a much smoother experience.    
cd example_project
metis -f settings_ui.yml --output results/

Reward Model

Here, next to collecting feedback, a reward model is also trained on the feedback. For this, we provided a QSAR model and Oracle model for JNK3 activity. The setting use_oracle_score: False, will use the feedback of humans as the target variable that is to be predicted. If the setting is set to True, the molecules liked by the chemist will be scored by the oracle, and these scores will then be used as the target varible for the reward model. This can be thought of as an active learning setting, where the chemists decides which molecules are being "biologically validated".

cd example_project
metis -f settings_reward_model.yml --output results/

De Novo Design

With these settings, a REINVENT de novo run can be started directly using Metis on a remote machine. The remote machine needs:

Once copied and unzipped, the paths and settings in the de_novo_files folder need to be adapted to fit to your paths on the remote machine.

cd example_project
metis -f settings_denovo.yml --output results/

Settings

Here is a brief overview of all settings

NameTypeRequiredDefault
<strong>seed</strong>Union[int, None]False
<strong>tutorial</strong>boolFalseFalse
<strong>debug</strong>boolFalseFalse
<strong>max_iterations</strong>intTrue...
<strong>innerloop_iterations</strong>Union[int, None]FalseNone
<strong>activity_label</strong>strTrue...
<strong>introText</strong>strTrue...
<strong>propertyLabels</strong>DictTrue...
<strong>data</strong><a href="#dataconfig">DataConfig</a>True...
<strong>ui</strong><a href="#uiconfig">UIConfig</a>True...
<strong>de_novo_model</strong>Union[<a href="#denovoconfig">DeNovoConfig</a>, None]FalseNone
<strong>reward_model</strong>Union[<a href="#rewardmodelconfig">RewardModelConfig</a>, None]FalseNone
<h3>DataConfig</h3>
NameTypeRequiredDefault
<strong>initial_path</strong>strTrue...
<strong>path</strong>strTrue...
<strong>selection_strategy</strong>strTrue...
<strong>num_molecules</strong>intTrue...
<strong>run_name</strong>strTrue...
<h3>UIConfig</h3>
NameTypeRequiredDefault
<strong>show_atom_contributions</strong><a href="#additionalwindowsconfig">AdditionalWindowsConfig</a>False{'render': False, 'path': None, 'ECFP': None}
<strong>show_reference_molecules</strong><a href="#additionalwindowsconfig">AdditionalWindowsConfig</a>False{'render': False, 'path': None, 'ECFP': None}
<strong>tab</strong><a href="#tabconfig">TabConfig</a>True...
<strong>navigationbar</strong><a href="#navigationbarconfig">NavigationbarConfig</a>True...
<strong>general</strong><a href="#generalconfig">GeneralConfig</a>True...
<strong>substructures</strong><a href="#substructureconfig">SubstructureConfig</a>True...
<strong>global_properties</strong><a href="#globalpropertiesconfig">GlobalPropertiesConfig</a>True...
<h3>AdditionalWindowsConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolFalseFalse
<strong>path</strong>Union[str, None]False
<strong>ECFP</strong>Union[<a href="#ecfpconfig">ECFPConfig</a>, None]False
<h3>ECFPConfig</h3>
NameTypeRequiredDefault
<strong>bitSize</strong>intTrue...
<strong>radius</strong>intTrue...
<strong>useCounts</strong>boolFalseFalse
<h3>TabConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolTrue...
<strong>tab_names</strong>ListTrue...
<h3>NavigationbarConfig</h3>
NameTypeRequiredDefault
<strong>sendButton</strong><a href="#navbuttonconfig">NavButtonConfig</a>True...
<strong>editButton</strong><a href="#navbuttonconfig">NavButtonConfig</a>True...
<h3>NavButtonConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolFalseFalse
<h3>GeneralConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolFalseTrue
<strong>slider</strong>boolFalseFalse
<h3>SubstructureConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolFalseFalse
<strong>liabilities</strong>DictTrue...

Liablities control which properties you can select substructures for: Keys such as ugly or tox are simply used within the script. name will define how the button is called color will define the color of the button as well as the color of the atom highlight

liabilities:
      ugly:
        name: "Mutagenicity"
        color: "#ff7f7f"
      tox:
        name: "Toxicity" 
        color: "#51d67e"
      stability:
        name: "Stability"
        color: "#eed358"
      like:
        name: "Good"
        color: "#9542f5"
<h3>GlobalPropertiesConfig</h3>
NameTypeRequiredDefault
<strong>render</strong>boolFalseFalse
<strong>liabilities</strong>ListTrue...
<h3>DeNovoConfig</h3>
NameTypeRequiredDefault
<strong>ssh_settings</strong>strTrue...
<strong>use_human_scoring_func</strong>boolFalseFalse
<strong>use_reward_model</strong>boolFalseFalse
<h3>RewardModelConfig</h3>
NameTypeRequiredDefault
<strong>use_oracle_score</strong>boolFalseTrue
<strong>weight</strong>Union[str, None]FalseNone
<strong>oracle_path</strong>Union[str, None]FalseNone
<strong>qsar_model_path</strong>strTrue...
<strong>training_data_path</strong>strTrue...
<strong>ECFP</strong><a href="#ecfpconfig">ECFPConfig</a>True...