Skip to content

Repository files navigation

Ancient DNA Tests of Polygenic Selection

This pipeline applies the Akbari et al. (2026) tests of polygenic selection to GWAS summary statistics. It uses 15,836 ancient West Eurasian genomes from the last 10,000 years. The example data are the five ReGPC Big Five personality traits.

The pipeline computes three statistics for each trait:

  • γ — the change in polygenic score over time, from a linear mixed model
  • γ_sign — the same model, with sign(beta) weights
  • r_s — the LDSC genetic correlation between GWAS effect size and selection coefficient

All input data are public. The pipeline downloads them at run time.

Results

Tests of polygenic selection for the Big Five personality traits

Trait γ P(γ) γ_sign P(γ_sign) r_s P(r_s)
Conscientiousness +0.44 0.0022 +0.40 0.0063 +0.087 0.0011
Agreeableness +0.29 0.032 +0.26 0.053 +0.056 0.15
Neuroticism −0.12 0.43 −0.20 0.19 −0.024 0.44
Extraversion +0.11 0.42 +0.11 0.40 +0.001 0.97
Openness +0.05 0.69 +0.03 0.81 −0.001 0.97

γ is in units of one modern standard deviation per 10,000 years. P values are two-sided. Full statistics are in outputs/.

Requirements

  • Docker, or Python 3.10–3.12 with bash, curl, tar and unzip
  • 40 GB free disk space
  • 16 GB RAM

The pipeline downloads 29 GB of data. It installs PLINK 2.0 and LDSC into tools/.

Run with Docker

git clone https://github.com/jesseICR/aDNA-polygenic-selection.git
cd aDNA-polygenic-selection
docker build -t adna-selection .
mkdir -p adna-data
docker run --rm --user $(id -u):$(id -g) \
  -v $(pwd)/adna-data:/app/pipeline-output adna-selection

Make the adna-data directory before you run. Docker creates a missing directory as root.

Run without Docker

git clone https://github.com/jesseICR/aDNA-polygenic-selection.git
cd aDNA-polygenic-selection
bash main.sh

Options

Set these variables before you run.

TRAITS=conscientiousness,agreeableness NFLIP=1000 bash main.sh
Variable Description Default
TRAITS all, or a comma-separated list of trait names all
NFLIP Sign-flip replicates used to calibrate λ 100
PLINK_THREADS Threads for PLINK 2.0 4
MAF_FILTER 1 uses variants with FILTER == PASS; 0 uses all 9,739,624 1
CLUMP_DPRIME D′ threshold for the second clumping step; 0 disables it 0.2
P_CONVENTION corrected or raw corrected
ALPHA_MODE bonferroni, or set ALPHA directly bonferroni

To compute a trait again, delete results/<trait>.selection_stats.tsv. To build the relationship matrix again, delete work/grm.eigen.npz.

Run your own GWAS

The GWAS must use GRCh37 coordinates and give a sample size for each SNP.

export WORK_DIR=$PWD/work OUTPUT_DIR=$PWD/results
export PFILE=$PWD/downloads/AncientDNA_plus_EUR1KG_AllVariants_NoQC_GRCh37_autosomes
export HQ_VARIANTS=$PWD/downloads/HighQualityVariants.tsv
export SELECTION_STATS=$PWD/downloads/Selection_Summary_Statistics_01OCT2025.tsv.gz
export ANCESTRY_TSV=$PWD/downloads/Ancestry_Composition_3way_qpAdm_Patterson2022.tsv
export PLINK2=$PWD/tools/bin/plink2
export LDSC_DIR=$PWD/tools/ldsc
export LD_SCORES=$PWD/downloads/eur_w_ld_chr
export HAPMAP3_SNPS=$PWD/downloads/w_hm3.snplist
PY=$PWD/tools/venv/bin/python

$PY 00_adapt.py my_gwas.txt.gz work/mytrait.input.tsv
$PY 01_harmonize.py work/mytrait.input.tsv mytrait
$PY 02_clump.py mytrait
$PY 03_score_pgs.py mytrait
$PY 05_lmm.py mytrait
$PY 06_rs.py mytrait work/mytrait.input.tsv
$PY 07_figure.py results/mytrait.png mytrait

00_adapt.py detects column names. Use --n <N> if the file has no sample-size column. Use --or-to-beta if the file gives an odds ratio.

Pipeline stages

Stage Script Description
1 setup_plink.sh, setup_python.sh, setup_ldsc.sh Install PLINK 2.0, the Python environment, and LDSC
2 download_data.sh Download 29 GB of public data
3 prepare_samples.py, prepare_variants.py Split ancient and modern samples; select the analysis variants
4 04_build_grm.py Build the genetic relationship matrix
5 00_adapt.py Read the GWAS; apply the sample-size filter
5 01_harmonize.py Match GWAS SNPs to the analysis variants
5 02_clump.py Clump and threshold; apply the D′ step; remove the MHC
5 03_score_pgs.py Compute and standardize the polygenic scores
5 05_lmm.py Fit the mixed model; compute γ, γ_sign and λ
5 06_rs.py Compute r_s with LDSC
6 07_figure.py Draw the figure

Runtime

Benchmarked on 128 cores with PLINK_THREADS=12.

Step Runtime
Install tools 1 m
Download data network-bound
Build the relationship matrix 6 m
Each trait 4 m
Figure 1 m

Data sources

  • Ancient genotypes, variant list, selection coefficients, ancestry estimatesHarvard Dataverse, doi:10.7910/DVN/7RVV9N
  • ReGPC Big Five GWASOSF, osf.io/hgnsm. This project states no reuse terms.
  • Ancient sample datesSupplementary Table 1
  • European LD scoresZenodo, doi:10.5281/zenodo.8182036, CC-BY-4.0
  • PLINK 2.0cog-genomics.org, GPL-3.0
  • LDSCCBIIT/ldsc, pinned by commit, GPL-3.0

Publications

  • Akbari A. et al.Ancient DNA reveals pervasive directional selection across West Eurasia. Nature 654, 419–428 (2026). doi:10.1038/s41586-026-10358-1
  • Schwaba T., Clapp Sullivan M.L., Akingbuwa W.A. et al.Robust inference and widespread genetic correlates from a large-scale genetic association study of human personality. bioRxiv (2025). doi:10.1101/2025.05.16.648988
  • Bulik-Sullivan B. et al.LD Score regression distinguishes confounding from polygenicity in genome-wide association studies. Nature Genetics 47, 291–295 (2015). doi:10.1038/ng.3211
  • Patterson N. et al.Large-scale migration into Britain during the Middle to Late Bronze Age. Nature 601, 588–594 (2022). doi:10.1038/s41586-021-04287-4

Keywords

ancient DNA, aDNA, polygenic selection, directional selection, polygenic score, PGS, GWAS, summary statistics, linear mixed model, LMM, genetic relationship matrix, GRM, LD score regression, LDSC, genetic correlation, population structure, West Eurasia, hunter-gatherer, early European farmer, steppe pastoralist, qpAdm, 1000 Genomes, PLINK, GRCh37, Harvard Dataverse, OSF, Big Five, personality, conscientiousness, agreeableness, neuroticism, extraversion, openness, reproducible research, Docker, bioinformatics, statistical genetics, Holocene, selection coefficient

About

Tests any GWAS for polygenic selection in 15,836 ancient West Eurasian genomes, following Akbari et al. (2026). All input data are public and downloaded at run time.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages