Learn R Programming

strataG (version 2.4.905)

fscWrite: Write fastsimcoal2 input files

Description

Write files necessary to run a fastsimcoal2 simulation.

Usage

fscWrite(
  demes,
  genetics,
  migration = NULL,
  events = NULL,
  est = NULL,
  def = NULL,
  label = "strataG.fsc",
  use.wd = FALSE
)

Arguments

demes

matrix of deme sampling information created by the fscSettingsDemes function.

genetics

data.frame specifying loci to simulate created by the fscSettingsGenetics function.

migration

a list of matrices giving the migration rates between pairs of demes created by the fscSettingsMigration function.

events

matrix of historical events created by the fscSettingsEvents function.

est

list of parameter estimation definitions and rules generated by the fscSettingsEst function.

def

matrix of parameter values to substitute into the model generated by the fscSettingsDef function.

label

character string used to label output files for the simulation.

use.wd

use current working directory for input and output? If FALSE then a temporary directory in the session temporary directory. Note that this directory is deleted when the R session closed. See tempdir for more information.

Value

Writes input files for fastsimcoal2 and returns a list of input parameters, input file, and input filenames. This list is the primary input to fscRun.

References

Excoffier, L. and Foll, M (2011) fastsimcoal: a continuous-time coalescent simulator of genomic diversity under arbitrarily complex evolutionary scenarios Bioinformatics 27: 1332-1334. Excoffier, L., Dupanloup, I., Huerta-S<U+00E1>nchez, E., Sousa, V.C., and M. Foll (2013) Robust demographic inference from genomic and SNP data. PLOS Genetics, 9(10):e1003905. http://cmpg.unibe.ch/software/fastsimcoal2/

See Also

fsc.input, fscRun, fscRead

Examples

Run this code
# NOT RUN {
#' # three demes with optional names
demes <- fscSettingsDemes(
  Large = fscDeme(10000, 10), 
  Small = fscDeme(2500, 10),
  Medium = fscDeme(5000, 3, 1500)
)

# four historic events
events <- fscSettingsEvents(
  fscEvent(event.time = 2000, source = 1, sink = 2, prop.migrants = 0.05),
  fscEvent(2980, 1, 1, 0, 0.04),
  fscEvent(3000, 1, 0),
  fscEvent(15000, 0, 2, new.size = 3)
 )
 
# four genetic blocks of different types on three chromosomes.  
genetics <- fscSettingsGenetics(
  fscBlock_snp(10, 1e-6, chromosome = 1),
  fscBlock_dna(10, 1e-5, chromosome = 1),
  fscBlock_microsat(3, 1e-4, chromosome = 2),
  fscBlock_standard(5, 1e-3, chromosome = 3)
)

params <- fscWrite(demes = demes, events = events, genetics = genetics)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab