Code Overview

Author
Affiliation

Manuel Razo-Mejia

Department of Biology, Stanford University

Keywords

variational autoencoders, evolutionary dynamics, antibiotic resistance

Code Documentation

This section provides interactive code examples and demonstrations of the computational methods used in our research on evolutionary landscapes and phenotype-to-fitness maps.

Available Notebooks

We provide several computational notebooks that showcase different aspects of our methodology and analysis:

  1. Evolutionary Dynamics Simulation
  • Simulates the dynamics of populations evolving in a 2-dimensional phenotypic space under various fitness landscapes and fixed mutational constraints. This notebook demonstrates how populations navigate phenotypic space influenced by both fitness gradients and genotype-phenotype density.
  1. RHVAE on Simulated Data
  • Implements a Riemannian Hamiltonian Variational Autoencoder (RHVAE) to analyze fitness profiles generated from evolutionary simulations. This notebook shows how we can learn low-dimensional representations of high-dimensional fitness data while preserving the geometric structure of the underlying phenotypic space.
  1. Bayesian Inference of IC₅₀ Values
  • Performs Bayesian inference on the IC₅₀ values of antibiotic resistance landscapes using experimental data. This notebook demonstrates model fitting of dose-response curves using different parameterizations and implements outlier detection techniques.
  1. Metropolis-Kimura Evolution
  • Explores a biologically motivated model of evolution combining elements of the Metropolis-Hastings algorithm with Motoo Kimura’s population genetics theory. This model accounts separately for mutation accessibility and selection via fixation probability.
  1. Metropolis-Hastings Evolution
  • Implements the Metropolis-Hastings algorithm for simulating evolutionary dynamics on fitness landscapes with mutational constraints.

Running the Code

All notebooks can be run interactively if you have Julia installed with the required packages. Each notebook is self-contained with detailed explanations, mathematical background, and visualization of results.

Required Packages

To run these notebooks, you’ll need:

  • Data Processing: DataFrames, CSV, DimensionalData
  • Scientific Computing: LinearAlgebra, StatsBase, Distributions, LsqFit
  • Bayesian Inference: Turing
  • Deep Learning: Flux, AutoEncoderToolkit
  • Visualization: CairoMakie, ColorSchemes

Click on any of the notebooks in the sidebar to explore the code in detail.