MorphGen is a generative model designed for fluorescent microscopy, enabling controllable and biologically consistent image generation across various cell types and perturbations. By leveraging a diffusion-based approach and aligning with phenotypic embeddings from OpenPhenom, MorphGen preserves detailed organelle-specific structures across multiple fluorescent channels. This capability supports fine-grained morphological analysis, advancing applications in drug discovery and gene editing.
-
Create a virtual environment:
uv venv
-
Activate the virtual environment:
source .venv/bin/activate -
Install dependencies:
uv pip install -e .
To train the model, run the train.py script using accelerate. You can specify the number of processes with the --num-processes flag. The training configuration can be modified in the files under sc_perturb/cfgs/ or overridden via the command line.
# Example training command with 8 processes
accelerate launch --num-processes=8 sc_perturb/train.pyFor Out-of-Distribution (OOD) training, you can use the train_ood.py script:
# Example OOD training command with 8 processes
accelerate launch --num-processes=8 sc_perturb/train_ood.pyThe evaluation scripts are located in the sc_perturb/evaluation/ directory. These scripts can be run to generate qualitative and quantitative results.
For example, to perform qualitative analysis and generate PCA plots, you can run the qualitative_analysis_ophenom_with_manual_generation.py script. You will need to set the MANUAL_GENERATION flag to True and provide the path to your trained model checkpoint.
# Example evaluation command
python sc_perturb/evaluation/qualitative/qualitative_analysis_ophenom_with_manual_generation.pyMake sure to modify the script to point to your model checkpoint and set other parameters as needed.
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].
If you believe you have found a security issue, please responsibly disclose by contacting us at [email protected].
If you find this work useful, please consider citing our paper:
@article{demirel2025morphgen,
title={MorphGen: Controllable and Morphologically Plausible Generative Cell-Imaging},
author={Demirel, Berker and Fumero, Marco and Karaletsos, Theofanis and Locatello, Francesco},
journal={arXiv preprint arXiv:2510.01298},
year={2025}
}