Skip to contents

This function creates a reference table to be used as input for the function The created table has eight columns with the following information for each locus to be simulated:

  • q - initial frequency.

  • h - dominance coefficient.

  • s - selection coefficient.

  • c - recombination rate.

  • loc_bp - chromosome location in base pairs.

  • loc_cM - chromosome location in centiMorgans.

  • chr_name - chromosome name.

  • type - SNP type.

The reference table can be further modified as required.

See documentation and tutorial for a complete description of the simulations. These documents can be accessed at


  x = NULL,
  file_targets_sel = NULL,
  file_r_map = NULL,
  interactive_vars = TRUE,
  seed = NULL,
  verbose = NULL,



Path of the variables file 'ref_variables.csv' (see details) [required if interactive_vars = FALSE].


Name of the genlight object containing the SNP data to extract values for some simulation variables (see details) [default NULL].


Path of the file with the targets for selection (see details) [default NULL].


Path of the file with the recombination map (see details) [default NULL].


Run a shiny app to input interactively the values of simulation variables [default TRUE].


Set the seed for the simulations [default NULL].


Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].


Any variable and its value can be added separately within the function, will be changed over the input value supplied by the csv file. See tutorial.


Returns a list with the reference table used as input for the function and a table with the values variables used to create the reference table.


Values for the variables to create the reference table can be submitted into the function interactively through a Shiny app if interactive_vars = TRUE. Optionally, if interactive_vars = FALSE, values for variables can be submitted by using the csv file 'ref_variables.csv' which can be found by typing in the R console: system.file('extdata', 'ref_variables.csv', package ='dartR').

The values of the variables can be modified using the third column (“value”) of this file.

If a genlight object is used as input for some of the simulation variables, this function access the information stored in the slots x$position and x$chromosome.

Examples of the format required for the recombination map file and the targets for selection file can be found by typing in the R console:

  • system.file('extdata', 'fly_recom_map.csv', package ='dartR')

  • system.file('extdata', 'fly_targets_of_selection.csv', package ='dartR')

To show further information of the variables in interactive mode, it might be necessary to call first: 'library(shinyBS)' for the information to be displayed.

See also

Other simulation functions:, gl.sim.create_dispersal()


Custodian: Luis Mijangos -- Post to


ref_table <- gl.sim.WF.table(file_var=system.file('extdata', 
'ref_variables.csv', package = 'dartR'),interactive_vars = FALSE)
#> Starting gl.sim.WF.table 
#> Completed: gl.sim.WF.table 
if (FALSE) {
#uncomment to run 
res_sim <- = system.file('extdata', 
'sim_variables.csv', package ='dartR'),ref_table=ref_table,
interactive_vars = FALSE)