Molecular Property Prediction
Relevant source files
The following files were used as context for generating this wiki page:
Molecular property prediction in DGL-LifeSci is a Graph Neural Network (GNN) based framework designed to estimate chemical and biological properties of molecules. By representing molecules as graphs where atoms are nodes and bonds are edges, the system learns molecular representations—often referred to as learnable molecular fingerprints—to perform regression or classification tasks.
The pipeline generally follows five key stages: graph construction from SMILES strings, initial node/edge featurization, GNN-based representation updating, graph-level readout (pooling), and final prediction through a Multi-Layer Perceptron (MLP). This approach is applied across various benchmarks including MoleculeNet and Alchemy, as well as custom user-provided CSV datasets.
Sources: examples/property_prediction/README.md:1-12, examples/README.md:16-56
Core Prediction Pipeline
The prediction process transforms raw chemical strings into property estimates through a structured data flow.
This diagram illustrates the standard data flow for molecular property prediction from input SMILES to the final prediction.
Sources: examples/property_prediction/README.md:3-9
1. Data Preparation and Analysis
Molecules are typically provided as SMILES (Simplified Molecular Input Line Entry System) strings in CSV or TXT formats. Before modeling, the toolkit provides analysis utilities to validate molecules and calculate basic descriptors.
Key analysis metrics include:
- Validity Check: Filtering out molecules that cannot be parsed by RDKit.
- Structural Statistics: Average number of atoms, bonds, and rings per molecule.
- Frequency Analysis: Distribution of atom types, bond types, and hybridization states.
Sources: examples/property_prediction/csv_data_configuration/README.md:7-36, python/dgllife/utils/analysis.py:96-140
2. Graph Construction and Featurization
Molecules are converted into DGLGraph objects. Atoms are treated as nodes, and bonds are treated as edges. Featurization is applied to capture chemical identities:
- Atom Featurizers:
CanonicalAtomFeaturizerorAttentiveFPAtomFeaturizercapture atomic number, degree, valence, and hybridization. - Bond Featurizers:
CanonicalBondFeaturizerorAttentiveFPBondFeaturizercapture bond types and stereochemistry.
Sources: examples/property_prediction/csv_data_configuration/README.md:41-86, python/dgllife/data/muv.py:27-50
Architecture and Model Zoo
DGL-LifeSci implements a variety of GNN architectures specialized for different molecular properties.
Standard Model Selection
| Model Name | Description | Use Case |
|---|---|---|
| GCN | Graph Convolutional Network followed by weighted sum/max pooling | General property prediction |
| GAT | Graph Attention Network using attention mechanisms for node updates | Task-specific feature weighting |
| Weave | Molecular graph convolutions beyond fingerprints | Physical chemistry/Biophysics |
| MPNN | Message Passing Neural Network | Quantum chemistry properties |
| AttentiveFP | Graph attention mechanism for drug discovery | Aromaticity and solubility |
| SchNet | Continuous-filter convolutional neural network | Quantum interactions |
Sources: examples/property_prediction/csv_data_configuration/README.md:65-83, examples/README.md:33-56
GCN Predictor Implementation
The GCNPredictor is a common baseline architecture. It combines a GCN encoder with a specific readout and a task-specific MLP.
The class structure of a typical GCN-based predictor illustrating the modularity between the GNN backbone and the prediction head.
Sources: python/dgllife/model/model_zoo/gcn_predictor.py:16-45
Training and Evaluation
The framework supports two primary task types: Regression (predicting real-valued properties like solubility) and Classification (predicting binary labels like toxicity).
Training Configuration
| Parameter | Default | Description |
|---|---|---|
| Split Type | scaffold | Bemis-Murcko scaffold splitting or random split |
| Split Ratio | 0.8, 0.1, 0.1 | Ratio for Training, Validation, and Test sets |
| Metric (Reg) | r2 | Evaluation metric for regression (e.g., mae, rmse) |
| Metric (Clas) | roc_auc_score | Evaluation metric for classification tasks |
| Early Stopping | Enabled | Stops training based on best validation performance |
Sources: examples/property_prediction/csv_data_configuration/README.md:92-120, examples/property_prediction/csv_data_configuration/README.md:168-190
Dataset Handling
DGL-LifeSci provides built-in loaders for standard benchmarks like ESOL (water solubility) and MUV (biological activities). These loaders handle downloading, processing, and caching graphs to disk for efficient training.
- ESOL: 1,128 compounds with measured log solubility.
- MUV: ~93,000 compounds across 17 challenging biological activity tasks.
Sources: python/dgllife/data/esol.py:25-70, python/dgllife/data/muv.py:25-55
Summary
Molecular Property Prediction in DGL-LifeSci leverages the DGLGraph structure to implement state-of-the-art GNN models. By providing standardized featurization and a rich "Model Zoo," the project enables researchers to benchmark models on MoleculeNet datasets or apply them to custom CSV-based chemical data. The inclusion of specialized splitters (like scaffold splitting) ensures that models are evaluated on their ability to generalize to novel chemical spaces.
Sources: examples/property_prediction/README.md:1-12, examples/property_prediction/csv_data_configuration/README.md:1-6