Study-aligned synthetic controls from time-matched treatment data for preclinical toxicology using generative AI
Quick Start β’ Workflow & Scripts β’ Methods β’ Data & Outputs β’ Citation
GanCtrl generates time-matched synthetic control profiles from treatment-derived clinical pathology data.
GanCtrl (GAN-based synthetic control) is a conditional VAE-GAN framework that translates high-dose treatment-derived clinical-pathology profiles into their time-matched control equivalents.
Developed using the Open TG-GATEs rat in vivo repeat-dose dataset, GanCtrl models 38 clinical pathology measurements using a context-conditioned encoder, an attention-aware biologically informed decoder, and an adversarial discriminator.
The framework is designed to generate physiologically coherent synthetic controls while preserving biologically relevant relationships required for downstream toxicological evaluation.
| Model | Conditional VAE-GAN |
| Input | High-dose treatment clinical-pathology profiles |
| Output | Time-matched synthetic control profiles |
| Dataset | Open TG-GATEs rat in vivo repeat-dose studies |
| Measurements | 38 clinical pathology endpoints |
| Conditioning | Body weight, timepoint, replicate identity, study-specific clusters |
| Evaluation | Cosine similarity, RMSE, biological co-elevation, toxicity concordance |
| Benchmarks | Inter-laboratory, intra-laboratory, replicate control, VCG, VCG-LR |
git clone https://github.com/CHANDMX20/GanCtrl.git
cd GanCtrlThe preprocessed training and held-out test datasets used by GanCtrl are available through Zenodo:
Configure the required input and output paths in the relevant scripts for your local environment.
| Goal | Start from |
|---|---|
| Train GanCtrl from the beginning | Preprocessed Zenodo inputs |
| Generate synthetic controls | Trained GanCtrl checkpoints |
| Reproduce downstream analyses only | Generated predictions included in data/ |
All scripts required for these workflows are listed below.
Open TG-GATEs
β
βΌ
Preprocessed Inputs
β
βΌ
GanCtrl Training
β
βΌ
Synthetic Controls
β
βββββββββββββββββ¬ββββββββββββββββββ
βΌ βΌ βΌ
Agreement Biological Toxicity
Evaluation Co-elevation Concordance
β
βΌ
VCG / VCG-LR
Benchmark
Scripts can be executed with
python <script-path>after configuring the required local input/output paths.
| Stage | Analysis | Script(s) |
|---|---|---|
| 1 | GanCtrl training | training/ganctrl_training.py |
| 2 | Synthetic-control generation | training/train_test_samples.py |
| 3A | Inter-laboratory agreement | interlab_cosine.py Β· interlab_rmse.py |
| 3B | Intra-laboratory agreement | intralab_cosine.py Β· intralab_rmse.py |
| 3C | Replicate-control agreement | replicate_control_cosine.py Β· replicate_control_rmse.py |
| 3D | GanCtrl vs real-control agreement | cosine.py Β· rmse.py |
| 4 | Biological co-elevation | co-elevation.py |
| 5A | Concordance threshold calibration | train_concordance.py |
| 5B | Held-out toxicity concordance | test_concordance.py |
| 6A | VCG benchmark | vcg_baseline.py |
| 6B | Laboratory-relaxed VCG | vcg-lr_baseline.py |
Expand the sections below for methodological details.
π§ GanCtrl architecture and training
GanCtrl is a one-sided conditional VAE-GAN trained to map high-dose treatment clinical-pathology profiles to their time-matched control equivalents.
- Body weight
- Timepoint
- Replicate identity
- Study-specific clusters
- Variance-aware Gaussian negative log likelihood
- Adversarial loss
- TBIL range-constraint loss
- Biological correlation-preservation loss
- Batch-level mean matching
These components are designed to preserve organ-level biological relationships and realistic variability while generating physiologically coherent synthetic-control profiles.
The implementation uses fixed random seeds and deterministic TensorFlow operations to support reproducibility.
π Synthetic vs real-control agreement
Generated synthetic controls are compared with corresponding real controls using:
- Cosine similarity
- Root mean squared error (RMSE)
GanCtrl is interpreted relative to three real-control benchmarks:
Cross-study real-control agreement using the same vehicle across different laboratories.
Within-study real-control agreement using the same vehicle and laboratory.
Agreement between biological replicates within a treatment, providing a benchmark for real biological variability.
Agreement between each generated synthetic-control profile and its corresponding real-control profile.
𧬠Biological co-elevation analysis
GanCtrl is evaluated for its ability to preserve literature-anchored hepatotoxicity and nephrotoxicity biological conclusions.
Treatment-associated measurement elevations are identified using:
- One-sided Welch t-tests
- Benjamini-Hochberg false discovery rate correction
- ALTβAST
- ALPβTBIL
- ALPβGGT/GTP
- ALTβASTβLDH
- BUNβCRE
Agreement between real- and synthetic-control conclusions is evaluated using:
| Metric | Definition |
|---|---|
| Recall | Fraction of real-control co-elevations also detected using synthetic controls |
| Specificity | Fraction of real-control non-elevations remaining non-elevated using synthetic controls |
| Balanced Accuracy | Mean of recall and specificity |
π§ͺ Toxicity concordance
The concordance analysis evaluates whether synthetic controls reproduce the sample-level abnormal/normal classifications obtained using real concurrent controls.
For each compound-time group and clinical pathology measurement:
The decision threshold is:
- Calibrated using the training set
- Fixed before evaluation
- Applied to the independent held-out test set
Synthetic-control classifications are compared with real-control classifications using:
-
True positives (TP)
-
True negatives (TN)
-
False positives (FP)
-
False negatives (FN)
$\text{Concordance Accuracy} = \dfrac{TP + TN}{TP + TN + FP + FN}$
Primary question: If the concurrent control arm is replaced with GanCtrl-generated synthetic controls, are the same toxicological conclusions reached?
π Historical-control VCG benchmark
GanCtrl is benchmarked against virtual control groups (VCGs) constructed from historical control data.
Historical controls are drawn from training-set concurrent controls. Controls originating from the same compound as the test group are excluded to prevent information leakage.
Matched on:
- Sacrifice time
- Vehicle
- Laboratory
Matched on:
- Sacrifice time
- Vehicle
while allowing controls from different laboratories.
For each test group:
- The VCG contains the same number of animals as the corresponding real concurrent control group.
- Sampling is repeated 100 times using independent draws from the eligible historical-control pool.
All GanCtrl data-related information is consolidated in this section.
GanCtrl was developed using rat in vivo repeat-dose clinical pathology data from Open TG-GATEs.
The raw Open TG-GATEs data are not redistributed through this repository.
The exact preprocessed training and held-out test inputs used by GanCtrl are distributed through Zenodo because of their size.
The deposit contains treatment/control inputs, metadata, and molecular descriptor features required by the model.
π Show principal input files
repeat_train_treatment_2d.csv
repeat_train_control_2d.csv
repeat_test_treatment_2d.csv
repeat_test_control_2d.csv
Generated decoded synthetic-control predictions are included in data/, allowing downstream analyses to be reproduced without retraining GanCtrl.
π Show prediction files
| File | Description |
|---|---|
generated_liver_train.csv |
Liver synthetic controls β training set |
generated_liver_test.csv |
Liver synthetic controls β held-out test set |
generated_kidney_train.csv |
Kidney synthetic controls β training set |
generated_kidney_test.csv |
Kidney synthetic controls β held-out test set |
generated_predictions_merged_train.csv |
Combined liver + kidney predictions for training-set analyses |
generated_predictions_merged_test.csv |
Combined liver + kidney predictions for held-out test analyses |
πΎ Show model and inference outputs
Depending on the training and inference configuration:
g_model1_*.h5
d_model1_*.h5
composite_model1_*.h5
predictions_encoded/
predictions_decoded/
samples/generated_samples_s{K}_*.csv
| Output | Description |
|---|---|
g_model1_*.h5 |
Generator checkpoints |
d_model1_*.h5 |
Discriminator checkpoints |
composite_model1_*.h5 |
Composite-model checkpoints |
predictions_encoded/ |
Encoded-space predictions, if enabled |
predictions_decoded/ |
Fully decoded synthetic-control predictions |
π¬ Show clinical pathology variables
GanCtrl evaluates 38 clinical pathology measurements spanning clinical chemistry and hematology.
COMPOUND_NAME
DOSE_LEVEL
SACRIFICE_PERIOD
INDIVIDUAL_ID
| Abbreviation | Measurement |
|---|---|
| ALP | Alkaline phosphatase |
| ALT | Alanine aminotransferase |
| AST | Aspartate aminotransferase |
| GTP/GGT | Gamma-glutamyl transferase |
| LDH | Lactate dehydrogenase |
| TBIL | Total bilirubin |
| DBIL | Direct bilirubin |
| Abbreviation | Measurement |
|---|---|
| BUN | Blood urea nitrogen |
| CRE | Creatinine |
| Ca | Calcium |
| Cl | Chloride |
| Na | Sodium |
| IP | Inorganic phosphorus |
| K | Potassium |
π Show repository structure
GanCtrl/
β
βββ training/ # Model training and synthetic-control generation
βββ evaluation/ # Agreement and toxicological analyses
βββ baseline/ # Real-control agreement benchmarks
βββ vcg/ # Historical-control benchmarks
βββ data/ # Generated synthetic-control predictions
βββ plots/ # Study-design and supporting figures
βββ README.md
βββ LICENSE
Individual scripts are listed in the Workflow & Scripts section.
| Software | Version |
|---|---|
| Python | 3.11.7 |
| TensorFlow-GPU | 2.4.1 |
| R | 4.4.1 |
| Bioconductor | 3.19 |
Additional Python and R dependencies are imported within the corresponding analysis scripts.
GanCtrl supports two reproducibility paths.
|
|
The repository uses fixed random seeds, deterministic TensorFlow operations, explicit training/test splits, publicly available input data, and provided synthetic-control predictions to support reproducibility.
If you use GanCtrl in your research, please cite the associated paper and dataset.
GanCtrl: A Generative AI Approach to Derive Study-Aligned Synthetic Controls for Reducing Concurrent Control Animal Use. Toxicological Sciences. https://doi.org/10.1093/toxsci/kfag099
Chandra, M. GanCtrl: Synthetic Control Predictions for Liver and Kidney Clinical-Pathology Profiles (Open TG-GATEs). Zenodo. https://doi.org/10.5281/zenodo.17883691
This project is licensed under the MIT License.
See the LICENSE file for details.
GanCtrl
Generative AI for study-aligned synthetic controls in preclinical toxicology
