Learn R Programming

strataG (version 2.0.2)

fastsimcoal: Run fastsimcoal

Description

Run a fastsimcoal simulation and load results into a '>gtypes object.

Usage

fscWrite(pop.info, locus.params, mig.rates = NULL, hist.ev = NULL,
  label = NULL)

fscRead(file, locus.params, label.haplotypes = TRUE)

fastsimcoal(pop.info, locus.params, mig.rates = NULL, hist.ev = NULL, label = NULL, quiet = TRUE, delete.files = TRUE, exec = "fsc252", num.cores = NULL, label.haplotypes = TRUE)

Arguments

pop.info

matrix of population sampling information created by the fscPopInfo function.

locus.params

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

mig.rates

a matrix or list of matrices giving the migration rates between pairs of populations.

hist.ev

matrix of historical events created by the fscHistEv function.

label

character string to label files with.

file

filename to write to.

label.haplotypes

if DNA sequences are being simulated, should resulting sequences be stored as haplotypes (default = TRUE), or left as individual sequences (FALSE)?

quiet

logical. Run quietly?

delete.files

logical. Delete files when done?

exec

name of fastsimcoal executable.

num.cores

number of cores to use.

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. http://cmpg.unibe.ch/software/fastsimcoal2/

Examples

Run this code
# NOT RUN {
# Set fastsimcoal parameters
# Population information: 3 populations with Ne = 10,000, drawing 100 samples from each.
pop.info <- fscPopInfo(pop.size = rep(10000, 3), sample.size = rep(100, 3))

# Migration rates among the 3 populations
mig.rates <- matrix(c(0, 0.5, 0.005, 0.5, 0, 0.0005, 0.005, 0.0005, 0), ncol = 3)

# Define historical events in which populations diverged 2000 generations in past
hist.ev <- fscHistEv(
  num.gen = c(2000, 2000), source.deme = c(2, 1),
  sink.deme = c(1, 0), prop.migrants = 1
)

# Define 10 microsatellite loci, with random mutation rates
msat.params <- fscLocusParams(
  locus.type = "msat", num.loci = 1, 
  mut.rate = runif(10, 1e-7, 1e-4)
)

# Run simulation and display locus summary
sim.msats <- fastsimcoal(pop.info, msat.params, mig.rates, hist.ev)
summarizeLoci(sim.msats)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab