DGL-LifeSci

repository·master·Indexed 21 days ago

https://github.com/awslabs/dgl-lifesci

A specialized toolkit for applying graph neural networks to life science problems, such as molecular modeling and biological network analysis. It extends the DGL library with domain-specific tools for graph construction, featurization, and pre-trained models. The toolkit includes implementations for binding affinity prediction (ACNN and PotentialNet) and deep generative models of graphs (DGMG and Junction Tree VAE).

Tokens
20.6K
Snippets
65
Records
118
Agent score
73%

What's inside DGL-LifeSci

  1. Overview of DGL-LifeSci capabilities

    master

    DGL-LifeSci is a Python package designed to apply Graph Neural Networks (GNNs) to tasks in chemistry and biology. It is built on top of PyTorch, DGL (Deep Graph Library), and RDKit.

    Key application areas include:

    • Molecular property prediction
    • Generative models
    • Reaction prediction
    • Protein-ligand binding affinity prediction
  2. Overview of DGL-LifeSci

    master

    DGL-LifeSci is a toolkit built on top of DGL (Deep Graph Library) designed for applying graph neural networks to life science applications, such as molecular graphs and biological networks.

    Key functionalities include:

    • Graph construction
    • Featurization
    • Evaluation methods
    • Model architectures
    • Training scripts
    • Pre-trained models
  3. Use utilities for protein-ligand complex graph construction

    master

    DGL-LifeSci provides specialized utilities for constructing and featurizing graphs representing protein-ligand complexes. These utilities are designed to facilitate deep learning tasks involving molecular docking or binding affinity prediction by converting complex 3D structures into graph representations.

    Available utilities include:

    • dgllife.utils.ACNN_graph_construction_and_featurization: For ACNN-style graph construction.
    • dgllife.utils.PN_graph_construction_and_featurization: For PN-style graph construction.
  4. Construct molecular graphs in DGL-LifeSci

    master

    DGL-LifeSci provides several graph construction methods to transform molecules (from SMILES or RDKit molecule objects) into DGL graphs. You can choose from three primary topologies:

    • bigraph: Bi-directed graphs that correspond exactly to molecular graphs.
    • complete_graph: Graphs where every atom is connected to every other atom.
    • nearest_neighbor_graph: Graphs where each atom is connected to its $k$ closest neighbors based on 3D coordinates.

    Available conversion utilities include:

    • mol_to_graph / smiles_to_bigraph / mol_to_bigraph (and variants for complete/nearest neighbor graphs).
    • Class-based interfaces: ToGraph, MolToBigraph, and SMILESToBigraph.
  5. Predict reaction centers and products with WLN

    master

    The Weisfeiler-Lehman Network (WLN) implementation in the Model Zoo supports reaction-related tasks:

    • WLN for Reaction Center Prediction: To identify the reaction center in a chemical reaction.
    • WLN for Ranking Candidate Products: To rank potential products in a reaction.
  6. How GNN-based link prediction works

    master

    Link prediction in DGL-LifeSci is the task of estimating the probability of links between nodes in a graph. A typical Graph Neural Network (GNN) workflow for link prediction follows these five steps:

    1. Graph Construction: Construct graphs based on biological networks.
    2. Feature Preparation: Prepare initial node and edge features for the graphs.
    3. Node Representation Update: Use GNNs to update the node representations within the graphs.
    4. Link Representation Computation: Compute the representation for a potential link by taking the product of its two updated nodes.
    5. Prediction: Pass the resulting link representations through a Multi-Layer Perceptron (MLP) for training and final link prediction.
  7. Format reaction SMILES for new datasets

    master

    When adapting the model to a new dataset, each line must be a reaction SMILES (rxn smiles) in the format: reactants>>products.

    Requirements:

    1. Structure: Reactants are separated by . and placed before >>. The product is placed after >>.
    2. Atom Mapping: Atom mapping numbers must be provided and must be consecutive integers starting from 1.
    3. Hydrogen Atoms: To avoid atom mapping issues, it is recommended to convert raw reaction SMILES (which may contain explicit hydrogens) to SMILES without hydrogens using RDKit before adding map IDs.

    Example of a valid mapped reaction SMILES: [CH3:1][NH2:2].[N+:3](=[O:4])([O-:5])[c:6]1[cH:7][c:8]([C:9](=[O:10])[OH:11])[cH:12][cH:13][c:14]1[Cl:15].[OH2:16]>>[N+:3](=[O:4])([O-:5])[c:6]1[cH:7][c:8]([C:9](=[O:10])[OH:11])[cH:12][cH:13][c:14][NH:1][CH3:2]

    Workflow for new datasets:

    1. Clean local cache: ./clean.sh
    2. Pre-process SMILES (remove hydrogens and add consecutive map IDs).
    3. Train/Evaluate using the provided scripts.
  8. Use Model Zoo building blocks

    master

    The DGL-LifeSci Model Zoo provides modular building blocks for constructing complex models. These components can be used to build custom architectures for graph-based tasks.

    Available building blocks include:

    • MLP Predictor: Multi-Layer Perceptron for property prediction.
    • Hadamard Link Predictor: For link prediction tasks using Hadamard products.
  9. Alchemy dataset pre-processing and modeling details

    master

    When using the Alchemy dataset in DGL-LifeSci:

    • Graph Construction: By default, a complete graph is constructed for each molecule, meaning every pair of atoms is connected.
    • Data Splitting: The dataset uses a stratified split for training, validation, and test sets to ensure each set covers the full range of provided labels.
    • Featurization: Specific details for node and edge featurization can be found in the DGL-LifeSci API documentation.
  10. How PotentialNet works

    master

    PotentialNet is a 3-stage model that combines Graph Convolutional Neural Networks (GCNN) with molecular graphs and KNN graphs.

    1. Stage 1 (Covalent Propagation): Constructs ligand and protein graphs using dgllife.utils.CanonicalAtomFeaturizer and dgllife.utils.CanonicalBondFeaturizer. Feature propagation is handled by a multi-step Gated Recurrent Unit (GRU) followed by a linear layer with sigmoid activation.
    2. Stage 2 (Noncovalent/Spatial Propagation): Constructs new KNN-graphs for the ligand and protein based on 3D coordinates. Edge types combine covalent bond types and physical distances. The output from Stage 1 is used as initial features. Propagation uses a multi-step GRU and a linear layer with sigmoid activation.
    3. Stage 3 (Feature Gathering): Performs feature gathering only on ligand atoms from the Stage 2 graphs. The final prediction is computed via a multi-layer fully connected neural network (FCNN) with ReLU activation.