This repository contains the full pipeline used to simulate, process, and analyze genetic data for comparing Qst and Fst estimates under different population structures and genetic architectures. The workflow combines:
- Forward-time simulations (SLiM)
- Tree sequence processing (Python)
- Quantitative trait analysis (R)
The repository provides:
- SLiM scripts for simulating island and stepping-stone models.
- Python scripts to process simulated tree sequences into VCFs with added mutations and founder sampling.
- R code implementing the Guillaume–Whitlock (GW) framework for Qst estimation and statistical testing.
- Shell scripts for automated and parallelized execution on HPC clusters (SLURM).
├── scripts/ # Core pipeline code
│ ├── Full_code_analysis_Qst_Fst.Rmd # Analysis and visualization of final results
│ ├── GW_Qst_Fst.r # Main algorithm (Guillaume–Whitlock framework) adapted by Jikaël Ntoko
│ ├── process_stepping_tree.py # Tree → VCF (stepping-stone model)
│ ├── process_tree_island.py # Tree → VCF (island model)
│ ├── run_batch_vcf.sh # Parallel VCF processing launcher
│ ├── run_one_vcf.sh # Single execution of tree → VCF
│ ├── run_one_seed.sh # Single SLiM simulation run
│ ├── run_slim_batch.sh # Array job: multiple SLiM simulations
│ ├── run_one_qst.sh # Single Qst–Fst analysis (R)
│ ├── run_qst_fst.sh # Batch Qst–Fst analysis (SLURM array)
│
├── slim_script/ # Forward simulations in SLiM
│ ├── island_neutral.slim # Island model simulation
│ ├── stepping_neutral.slim # Stepping-stone model simulation
- SLiM 4+ (forward-time population genetic simulator)
- Python 3.9+ with:
tskit,pyslim,msprime,numpy,pandas
- R (≥ 4.2) with:
tidyverse,hierfstat,JGTeach,vcfR,gaston,VGAM,boot
This pipeline is designed for HPC clusters running SLURM; adaptation may be needed for local execution
# Python environment
conda create -n qstfst python=3.10 numpy pandas pyslim tskit msprime
conda activate qstfst
# R environment (example)
module load R/4.3.1
Rscript -e 'install.packages(c("tidyverse","vcfR","boot","VGAM"))'- Run Simulations
Island model example:
slim slim\_script/island\_neutral.slimStepping-stone model:
slim slim\_script/stepping\_neutral.slimOr submit arrays on SLURM:
bash scripts/run\_slim\_batch.sh2. Process Tree Sequences → VCF
bash scripts/run\_batch\_vcf.sh3. Qst–Fst Analysis
Run a single replicate:
bash scripts/run\_one\_qst.shOr submit in parallel:
bash scripts/run\_qst\_fst.sh4. Visualization and Results
Open the R Markdown file for figure generation and summary statistics:
rmarkdown::render("scripts/Full\_code\_analysis\_Qst\_Fst.Rmd")- Author: Jikaël Ntoko, University of Lausanne (UNIL)
- Contributor (algorithmic component): Isabela Do’Ò (original algorithm (Whitlock and Guillaume implementation))