fscWrite: Write fastsimcoal2 input files

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/fscWrite.R

Description

Write files necessary to run a fastsimcoal2 simulation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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.

Note

fastsimcoal2 is not included with 'strataG' and must be downloaded separately. Additionally, it must be installed such that it can be run from the command line in the current working directory. The function fscTutorial() will open a detailed tutorial on the interface in your web browser.

Author(s)

Eric Archer eric.archer@noaa.gov

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á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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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)

## End(Not run)

strataG documentation built on Feb. 28, 2020, 9:07 a.m.