This repository stores all relevant R scripts to generate figures for the paper : "A quantitative theory for genomic offset statistics". It also contains a tutorial on how to display predictions of genomic offset statistics in geographic maps.
The tutorial (Rmd, html, PDF) provides an example on how to extract data from the worldclim database and from IPPC sixth report future climate scenarios. It shows how to display genomic offset predictions in a geographic map using R packages for spatial analysis. The tutorial is more general than the Pearl millet data analysis done in our study, and for which the data were based on more accurate bioclimatic variables.
The data repository contains 4 folders:
- expfit_2variables corresponds to the data generated with SLiM for the scenario "high confounding weakly polygenic" (hcwp)
- expfit_2variables_poly corresponds to the data generated with SLiM for the scenario "high confounding highly polygenic" (hchp)
- poly_exp corresponds to the data generated with SLiM for the scenario "low confounding highly polygenic" (lchp)
- poly_small corresponds to the data generated with SLiM for the scenario "low confounding weakly polygenic" (lchp)
- data_mil corresponds to data related to the pearl millet experiment (see Rhone et al. 2020 for access to the source data set)
In order to run the scripts, the data directory must be at the root of the repository.
At the root of the R repository,
- offset.R contains all the functions that are useful to compute offset and environmental distances
- utils.R contains functions to extract and transform data from Data repository
The repository contains 4 folders. Each folder contains scripts related to the main document figures and related supplementary figures
All results were stored in separated files
All SLiM scripts that generated the simulated data
For genotype-environment association studies and genetic offset calculations,
- LEA
- gradientForest
For spatial analysis, 3. terra 4. fields 5. geodata 6. maps 7. rnaturalearth 8. geosphere
For statistics, 9. lmtest 10. qvalue
For general data analysis, 11. ggplot2 12. cowplot 13. dplyr 14. tidyverse 15. RColorBrewer