DrugEx

repository·master·Indexed 41 days ago

https://github.com/cddleiden/drugex

A software library for the de novo design of small molecules using deep learning generative models within a multi-objective reinforcement learning framework. It provides a CLI and Python interface for molecular data processing, model training, and generation, supporting architectures such as Recurrent Neural Networks (RNN) and Graph Transformers.

Tokens
19.1K
Snippets
49
Records
67
Agent score
50%

What's inside DrugEx

  1. Overview of the drugex package structure

    master

    The drugex package is organized into several functional subpackages that handle different stages of the drug discovery and machine learning workflow:

    • drugex.data: Data management and handling.
    • drugex.logs: Logging utilities.
    • drugex.molecules: Molecular representation and manipulation.
    • drugex.parallel: Parallel processing capabilities.
    • drugex.training: Machine learning training workflows.
    • drugex.utils: General utility functions.
  2. Overview of the drugex.training.scorers package

    master
    The drugex.training.scorers package provides a suite of tools for evaluating and scoring molecular data, typically used during machine learning training or drug discovery workflows. It is organized into several specialized submodules covering interfaces, property calculations, similarity metrics, and specific scoring algorithms like QSPR predictions and SA (Synthetic Accessibility) scoring.
  3. Get started with DrugEx

    master

    DrugEx is a collection of deep learning models designed for the directed generation of molecules. To begin using the project, you should follow these primary steps:

    1. Installation: Set up the environment and install the necessary dependencies.
    2. Usage: Explore provided examples to understand how to run models for molecular generation.
    3. API Documentation: Refer to the module-specific documentation for detailed technical specifications of the underlying software components.
  4. Explore DrugEx tutorial notebooks

    master

    The DrugEx tutorials are organized by model type. The recommended learning path is:

    1. Recurrent Neural Network (RNN) (Sequence-RNN.ipynb): Recommended for beginners or those needing an introduction to generative AI for molecules.
    2. Graph Transformer (Graph-Transformer.ipynb): An advanced tutorial that assumes knowledge of concepts covered in the RNN tutorial.
  5. Explore the drugex.training package structure

    master

    The drugex.training package provides the core components for reinforcement learning and training workflows within DrugEx. It is organized into several specialized subpackages and modules:

    Subpackages

    • drugex.training.explorers: Contains logic for exploration strategies during training.
    • drugex.training.generators: Contains components for generating data or sequences.
    • drugex.training.scorers: Contains logic for scoring or evaluating generated outputs.

    Core Modules

    • drugex.training.environment: Defines the training environments.
    • drugex.training.interfaces: Defines the abstract base classes and interfaces used to ensure compatibility between components.
    • drugex.training.monitors: Provides tools for monitoring training progress and metrics.
    • drugex.training.rewards: Contains reward functions and logic used to guide the training process.
    • drugex.training.tests: Contains testing utilities for the training package.
  6. Explore the drugex.molecules package structure

    master

    The drugex.molecules package is the core module for handling molecular data in DrugEx. It is organized into several functional submodules and subpackages:

    • drugex.molecules.interfaces: Defines the abstract interfaces and base classes for molecular objects and suppliers.
    • drugex.molecules.mol: Contains the primary implementations for molecular representations and data structures.
    • drugex.molecules.suppliers: Provides modules for fetching or generating molecular data from various sources.
    • drugex.molecules.converters (Subpackage): Contains logic for transforming molecular data between different formats or representations.
  7. Explore drugex core modules

    master

    The drugex package provides several top-level modules for specific tasks:

    • drugex.about: Package information and metadata.
    • drugex.dataset: Tools for managing and interacting with datasets.
    • drugex.download: Utilities for downloading external data or resources.
    • drugex.generate: Functions for generating molecular data or structures.
    • drugex.train: Modules for executing training pipelines.
  8. Download example data and models

    master

    Before running the CLI tutorials, you must download the necessary example data and pretrained models into the tutorial/CLI/examples directory. Run this command from the repository root:

    python -m drugex.download -o tutorial/CLI/examples # ran from the repository root
  9. Download tutorial data for the DrugEx CLI

    master

    To follow the CLI tutorial, you must first install the drugex package and QSPRPred. Once installed, navigate to the /CLI directory and run the download command to populate the local environment with pretrained models, example data, and a local version of the Papyrus dataset.

    This process creates an examples folder in your current directory and a data/.Papyrus folder containing the Papyrus dataset, which can be used for further data extraction via Papyrus-scripts.

    drugex download -o examples
    # or on Windows:
    python -m drugex.download -o examples
  10. Pretrain a generator from scratch

    master

    Pretraining (-tm PT) follows the same workflow as fine-tuning, but the generator is not initialized with pretrained weights. This is used to train a model from the ground up.

    # Preprocess
    python -m drugex.dataset -b ${BASE_DIR} -i A2AR_LIGANDS.tsv -mc SMILES -o example_pt -mt graph
    
    # Pretrain
    python -m drugex.train -tm PT -b ${BASE_DIR} -i example_pt -mt graph -e 2 -bs 32 -gpu 0