sim.msABC.sumstat: Simulate summary statistics using msABC

View source: R/sim.msABC.sumstat.R

sim.msABC.sumstatR Documentation

Simulate summary statistics using msABC

Description

This function simulates summary statistics using msABC. It is optimized for nextgen data, but it should also work for sanger. This will simulate the entire loci, not a single SNP. You should include all loci in the model object, including invariable ones. Use the get.data.structure function to set up the parameters of the loci - bp and number of individuals - to be simulated.

Usage

sim.msABC.sumstat(
  model,
  nsim.blocks,
  path = getwd(),
  use.alpha = F,
  mu.rates = NULL,
  rec.rates = NULL,
  append.sims = F,
  block.size = 10,
  msABC.call = get.msABC(),
  output.name,
  ncores
)

Arguments

model

A model object bult by the main.menu function. Both genomic and sanger-type models are allowed.

nsim.blocks

Number of blocks to simulate. The total number of simulations is: nsim.blocks x sim.block.size.

path

Path to write the output. By default outputs will be saved in the working directory.

use.alpha

Logical. If TRUE the most recent population size change will be exponential. If FALSE sudden demographic changes. Default is FALSE. This argument changes ONLY the MOST RECENT demographich change.

mu.rates

List. Distribution to sample the mutation rates. The first element of the list should be the name of the distribution as a character string. All distributions available in r-base and r-package e1071 are allowed. The second element of the list must be the number of loci. The following elements are the parameters of the distribution to be passed on to the r-distribution function. Ex.: mu.rates = list("rtnorm", 1000, 1e-9, 1e-9, 0). i.e sample 1000 values using the rtnorm function with mean 1e-9 and SD 1e-9, with lower tail limit at zero.

rec.rates

List. Distribution to sample the recombination rates. The first element of the list should be the name of the distribution as a character string. All distributions available in r-base and r-package e1071 are allowed. The second element of the list must be the number of loci. The following elements are the parameters of the distribution to be passed on to the r-distribution function. Ex.: rec.rates = list("rtnorm", 1000, 1e-9, 1e-9, 0). i.e sample 1000 values using the rtnorm function with mean 1e-9 and SD 1e-9, with lower tail limit at zero.

append.sims

Logical. If TRUE simulations will be appended in the last output. Default is FALSE.

msABC.call

String. Path to the msABC executable. msABC binaries for Mac and Linux are included in the package and should work cases for these operating systems. There is no need to change this unless you want to compile the program yourself and point the function to it.

output.name

String. The prefix of the output names. Defalt is "model"

sim.block.size

Simulations are performed in blocks. This argument defines the size of the block in number of simulations, i.e. how many simulations to run per block. A block of 1000 will work for most cases. Increse the total number of simulations with nsim.block argument.

Value

Writes simulations and parameters to the path directory.

Author(s)

Marcelo Gehara

References

Hudson R.R. (2002) Generating samples under a Wright-Fisher neutral model of genetic variation. Bioinformatics, 18, 337–338.

Pavlidis P., Laurent S., & Stephan W. (2010) msABC: A modification of Hudson’s ms to facilitate multi-locus ABC analysis. Molecular Ecology Resources, 10, 723–727.


gehara/PipeMaster documentation built on April 19, 2024, 8:14 a.m.