Skip to content

Modeling Signals of Adaptation Across the Human Genome

A machine learning framework that models signals of recent positive selection across the human genome, to test whether human populations adapted to climate through genes involved in heat production.

Problem

Signals of positive selection (here, the integrated haplotype score, iHS) are noisy. Many genomic factors besides adaptation can raise or lower them: recombination rate, GC content, the density of coding and regulatory elements, or proximity to disease genes. Testing whether selection concentrates near a specific group of genes requires modeling these confounders first, on data with a heavily non-Gaussian distribution, and a predictive model that can be trusted on data it has never seen.

Approach

Starting from ~180 GB of compressed genomic data (1000 Genomes Project, 26 populations), I computed the average iHS and a set of genomic factors for every protein-coding gene, plus its distance to genes of interest (e.g., thermogenic genes, virus-interacting proteins). The pipeline runs in parallel with Python multiprocessing and distributes model training across a Slurm cluster.

The modeling went in two steps:

  1. Mixture density regression (MDR). A linear regression combined with a mixture of two Gaussians, one for the part of the genome not under selection and one for the part under selection. This quantifies how large the selected component is and which factors drive it. I validated it with SLiM simulations that reproduce the human genome's architecture but contain no positive selection.
  2. Model benchmarking. To capture non-linear relationships, I compared algorithm families of increasing flexibility: elastic net, random forests, XGBoost and deep neural networks (multilayer perceptrons). Nested cross-validation kept hyperparameter tuning separate from the final evaluation, and Bayesian optimization (Optuna) searched the neural network space of 13 hyperparameters. The selected model was then interpreted with permutation importance and accumulated local effects (ALE) plots.

Results

  • MDR showed that selection signals concentrate around functional regions of the genome; simulations without positive selection did not reproduce this pattern
  • Best model: a deep neural network (5 layers, 1,000 neurons) with a median R² of 0.83 on held-out data
  • The same network, without re-tuning, kept R² ≈ 0.80 in the other 25 populations, across four continents
  • Explainable AI showed that selection signals increase near thermogenic genes, independently of the confounders in the model: in 18 of 26 populations for thermogenic genes overall, and in all 26 for the genes connected to brown adipose tissue
  • Results featured by the European Commission (CORDIS Results in Brief, 2025)

Solution Overview

1000 Genomes (~180 GB, 26 populations)
    → Gene-level features (iHS, recombination, GC content, functional density,
      distance to gene sets) — Python multiprocessing
    → MDR (selected vs non-selected component) + SLiM simulations
    → Model benchmark on Slurm: elastic net / random forest / XGBoost / DNN
        → nested CV + Bayesian optimization (Optuna)
    → Transfer to 25 populations without retraining
    → Explainable AI (permutation importance, ALE)

Tech Stack

  • Python, R, Bash, AWK
  • Pandas, NumPy, scikit-learn, XGBoost, TensorFlow/Keras, Optuna
  • Python multiprocessing, PySpark
  • Slurm, Singularity/Apptainer
  • SLiM (population genetic simulations)

View the code on GitHub

  • Let's have a virtual coffee together!


    Want to see if we're a match? Let's have a chat and find out. Schedule a free 30-minute session to discuss your data challenges and explore how we can work together.

    Book Free Intro Call