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, withsign(beta)weightsr_s— the LDSC genetic correlation between GWAS effect size and selection coefficient
All input data are public. The pipeline downloads them at run time.
| 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/.
- Docker, or Python 3.10–3.12 with
bash,curl,tarandunzip - 40 GB free disk space
- 16 GB RAM
The pipeline downloads 29 GB of data. It installs PLINK 2.0 and LDSC into tools/.
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-selectionMake the adna-data directory before you run. Docker creates a missing directory as root.
git clone https://github.com/jesseICR/aDNA-polygenic-selection.git
cd aDNA-polygenic-selection
bash main.shSet 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.
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 mytrait00_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.
| 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 |
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 |
- Ancient genotypes, variant list, selection coefficients, ancestry estimates — Harvard Dataverse, doi:10.7910/DVN/7RVV9N
- ReGPC Big Five GWAS — OSF, osf.io/hgnsm. This project states no reuse terms.
- Ancient sample dates — Supplementary Table 1
- European LD scores — Zenodo, doi:10.5281/zenodo.8182036, CC-BY-4.0
- PLINK 2.0 — cog-genomics.org, GPL-3.0
- LDSC — CBIIT/ldsc, pinned by commit, GPL-3.0
- 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
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
