Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mRNA Translation Simulator

Physics-based evaluation of mRNA sequences using ribosome traffic modeling.

Overview

This tool treats mRNA translation as a nonequilibrium transport problem:

  1. Sequence → Energy Landscape: mRNA is coarse-grained into a 1D free-energy profile based on codon optimality and RNA secondary structure.
  2. Ribosome Dynamics: Ribosomes are modeled as driven, excluded particles (TASEP-like) with energy-dependent hopping rates.
  3. Ensemble Metrics: Translation efficiency is reported as throughput, variability, and an overall score.

Key Features

  • Unified CLI: Single run.py entry point for simulation and optimization.
  • Physics-Based Model: Absolute energy scaling allows direct comparison between different sequences.
  • Evolutionary Optimizer: Genetic algorithm to find optimal synonymous codons.
  • Neural Network Surrogate: Fast inference of local RNA structure stability (MFE) without constant RNAfold calls.
  • ViennaRNA Integration: Robust ground-truth structure prediction.

Project Structure

├── run.py                 # Unified CLI for Simulate & Optimize
├── src/
│   ├── codons.py          # Codon tables (Kazusa database) & deoptimization
│   ├── structure.py       # RNAfold wrapper for secondary structure
│   ├── landscape.py       # Energy landscape computation
│   ├── landscape_nn.py    # Neural network for MFE prediction
│   ├── simulator.py       # TASEP ribosome simulation
│   ├── analysis.py        # Ensemble analysis and metrics
│   ├── optimizer.py       # Evolutionary sequence optimization
│   ├── visualization.py   # Plotting functions
│   └── sequences.py       # Example CAR-T sequences
├── examples/
│   ├── train_model.py         # Train the MFE predictor
│   ├── compare_improved_sequences.py # Detailed CAR-T comparison
│   └── mfe_model.pt           # Pre-trained model
├── tests/
└── requirements.txt

Installation

Requirements

  • Python 3.8+
  • ViennaRNA (for RNAfold)
# Install ViennaRNA (macOS)
brew install viennarna

# Or conda
conda install -c bioconda viennarna

# Python dependencies
pip install -r requirements.txt

Usage

The project is controlled via the run.py script in the root directory.

1. Train the Model (Recommended)

Before running large simulations, train the neural network surrogate. This speeds up structure prediction significantly.

cd examples
python train_model.py
cd ..

2. Simulate a Sequence

Analyze an mRNA sequence to get its energy landscape and translation throughput.

# Analyze a raw sequence string
python run.py simulate ATGGCCCTGCCT...

# Analyze from a file
python run.py simulate --file my_sequence.txt

# Options
python run.py simulate --file seq.txt --trajectories 20 --steps 10000

3. Optimize a Sequence

Evolve a sequence to find better synonymous codons that maximize translation.

# Basic optimization
python run.py optimize --file my_sequence.txt

# Advanced options
python run.py optimize --file seq.txt --generations 50 --population 20

# Start from worst possible codons (to see max improvement)
python run.py optimize --file seq.txt --deoptimize

Output:

  • optimized_sequence.txt: The final best sequence.
  • optimization_progress.png: Fitness over generations.
  • before_after.png: Visual comparison of energy landscapes.
  • optimization_comparison.png: Detailed statistics dashboard.

4. Compare CAR-T Constructs

Run the included analysis to compare a codon-optimized CAR-CD19 sequence against a truly suboptimal version.

python examples/compare_improved_sequences.py

5. Visualize Ribosome Traffic

Generate an animated GIF showing ribosomes (colored beads) moving along the mRNA. This demonstrates stalling at energy barriers and traffic jams.

Ribosome Traffic

cd examples
python visualize_ribosomes.py

Output: examples/ribosome_traffic.gif

  • X-axis: Codon Position
  • Y-axis: Energy Barrier Height (Codon rarity + Secondary structure)
  • Top Track: Optimized sequence showing fast, laminar flow.
  • Bottom Track: Poor sequence showing stochastic stalling and pileups.

The Physics

Energy Landscape

Each codon position has an effective energy combining:

Component Source Effect
Codon optimality Kazusa database Rare codons → high energy (slow tRNA)
Local structure RNAfold / NN Stable hairpins → high energy (barrier)

Update: The model now uses absolute energy scaling. This means an optimized sequence has a genuinely lower energy profile than a suboptimal one, allowing the simulator to predict realistic throughput differences (e.g., 2-3x improvement).

Ribosome Simulation

Uses a Totally Asymmetric Simple Exclusion Process (TASEP):

5' ────────────────────────────────────── 3'
     🔵→      🔵→           🔵→
   ribosome  ribosome     ribosome
  • Initiation: Ribosomes enter at 5' end.
  • Elongation: Hopping rate depends on the energy barrier ahead.
  • Exclusion: Ribosomes occupy ~10 codons and cannot overlap.
  • Termination: Protein is produced upon exiting the 3' end.

Data Sources

License

Non-Commercial Use Only. See LICENSE file for details.

About

RNA and ribosome interaction modeling

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages