# Gene drive dynamics in plants: the role of seedbanks

This directory contains all code needed to reproduce results from "Gene drive dynamics: the role of seedbanks". 

## SLiM installation

All simulations were conducted in SLiM, version 4.0.1. SLiM can be installed at https://messerlab.org/slim/. Using the prebuilt SLiM installer package, installation took less than 10 seconds on a MacBook Pro (Apple M2 Pro CPU, 8GB RAM). Our model functions the same in the newest version of SLiM, version 5.0 (recently published). 

## Files 

Sections are separated into compressed folders.

#### slim-model.zip

- `seedbank.slim` is the SLiM file used for all simulations. 
- `slim-model-overview.md` provides a detailed overview of the SLiM model. `slim-model-overview.html` is a version of this file that can be opened in a browser.

#### seedbank-statistics.zip

- `seedbank-statistics-plots.Rmd` contains the R code used to create the total germination probability heatmap, average seedbank duration heatmap, and required genetic load figure. 

#### modification-drives.zip

- `modification-parameters.md` describes which constants to set in SLiM to generate the CAIN modification drive and ClvR modification drive data. Examples of how to run modification drive simulations at the command line are also included. `modification-parameters.html` is a version of this file that can be opened in a browser.
- `modification-plots.Rmd` contains the R code used to create the modification drive time to fixation heatmaps and drive trajectory plots. Figures were arranged using Adobe Illustrator 2024. 
- `data` is separated into two subdirectories based on the fecundity settings (`60-180` for default fecundity and `20-60` for lower fecundity). Each subdirectory has a folder `bm-heatmap` for the heatmap data and `trajectories` for the drive trajectory data.

#### suppression-drives.zip

- `suppression-parameters.md` describes the constants to use in SLiM to generate the ClvR male suppression, ClvR female suppression, and CAIN male suppression data. Examples of how to run these suppression drive simulations at the command line are also provided. `suppression-parameters.html` is a version of this file that can be opened in a browser.
- `suppression-plots.Rmd` contains the R code used for creating the heatmaps for population elimination rates and time to elimination, as well as the trajectory plots for the genetic load imposed by the drive, the drive frequency, effective ovule counts, and effective pollen counts. These figures were arranged in Adobe Illustrator 2024. 
- The `data` folder is separated into `60-180` and `20-60` subfolders for each fecundity setting. Each subfolder has further subfolders for the heatmap data (`bm-heatmap`) and all trajectory data (`trajectories`)

#### threshold-dependent-drives.zip

- `threshold-dependent-drives-parameters.md` describes which constants to set in the SLiM model to generate data for the threshold-dependent CAIN, ClvR, ClvR male suppression, ClvR female suppression, and CAIN male suppression drives. Example code for simulating each drive type and fitness cost type at the command line is also provided. `threshold-dependent-drives-parameters.html` is a version of this file that can be opened in a browser.
- `threshold-dependent-drives-plots.Rmd` contains the R code used for creating the "p0" vs "Rate drive spread" figure panels and the "b" vs "phat_e" summary plot for each drive and each fitness cost. Plots were arranged in Adobe Illustrator 2024. 
- `data` is separated into two subdirectories based on the type of fitness cost (`s_g` and `s_s`). Each of these subdirectories have subdirectories for each drive (`cain`, `clvr`, `clvr-male-suppression`, `clvr-female-suppression`, and `cain-male-suppression`)

## Test case command line simulations

* The SLiM model, `seedbank.slim`, must first be downloaded from the `slim-models.zip` compressed folder.

* Modification drive command line simulation examples are located in file `modification-parameters.md` (or `modification-parameters.html` for web version), which is within the `modification-drives.zip` compressed folder.

* Suppression drive command line simulation examples are located in file `suppression-parameters.md` (or `suppression-parameters.html` for web version), which is within the `suppression-drives.zip` compressed folder.

* Threshold-dependent drive command line simulation examples are located in file `threshold-dependent-drives-parameters.md` (or `threshold-dependent-drives-parameters.html` for web version), which is within the `threshold-dependent-drives.zip` compressed folder.




