Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CZI AI Residency (Francesco Locatello) project on MorphGen: Generative Modeling for Morphologically Faithful and Generalizable Cell Painting Representations

License

Notifications You must be signed in to change notification settings

czi-ai/MorphGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MorphGen

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.

Getting Started

Prerequisites

Installation

  1. Create a virtual environment:

    uv venv
  2. Activate the virtual environment:

    source .venv/bin/activate
  3. Install dependencies:

    uv pip install -e .

Usage

Training

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

For 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.py

Evaluation

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

Make sure to modify the script to point to your model checkpoint and set other parameters as needed.

Code of Conduct

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

Reporting Security Issues

If you believe you have found a security issue, please responsibly disclose by contacting us at [email protected].

Citation

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}
}

About

CZI AI Residency (Francesco Locatello) project on MorphGen: Generative Modeling for Morphologically Faithful and Generalizable Cell Painting Representations

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages