-
Notifications
You must be signed in to change notification settings - Fork 0
Home
A Python toolkit for simulating sequence evolution, exploring molecular clock models and implementing phylogenetic reconstruction algorithms from first principles.
Molecular clocks use DNA sequence variation to estimate evolutionary relationships and divergence times between species.
This project explores the computational foundations of molecular clock analysis by building the core algorithms from first principles. It includes simulation engines for generating synthetic evolutionary datasets, interactive tools for exploring molecular clock models, and implementations of phylogenetic reconstruction algorithms. Rather than relying on existing phylogenetics libraries, the aim is to understand how evolutionary histories are simulated, represented, reconstructed and ultimately interpreted.
The repository combines a reusable simulation library, a command-line interface for generating synthetic datasets, and an interactive explorer for experimenting with molecular clock models.
The project is intended both as an educational resource and as a computational laboratory for investigating phylogenetic algorithms.
The core simulator implements a strict molecular clock capable of generating complete synthetic evolutionary datasets.
Features include:
- Random ancestral DNA sequence generation
- Rooted phylogenetic tree generation
- Balanced and random branching models
- Ultrametric tree calibration
- DNA sequence evolution along each branch
- Complete evolutionary history tracking
- Export of simulated datasets in FASTA, Newick and JSON formats
These datasets provide known ground truth against which future phylogenetic reconstruction algorithms can be evaluated.
A second simulation engine implements a simple autocorrelated relaxed molecular clock.
Unlike the strict clock model, individual lineages evolve at different mutation rates while preserving a complete known evolutionary history.
Features include:
- Independent relaxed clock simulation engine
- Lineage-specific mutation rates
- Autocorrelated rate inheritance
- Time and genetic distance tracking
- Export in FASTA, Newick and JSON formats
- Complete mutation and lineage-rate history
The relaxed clock engine complements the existing strict clock simulator, providing synthetic datasets for investigating the effects of rate variation on downstream phylogenetic analysis.
Version 0.2.0 introduces the Strict Molecular Clock Explorer, an interactive Streamlit application built directly on top of the simulation engine.
The explorer allows simulation parameters to be adjusted interactively before generating a new evolutionary history and visualising the resulting phylogenetic tree.
The command-line interface remains fully supported and continues to provide reproducible dataset generation for downstream analysis.