TASEP Models: Cotranslational Folding Simulation Library
Current Version: 0.1.0
Author: Luis U. Aguilera
License: BSD-3-Clause
TASEP Models is a robust Python library for simulating ribosome traffic and translation dynamics. It provides high-performance Stochastic Simulation Algorithms (SSA) via Numba and deterministic Ordinary Differential Equation (ODE) solvers to model the Totally Asymmetric Simple Exclusion Process (TASEP).
Features
- High-Performance Simulation: Numba-accelerated Gillespie SSA for accurate stochastic modeling of ribosome movement.
- Deterministic Solvers: Fast ODE approximations for mean-field behavior.
- Sequence Analysis: Tools to calculate Codon Adaptation Index (CAI) and map codon usage to elongation rates using human genome data.
- Optimization Tools: Functions to
optimize_sequence()ordeoptimize_sequence()coding sequences for translation efficiency. - Synthesis Complexity Analysis: Detect potential DNA synthesis difficulties including repetitive sequences, homopolymers, extreme GC content, and hairpin structures.
- Visualization: Built-in plotting for trajectories, kymographs, and dual-channel fluorescence signals (e.g., SunTag, MoonTag).
- Self-Healing Data: Automatically downloads required human genome CDS data from Ensembl when needed.
Installation
Quick Install (Recommended)
Install directly from PyPI:
pip install tasep-models
Development Installation
For development or to access example notebooks:
-
Clone the repository:
git clone https://github.com/your-username/tasep_models.git cd tasep_models
-
Create conda environment (optional but recommended):
conda env create -f environment.yml conda activate tasep_models
-
Install in editable mode:
pip install -e .
Dependencies
The following packages are required (automatically installed):
| Package | Version | Purpose |
|---|---|---|
| numpy | 1.26.4 | Numerical computing |
| pandas | 2.2.2 | Data manipulation |
| scipy | 1.13.1 | Scientific computing |
| matplotlib | 3.9.2 | Visualization |
| numba | 0.60.0 | JIT compilation |
| llvmlite | 0.43.0 | LLVM bindings for numba |
| biopython | ≥1.81 | Sequence parsing |
| joblib | ≥1.3 | Parallel processing |
| dna-features-viewer | ≥3.1 | Plasmid visualization |
| snapgene-reader | ≥0.1 | Reading .dna files |
Quick Start
Here is a complete example of running a comparative simulation (SSA vs ODE) for a hypothetical gene.
import numpy as np
import tasep_models as tm
# 1. Define Parameters
gene_length = 300 # Length in codons
ki = 0.05 # Initiation rate (1/s)
ke = 10.0 # Elongation rate (codons/s)
t_max = 600 # Simulation time (s)
# 2. Define Probe Positions (e.g., for SunTag signal simulation)
first_probe_vec = np.zeros(gene_length)
first_probe_vec[50:] = 1
# 3. Run Stochastic Simulation (SSA)
trajectories, occupancy, signal1_ssa, signal2_ssa = tm.simulate_TASEP_SSA(
ki=ki,
ke=ke,
gene_length=gene_length,
t_max=t_max,
first_probe_position_vector=first_probe_vec,
number_repetitions=20,
n_jobs=-1
)
# 4. Run Deterministic Simulation (ODE)
signal1_ode, _ = tm.simulate_TASEP_ODE(
ki=ki,
ke=ke,
gene_length=gene_length,
t_max=t_max,
first_probe_position_vector=first_probe_vec
)
# 5. Visualize Comparison
time_array = np.arange(0, t_max + 1, 1)
time_array = time_array[:signal1_ssa.shape[1]]
tm.plot_trajectories(
matrix_intensity_first_signal_RT=signal1_ssa,
intensity_vector_first_signal_ode=signal1_ode,
time_array=time_array,
number_repetitions=20
)
Data Management
The library relies on Homo_sapiens.GRCh38.cds.all.fa for calculating accurate codon weights and CAI.
- Automatic Download: You do not need to manually download this file. The first time you run a function like
optimize_sequence()orcompute_CAI(), the library will detect if the file is missing and automatically download it (~177MB) from Ensembl to thedata/human_genome/directory. - Location:
tasep_models/data/human_genome/
Project Structure
tasep_models/
├── src/
│ └── tasep_models/ # Source code
│ ├── __init__.py # Exports public API
│ ├── models.py # Core logic (SSA, ODE, Sequence Utils)
│ └── codon_weights.py # Human codon weights data
├── notebooks/ # Interactive examples
│ ├── TASEP_Simulation.ipynb # Deep dive into simulation & plotting
│ ├── Codon_Adaptation_Index.ipynb # CAI calculation tutorial
│ └── Codon_Optimization.ipynb # Sequence optimization tutorial
├── tests/ # Unit tests
│ └── test_tasep_simulation.py
├── data/ # Data storage (gitignored)
│ └── human_genome/ # Auto-downloaded genome data
├── environment.yml # Conda environment definition
├── pyproject.toml # Package configuration (PEP 517)
├── LICENSE # BSD-3-Clause license
└── README.md
Notebooks
| Notebook | Description |
|---|---|
TASEP_Simulation.ipynb |
Full SSA/ODE simulation workflow |
Codon_Adaptation_Index.ipynb |
Calculate and visualize CAI |
Codon_Optimization.ipynb |
Optimize/deoptimize sequences |
API Reference
Simulation Functions
simulate_TASEP_SSA()- Stochastic simulationsimulate_TASEP_ODE()- Deterministic simulation
Sequence Analysis
read_sequence()- Parse DNA/plasmid filescompute_CAI()- Calculate Codon Adaptation Indexsliding_window_cai()- CAI along the geneoptimize_sequence()- Maximize translation efficiencydeoptimize_sequence()- Minimize translation efficiency
Synthesis Complexity Analysis
find_repeats()- Detect repetitive sequencesfind_homopolymers()- Find homopolymer runs (e.g., AAAA, GGGG)calculate_gc_content()- Calculate GC content percentagefind_hairpins()- Detect potential hairpin structuresanalyze_synthesis_complexity()- Comprehensive synthesis feasibility reportcompare_synthesis_complexity()- Compare multiple sequencesoptimize_for_synthesis()- Synthesis-aware sequence optimization
Visualization
plot_trajectories()- SSA vs ODE comparisonplot_RibosomeMovement_and_Microscope()- Animated ribosome movementplot_plasmid()- Plasmid map visualizationplot_codon_usage_grouped()- Codon frequency bar plots
License
BSD 3-Clause License. Copyright (c) 2026 Luis U. Aguilera.
This project is a standalone component originally derived from the MicroLive project.
Metadata
Release files for tasep-models 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tasep_models-0.1.1.tar.gz | 35.9 kB | Without provenance | Details for tasep_models-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tasep_models-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for tasep_models-0.1.1-py3-none-any.whl |
Total release size: 72.8 kB
Release files / tasep_models-0.1.1.tar.gz
| Download URL | tasep_models-0.1.1.tar.gz |
|---|---|
| Size | 35.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c99588c6404ada77d4720c5842d0cd607ee9c5b124117eac142edbd2babd1c7d
|
|
BLAKE2b-256 checksum How to use checksums |
678ada7974beeef6d9beebf9789ff4d52854e02ea064d25809aca2edfb880ded
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / tasep_models-0.1.1-py3-none-any.whl
| Download URL | tasep_models-0.1.1-py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc6ebf91b7827d006eb9f912cf92b7e7c3f8e42de7b709c17ee35189c40f7611
|
|
BLAKE2b-256 checksum How to use checksums |
5fe99a96dd2bbc6b804b950d742ae9f9e070cfb9c68751db7db7432a6214cfb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for tasep-models 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.