Skip to content

ziad0nassif/stemcell-pinns-solver

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿงฌ Stem Cell Differentiation: Numerical vs Machine Learning Approaches

Project Banner Python PyTorch R

Modeling Gene Regulatory Networks in Hematopoietic Stem Cell Fate Decisions

Comparing Classical Numerical Solvers with Physics-Informed Neural Networks

๐Ÿ“˜Report โ€ข ๐Ÿ“˜ Extended Report โ€ข ๐Ÿš€ Quick Start โ€ข ๐Ÿ“Š Results โ€ข ๐Ÿค Contributing


๐ŸŽฏ Project Overview

This repository investigates stem cell differentiation through the lens of computational modeling, specifically focusing on the PU.1-GATA-1 toggle switch that controls blood cell fate decisions. We compare traditional numerical methods with modern machine learning approaches to solve complex biological ODEs.

๐Ÿ”ฌ The Biological Question

How do stem cells make irreversible fate decisions? We model the mutual inhibition between transcription factors PU.1 (myeloid commitment) and GATA-1 (erythroid commitment) that determines whether a hematopoietic stem cell becomes a white or red blood cell.

๐Ÿงฎ The Mathematical Challenge

dG/dt = aโ‚‚Pยฒ/(1+Pยฒ) - G     (GATA-1 dynamics)
dP/dt = aโ‚Gยฒ/(1+Gยฒ) - P     (PU.1 dynamics)

A bistable system with nonlinear mutual inhibition

๐Ÿค– The Computational Approach

  • Classical Methods: LSODA, Radau, Trapezoidal Rule
  • Modern ML: Physics-Informed Neural Networks (PINNs)
  • Benchmark Analysis: 13 visualizations, 9 performance tables

โœจ Key Features

๐ŸŽฏ Biological Relevance

  • Real hematopoietic stem cell model
  • Clinically relevant to leukemia research
  • Parameters based on experimental data
  • Bistable dynamics reproduction

๐Ÿ”ง Technical Excellence

  • 4 different numerical solvers
  • PyTorch-based PINN implementation
  • Comprehensive benchmarking suite
  • Reproducible scientific workflow

๐Ÿ“Š Rich Analytics

  • 13 comparative visualizations
  • Multiple accuracy metrics (MSE, Rยฒ, MAPE)
  • Performance profiling & timing
  • Statistical significance testing

๐Ÿš€ Production Ready

  • Modular, reusable code architecture
  • Extensive documentation
  • Cross-platform compatibility
  • Easy parameter customization

๐Ÿ“‚ Repository Structure

๐Ÿ“ฆ stem-cell-pinns-project/
โ”‚
โ”œโ”€โ”€ ๐Ÿ”ฌ notebooks and codes/           # Core implementations
โ”‚   โ”œโ”€โ”€ ๐Ÿ LSODA.py                  # Adaptive step-size solver
โ”‚   โ”œโ”€โ”€ ๐Ÿ“Š LSODES.r                  # R-based implementation  
โ”‚   โ”œโ”€โ”€ ๐Ÿค– PINNS.ipynb               # Neural network training
โ”‚   โ”œโ”€โ”€ โš–๏ธ  PINNS_VS_Numerical.ipynb # Method comparison
โ”‚   โ”œโ”€โ”€ ๐Ÿ”ข Radau.py                  # Implicit Runge-Kutta
โ”‚   โ””โ”€โ”€ ๐Ÿ“ Trapzoidal.py             # Classical explicit method
โ”‚
โ”œโ”€โ”€ ๐Ÿ“š report/                        # Project documentation
โ”‚   โ”œโ”€โ”€ ๐ŸŽค presentation/             # Slides and visuals for presentation
โ”‚   โ”‚   โ”œโ”€โ”€ Course_Project_Presentation.pdf   # Project presentation (PDF)
โ”‚   โ”‚   โ””โ”€โ”€ Course_Project_Presentation.pptx  # Project presentation (PowerPoint)
โ”‚   โ”œโ”€โ”€ ๐Ÿ“– Full_Extended_version.md   # Complete analysis (pages)
โ”‚   โ”œโ”€โ”€ ๐Ÿ“– Numerical_Report_Team_4.pdf   # Main report (4 pages)
โ”‚   โ””โ”€โ”€ ๐Ÿ“– Numerical_Report_Team_4(Latex_Version).tex   # Main report (Latex-Code)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š results/                       # Generated visualizations
โ”‚   โ”œโ”€โ”€ ๐Ÿ”„ both/                     # Cross-method comparisons
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ˆ case1/                    # Symmetric scenario (aโ‚=aโ‚‚=1)
โ”‚   โ””โ”€โ”€ ๐Ÿ“‰ case2/                    # Asymmetric scenario (aโ‚=5,aโ‚‚=10)
โ”‚
โ””โ”€โ”€ ๐Ÿ“‹ README.md                      # This file

๐Ÿš€ Quick Start

1๏ธโƒฃ Environment Setup

# Clone repository
git clone https://github.com/SiefEldinSameh/stem-cell-pinns-project.git
cd stem-cell-pinns-project

# Install dependencies
pip install -r requirements.txt

# Optional: R dependencies
Rscript -e "install.packages(c('deSolve', 'ggplot2', 'dplyr'))"

2๏ธโƒฃ Run Numerical Simulations

# Individual solver execution
python "notebooks and codes/LSODA.py"      # Fastest, adaptive
python "notebooks and codes/Radau.py"      # Most accurate
python "notebooks and codes/Trapzoidal.py" # Educational baseline

3๏ธโƒฃ Train Neural Networks

# Launch PINN training interface
jupyter notebook "notebooks and codes/PINNS.ipynb"

4๏ธโƒฃ Compare Methods

# Comprehensive benchmarking
jupyter notebook "notebooks and codes/PINNS_VS_Numerical.ipynb"

5๏ธโƒฃ View Results

Results automatically save to results/ with organized subdirectories:

  • case1/ โ†’ Symmetric parameter analysis
  • case2/ โ†’ Asymmetric parameter analysis
  • both/ โ†’ Cross-method comparisons

๐Ÿ“Š Key Results

๐Ÿ† Performance Leaderboard

Method Accuracy Speed Stiffness Best Use Case
๐Ÿฅ‡ Radau โญโญโญโญโญ โญโญโญ โญโญโญโญโญ High-precision requirements
๐Ÿฅˆ LSODA โญโญโญโญโญ โญโญโญโญโญ โญโญโญโญ General-purpose solver
๐Ÿฅ‰ Trapezoidal โญโญโญโญ โญโญโญโญ โญโญ Educational/simple cases
๐Ÿค– PINN โญโญโญโญ โญโญ*โญโญโญ โญโญโญ Data integration/real-time

*Slow training, fast inference

๐Ÿ“ˆ Quantitative Metrics

๐Ÿ“Š Case 1: Symmetric Parameters (aโ‚=1, aโ‚‚=1)
Method MSE (GATA-1) MSE (PU.1) Rยฒ Score Training Time
Radau 2.74ร—10โปยนโด 2.74ร—10โปยนโด 1.0000 0.052s
LSODA 1.20ร—10โปยนยณ 1.20ร—10โปยนยณ 1.0000 0.002s
Trapezoidal 8.00ร—10โปยนโด 8.00ร—10โปยนโด 1.0000 0.004s
PINN 7.26ร—10โปยนโฐ 9.24ร—10โปยนโฐ 0.9997 197.7s
๐Ÿ“Š Case 2: Asymmetric Parameters (aโ‚=5, aโ‚‚=10)
Method MSE (GATA-1) MSE (PU.1) Rยฒ Score Training Time
Radau 2.32ร—10โปยนโด 1.29ร—10โปยนยณ 1.0000 0.052s
LSODA 1.45ร—10โปยนยณ 2.10ร—10โปยนยณ 1.0000 0.003s
Trapezoidal 1.14ร—10โปโธ 4.10ร—10โปโท 1.0000 0.006s
PINN 4.70ร—10โปโธ 5.90ร—10โปโท 1.0000 370.6s

๐ŸŽฏ Method Recommendations

graph TD
    A[Choose Your Method] --> B{Primary Goal?}
    B -->|Maximum Accuracy| C[๐ŸŽฏ Radau Method]
    B -->|Fastest Results| D[โšก LSODA Solver]
    B -->|Learning/Teaching| E[๐Ÿ“š Trapezoidal Rule]
    B -->|Data Integration| F[๐Ÿค– PINN Approach]
    
    C --> C1[Machine precision<br/>Stiff systems<br/>Critical applications]
    D --> D1[General purpose<br/>Fast prototyping<br/>Parameter sweeps]
    E --> E1[Educational use<br/>Simple systems<br/>Method comparison]
    F --> F2[Experimental data<br/>Real-time inference<br/>Parameter uncertainty]
    
    style A fill:#e1f5fe
    style C fill:#c8e6c9
    style D fill:#fff3e0
    style E fill:#f3e5f5
    style F fill:#ffebee
Loading

๐Ÿ”ฌ Biological Insights

๐Ÿงฌ The PU.1-GATA-1 Toggle Switch

    Hematopoietic Stem Cell
           โ”‚
           โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   Bistable      โ”‚
    โ”‚  Toggle Switch  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚     โ”‚
          โ–ผ     โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  PU.1โ†‘  โ”‚ โ”‚ GATA-1โ†‘ โ”‚
    โ”‚ GATA-1โ†“ โ”‚ โ”‚  PU.1โ†“  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
          โ”‚           โ”‚
          โ–ผ           โ–ผ
    Myeloid Cells   Erythroid Cells
   (White Blood)    (Red Blood)

๐Ÿ“Š Clinical Relevance

Disease Disrupted Factor Computational Insight
Acute Myeloid Leukemia PU.1 overexpression Asymmetric parameter analysis
Polycythemia Vera GATA-1 amplification Bistability breakdown modeling
Aplastic Anemia Both factors reduced System stability analysis

๐ŸŽฏ Model Predictions

  • Commitment Time: 1.2-2.5 hours (parameter dependent)
  • Switch Sensitivity: Higher in asymmetric cases
  • Therapeutic Targets: Transcription factor balance restoration

๐ŸŽจ 13 Comprehensive Visualizations


๐Ÿ”ด GATA-1 Dynamics
Time evolution comparison

๐Ÿ”ต PU.1 Dynamics
Transcription factor trajectories

๐Ÿ“Š MSE Analysis
Method accuracy comparison

โฑ๏ธ Performance Timing
Computational efficiency

๐Ÿ“ˆ Rยฒ Correlation
Goodness of fit analysis

๐ŸŽฏ MAPE Errors
Relative accuracy metrics

๐Ÿ”„ Phase Portraits
System dynamics visualization

๐Ÿค– PINN Training
Neural network convergence

โšก Speedup Analysis
Performance benchmarking

๐Ÿ’ก All plots are available in the results/ directory in publication-ready quality


๐Ÿ”ง Technical Specifications

๐Ÿ’ป System Requirements

Minimum Configuration

  • ๐Ÿ–ฅ๏ธ 4GB RAM
  • โšก 2-core CPU
  • ๐Ÿ’พ 500MB storage
  • ๐Ÿ Python 3.8+

Recommended Setup

  • ๐Ÿ–ฅ๏ธ 8GB+ RAM
  • โšก 4+ core CPU
  • ๐ŸŽฎ GPU (CUDA compatible)
  • ๐Ÿ’พ 1GB+ storage

๐Ÿ“ฆ Dependencies

# Core Scientific Computing
numpy >= 1.21.0      # Numerical operations
scipy >= 1.7.0       # Scientific algorithms  
matplotlib >= 3.5.0  # Visualization
pandas >= 1.3.0      # Data manipulation

# Machine Learning
torch >= 1.11.0      # Neural networks
torchvision >= 0.12.0 # Vision utilities

# Interactive Computing
jupyter >= 1.0.0     # Notebook environment
ipykernel >= 6.0.0   # Jupyter kernel

โšก Performance Optimization

  • GPU Acceleration: Enable CUDA for PINN training
  • Vectorization: Batch operations for inference
  • Parallel Computing: Multi-core parameter sweeps
  • Memory Management: Efficient tensor operations

๐ŸŽ“ Educational Value

๐Ÿ‘จโ€๐ŸŽ“ Learning Objectives

  • Systems Biology: Gene regulatory network modeling
  • Numerical Methods: ODE solver comparison and selection
  • Machine Learning: Physics-informed neural networks
  • Scientific Computing: Benchmarking and validation

๐Ÿ“š Pedagogical Features

  • Step-by-step Implementation: Well-commented code
  • Mathematical Derivations: Complete in extended report
  • Biological Context: Real-world relevance
  • Comparative Analysis: Method trade-offs discussion

๐Ÿ”ฌ Research Applications

  • Method Development: Template for new solver comparison
  • Biological Modeling: Extensible to other toggle switches
  • Parameter Studies: Systematic exploration framework
  • Clinical Translation: Disease modeling foundation

๐Ÿค Contributing

๐ŸŒŸ How to Contribute

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/amazing-solver)
  3. ๐Ÿ“ Commit your changes (git commit -m 'Add amazing solver')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/amazing-solver)
  5. ๐Ÿ”€ Open a Pull Request

๐Ÿ› Reporting Issues

  • Use GitHub Issues for bug reports
  • Include system information and error traces
  • Provide minimal reproducible examples
  • Tag with appropriate labels (bug/enhancement/question)

๐ŸŽฏ Areas for Contribution

  • New Solvers: Additional numerical methods
  • Biological Models: Other gene regulatory networks
  • Visualizations: Enhanced plotting and analysis
  • Documentation: Improved explanations and examples
  • Performance: Optimization and profiling
  • Testing: Unit tests and validation suites

๐Ÿ“š References & Further Reading

๐Ÿ”ฌ Key Scientific Papers

Foundational Biology
  • Chickarmane et al. (2006) - "Transcriptional dynamics of the embryonic stem cell switch" - Computational modeling of PU.1-GATA-1 system
  • Orkin & Zon (2008) - "Hematopoiesis: an evolving paradigm for stem cell biology" - Nature Reviews Genetics
  • Enver et al. (2009) - "Stem cell states, fates, and the rules of attraction" - Cell Stem Cell
Computational Methods
  • Raissi et al. (2019) - "Physics-informed neural networks: A deep learning framework for solving forward and inverse problems" - Journal of Computational Physics
  • Hairer & Wanner (1996) - "Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems" - Springer
  • Shampine & Gear (1979) - "A user's view of solving stiff ordinary differential equations" - SIAM Review
Systems Biology
  • Alon (2006) - "An Introduction to Systems Biology: Design Principles of Biological Circuits" - CRC Press
  • Davidson (2010) - "Emerging properties of animal gene regulatory networks" - Nature
  • Elowitz & Leibler (2000) - "A synthetic oscillatory network of transcriptional regulators" - Nature

๐ŸŒ Useful Resources


๐Ÿ“„ License & Citation

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ Citation

If you use this work in your research, please cite:

@software{stem_cell_pinns_2024,
  title={Stem Cell Differentiation: Numerical and Machine Learning Approaches},
  author={[Your Name]},
  year={2024},
  url={https://github.com/SiefEldinSameh/stem-cell-pinns-project},
  note={Computational modeling of PU.1-GATA-1 toggle switch}
}

๐Ÿ™ Acknowledgements

๐Ÿ”ฌ Scientific Foundation

Built upon decades of research in systems biology and hematopoietic development

๐Ÿงฎ Computational Infrastructure

Powered by the scientific Python ecosystem and PyTorch framework

๐ŸŒ Open Science Community

Inspired by principles of reproducible research and collaborative science


This project bridges computational biology, numerical analysis, and machine learning to understand fundamental processes in stem cell biology. We hope it serves as both a research tool and educational resource for the scientific community.

โญ Star this repository if you find it useful for your research or learning!

About

Physics-Informed Neural Network (PINN) model for simulating stem cell dynamics governed by PDEs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 93.1%
  • Python 3.9%
  • TeX 2.7%
  • R 0.3%