Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy Cell

This project is a small, inspectable simulation of the central dogma:

DNA gene --transcription--> messenger RNA --ribosome--> amino-acid sequence / protein

It is intentionally a molecule-count model, not a chemically complete cell. A simulation step represents completed transcription and translation events. The cell keeps track of its genome, individual mRNA molecules, ribosomes, and protein copy counts. mRNA and proteins can degrade over time.

Why Python first?

Python is the best starting point for the simulation core because it has a strong scientific ecosystem (NumPy, SciPy, JAX, PyTorch, BioPython) and makes model rules easy to inspect and change. If this becomes an interactive visual application, keep the simulation as a separate Python package or service and add a TypeScript/ JavaScript front end. If performance later becomes a bottleneck, profile first, then move only the hot loops to JAX, Rust, or C++.

Run it

No third-party packages are required.

python -m simple_cell examples/minimal_genome.fasta --steps 15 --seed 7
python -m unittest discover -s tests -v

Open the 3D visualizer

The interactive viewer is a Next.js application in visualizer/. It mirrors the Python model's update order in the browser and renders the cell with Three.js and React Three Fiber.

cd visualizer
npm install
npm run dev

Then open http://localhost:3000. Use Play, Pause, Step, and Reset to control time; drag the cell to orbit and scroll to zoom.

Each FASTA record is treated as one already-annotated protein-coding gene. For example:

>green_gene
ATGAAACCCGGGTTTTAA

The coding DNA must start with ATG, end with an in-frame stop codon (TAA, TAG, or TGA), and contain only A, C, G, and T.

Useful options:

python -m simple_cell --help
python -m simple_cell examples/minimal_genome.fasta \
  --steps 50 --ribosomes 20 --transcription-rate 0.8

What the model currently means

  • transcription_rate: expected completed mRNA copies per gene per unit time
  • translation_rate: expected completed proteins per ribosome per unit time
  • ribosomes: a shared translation-capacity limit across all mRNAs
  • half-lives: stochastic degradation of individual mRNA and protein molecules

This is useful for learning and for establishing the software architecture. It does not yet model promoters, transcription factors, introns, alternative splicing, tRNA abundance, protein folding, metabolism, membranes, cell division, or spatial chemistry.

A path from one cell to tissues

  1. Add gene regulation, metabolites, ATP/resource costs, and feedback loops.
  2. Give each cell a stable step(dt, environment) interface.
  3. Place many cells on a 2D or 3D grid with nutrient and signal diffusion.
  4. Add division, death, differentiation, adhesion, and simple mechanics.
  5. Validate each layer against known behavior before increasing scale.
  6. Connect a learned world model to predict, control, or accelerate the simulator; keep the mechanistic state and rules as a testable ground truth.

The most important scaling rule is to keep biology, simulation scheduling, and visualization separate. That lets the same Python cell run in a terminal today, inside a tissue simulator later, and behind a browser UI eventually.

About

A minimal central-dogma cell simulation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages