How alexarnimueller/smiles_generator works
Project Type and Purpose
• This is a Python-based command-line generative AI tool for de novo molecular design.
• It ingests molecular SMILES data, trains an LSTM-based RNN (via TensorFlow 1.14) to learn SMILES syntax, then samples new molecules and analyzes them using RDKit (and optionally FCD).
Main Architectural Components
a. Data Layer
• Raw SMILES datasets (data/*.csv)
• Generated SMILES (generated/*.csv)
b. Preprocessing Module
• preprocess.py: tokenizes & cleans SMILES
• descriptors.py: computes molecular descriptors (via RDKit)
c. Model Definition
• model.py: defines the LSTM RNN architecture and loss/optimizer
d. Training Pipelines
• train.py: standard training loop, checkpoint saving
• finetune.py: transfer-learning on new datasets
e. Sampling Module
• sample.py: loads a checkpoint, generates new SMILES strings at configurable temperature/fragments
• generator.py: core sampling routines
f. Analysis Module
• .py: computes fingerprint metrics (e.g., ECFP4 similarity) and optional FCD scores
• plotting.py: visualization of distributions and metrics
g. Utilities
• utils.py: shared helper functions (file I/O, logging, seed management)
Relationships and Data Flow
1) User provides raw SMILES CSV → preprocess.py cleans & encodes → descriptors.py (optional descriptor features)
2) Encoded data → train.py / finetune.py → model.py defines network → checkpoints stored on disk
3) Upon completion, sample.py (invoking generator.py) loads checkpoint → produces generated SMILES CSV
4) .py reads generated SMILES + reference data → computes metrics → plotting.py for graphs
Key Architectural Patterns and Technologies
• Pipeline pattern: modular CLI scripts connected in sequence
• Checkpoint–based persistence: model artifacts on file system
• Dependency injection of hyperparameters via argparse
• External libraries:
• TensorFlow 1.14 for RNN training
• RDKit for chemistry operations
• Optional FCD library for generative model evaluation