Skip to content

Latest commit

Β 

History

223 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GanCtrl

Study-aligned synthetic controls from time-matched treatment data for preclinical toxicology using generative AI

Paper DOI Data DOI License: MIT Python 3.11.7

Quick Start β€’ Workflow & Scripts β€’ Methods β€’ Data & Outputs β€’ Citation


GanCtrl study design and architecture

GanCtrl generates time-matched synthetic control profiles from treatment-derived clinical pathology data.


Overview

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.


GanCtrl at a Glance

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

Quick Start

1. Clone GanCtrl

git clone https://github.com/CHANDMX20/GanCtrl.git
cd GanCtrl

2. Obtain the input data

The 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.

3. Choose a reproducibility path

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.


Workflow & Scripts

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

Methods

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.

Conditioning variables

  • Body weight
  • Timepoint
  • Replicate identity
  • Study-specific clusters

Training objectives

  • 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:

Inter-laboratory

Cross-study real-control agreement using the same vehicle across different laboratories.

Intra-laboratory

Within-study real-control agreement using the same vehicle and laboratory.

Replicate control

Agreement between biological replicates within a treatment, providing a benchmark for real biological variability.

GanCtrl

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

Coordinated liver responses

  • ALT–AST
  • ALP–TBIL
  • ALP–GGT/GTP
  • ALT–AST–LDH

Coordinated kidney response

  • 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:

$z = \dfrac{x_{\text{treatment}} - \mu_{\text{control}}}{\sigma_{\text{control}}}$

The decision threshold is:

  1. Calibrated using the training set
  2. Fixed before evaluation
  3. 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.

VCG

Matched on:

  • Sacrifice time
  • Vehicle
  • Laboratory

VCG-LR

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.

Data & Outputs

All GanCtrl data-related information is consolidated in this section.

Raw Open TG-GATEs Data

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.

Open TG-GATEs Download Page


Preprocessed GanCtrl Inputs

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 Synthetic Controls

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.

Key metadata

COMPOUND_NAME
DOSE_LEVEL
SACRIFICE_PERIOD
INDIVIDUAL_ID

Liver-associated measurements

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

Kidney-associated measurements

Abbreviation Measurement
BUN Blood urea nitrogen
CRE Creatinine
Ca Calcium
Cl Chloride
Na Sodium
IP Inorganic phosphorus
K Potassium

Repository Organization

πŸ“ 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.


Environment

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.


Reproducibility

GanCtrl supports two reproducibility paths.

Full reproduction

Zenodo Inputs
      ↓
Train GanCtrl
      ↓
Generate Synthetic Controls
      ↓
Run Evaluation Pipeline

Downstream reproduction

Provided Predictions
      ↓
Agreement Analysis
      ↓
Biological Evaluation
      ↓
Toxicity Evaluation

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.


Citation

If you use GanCtrl in your research, please cite the associated paper and dataset.

GanCtrl Paper

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

GanCtrl Dataset

Chandra, M. GanCtrl: Synthetic Control Predictions for Liver and Kidney Clinical-Pathology Profiles (Open TG-GATEs). Zenodo. https://doi.org/10.5281/zenodo.17883691


License

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

About

Generative AI approach for generating synthetic controls from time-matched treatment data

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages