fscRun: Run fastsimcoal

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

View source: R/fscRun.R

Description

Run a fastsimcoal simulation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fscRun(
  p,
  num.sims = 1,
  dna.to.snp = FALSE,
  max.snps = 0,
  sfs.type = c("maf", "daf"),
  nonpar.boot = NULL,
  all.sites = TRUE,
  inf.sites = FALSE,
  no.arl.output = FALSE,
  num.loops = 20,
  min.num.loops = 20,
  brentol = 0.01,
  trees = FALSE,
  num.cores = 1,
  seed = NULL,
  quiet = TRUE,
  exec = "fsc26"
)

fscCleanup(label, folder = ".")

fscTutorial()

Arguments

p

list of fastsimcoal input parameters and output produced by fscWrite.

num.sims

number of simulation replicates to run.

dna.to.snp

convert DNA sequences to numerical SNPs?

max.snps

maximum number of SNPs to retain.

sfs.type

type of site frequency spectrum to compute for each population sample: 'daf' = derived allele frequency (unfolded), 'maf' = minor allele frequency (folded).

nonpar.boot

number of bootstraps to perform on polymorphic sites to extract SFS.

all.sites

retain all sites? If FALSE, only polymorphic DNA sites will be returned. This includes SNP blocks as they are simulated as DNA sequences.

inf.sites

use infinite sites model? If TRUE, all mutations are retained in the output, thus the number of sites for SNPs or DNA sequences will potentially be greater than what was requested.

no.arl.output

do not output arlequin files.

num.loops

number of loops (ECM cycles) to be performed when estimating parameters from SFS. Default is 20.

min.num.loops

number of loops (ECM cycles) for which the likelihood is computed on both monomorphic and polymorphic sites. Default is 20.

brentol

Tolerance level for Brent optimization. Smaller value imply more precise estimations, but require more computation time. Default = 0.01. Value is restricted between 1e-5 and 1e-1.

trees

output NEXUS formatted coalescent trees for all replicates?

num.cores

number of cores to use. If set to NULL, the value will be what is reported by detectCores - 1.

seed

random number seed for simulation.

quiet

logical indicating if fastsimcoal2 should be run in quiet mode.

exec

name of fastsimcoal executable.

label

character string of file run labels prefixes.

folder

character string giving the root working folder where input files and output resides

Value

fscRun

Runs the fastsimcoal2 simulation and returns a list containing run parameters and a data frame used by fscRead to parse the genotypes generated (if Arlequin-formatted output was requested).

fscCleanup

Deletes all files associated with the simulation identified by label.

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, fscWrite, 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
28
29
30
31
## 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)

# runs 100 replicates, converting all DNA sequences to 0/1 SNPs
# will also output the MAF site frequency spectra (SFS) for all SNP loci.
params <- fscRun(params, num.sim = 100, dna.to.snp = TRUE, num.cores = 3)

## End(Not run)

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