Simulate populations of RADseq data following island or stepping stone models. Inside the function, allele frequency can be created with fastsimcoal2 and then used inside rmetasim simulation engine. The function requires strataG to be installed.
simulate_rad( num.pops = 5, num.loci = 1000, div.time = 25000, ne = 50, nm = c(0, 5), theta = 0.2, mig.type = c("island", "stepping.stone"), num.reps = 10, num.rms.gens = 10, label = NULL, fsc.exec = "fsc26", parallel.core = parallel::detectCores() - 1, use.wd = FALSE )
| num.pops | (integer) Number of populations.
Default:  | 
|---|---|
| num.loci | (integer) Number of independent RADseq loci.
To use more than 2000 loci, rmetasim needs to be modified
(vignette).
Default:  | 
| div.time | (integer) Time since divergence of populations.
Default:  | 
| ne | (integer) Effective populations size.
Default:  | 
| nm | (integer) Number of migrants per generation.
Default:  | 
| theta | (integer) Value of theta (= ne * migration rate).
Default:  | 
| mig.type | (integer) Migration topology type:  | 
| num.reps | (integer) Number of replicates for each scenario.
Default:  | 
| num.rms.gens | (integer) Number of  | 
| label | (integer) Label for the output folder. With default  | 
| fsc.exec | (character) Name of fastsimcoal executable. See details.
Default:  | 
| parallel.core | (optional, integer) The number of core used for parallel
execution.
Default:  | 
| use.wd | (optional, logical) Use the working directory for output files? 
Default:  | 
invisibly, a list containing the parameters used to run the simulation and the filenames of the genotypes for each scenario and replicate
fastsimcoal2: The function requires that the executable for fastsimcoal be installed in a location where it can be executed from the current working directory.
How to install fastsimcoal2 v.2.6.0.3
The following arguments can be specified as single values or vectors:
 num.pops, num.loci, div.time, ne, nm, theta, mig.type. One simulation 
 scenario will be generated for each combination of unique values of these 
 arguments.
The function will create a folder in the current working directory with the 
 name provided by label. Within this folder there will be an R 
 workspace file ("scenarios.rdata") containing a data frame with the 
 parameters for each scenario (scenarios), and one R  
 workspace file for each scenario, named "gtypes.#.rdata" where "#" 
 is the scenario number. Each scenario file contains a list named 
 sim.data, which contains a strataG::gtypes representation 
 of the simulated SNP data for every replicate in that scenario. The list 
 has a "scenario" attribute which is a one row data.frame providing 
 the parameters that generated the data and a "label" attribute which 
 is the label of the set of scenarios that were run.
Eric Archer eric.archer@noaa.gov and Thierry Gosselin thierrygosselin@icloud.com