Skip to content

About

Generation of molecular structures using Graph Neural Networks with Python and PyTorch

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

Molecular Graph Generation

illustration

This project consists in using graph neural networks to produce generative models that generate realistic molecules with interesting properties. To this end, we rely on ZINC-250k, a publicly available dataset containing molecules. We train GNN models on ZINC-250k to extract latent representations for molecules, and use these latent representations to optimize properties of interest in the generated molecules.

Requirements

This code was tested in Python 3.8.5, with PyTorch 1.8.1, DGL (Deep Graph Library) 0.6.1, and RDKit 2019.09.3.

Files

  1. prepare_data.py : this script splits the dataset in the folder data/ into training and validation datasets. In addition, it transforms the molecules represented as SMILES into graphs.

  2. model.py : this file contains the definition of the model, which is a Variational Graph Autoencoder (VGAE).

  3. train.ipynb : the training notebook. Use this to train the model defined in model.py on the data generated by prepare_data.py.

  4. generate_molecules.py : this scripts uses the trained model to generate molecules.

  5. evaluate.py : this scripts evaluates the molecules generated by generate_molecules.py. Various evaluation metrics are computed.

  6. draw_molecules.py : this one is for vizualizing molecules. After executing this script, images of a sample of training and generated molecules can be found in the data folder.

  7. utils.py : this file contains various functions used throughout the repository.

How to run the code

First, run prepare_data.py to generate the training and validation data. Then, use the notebook train.ipynb to train the model. After that, run generate_molecules.py to generate molecules. Finally, run evaluate.py to compute evaluation metrics, or draw_molecules.py to visualize molecules.

About

Generation of molecular structures using Graph Neural Networks with Python and PyTorch

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages