ABC_simulation_with_conf: Do ABC simulation with a configuration table

Description Usage Arguments Details Value

View source: R/ABC_simulation_with_conf.R

Description

A function for doing abc simulation with a configuration table. see Readme on github for required columns in the table

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ABC_simulation_with_conf(
  npod,
  conf,
  time.range,
  buffer = 0,
  concentrationscale,
  concentrationShape,
  prefix = "temp",
  BayeSSCallocation,
  do.parallel = 1,
  write.reference.file = F
)

Arguments

npod

An integer, the number of simulation replicates

conf

A data frame with configurations

time.range

A vector containing two numeric elements specifying the minimal and maximum event time.

buffer

The minimal amount of time separating two events. The default is 0, when events' time are sampled randomly

concentrationscale

A numeric. The scale for the gamma distribution. See 'Details'

concentrationShape

A numeric. The shape for the gamma distribution. See 'Details'

prefix

BayeSSC will generate many intermediate files, this function will create temporary folders for storing these files. One folder for one row in the configuration table, and the folders are named as prefixsimulation replicates_row number.If folders with the same name already exist, user will be prompt for providing another prefix or overwriting the folders.

BayeSSCallocation

A character string providing the location of the BayeSSC executable (including the file name)

do.parallel

A integer for the number of parallel threads to use. if equals 1,no parallel execution. The parallel R package required

write.reference.file

TRUE or FALSE(Default). If TRUE, the simulated hyperstat will be append to a file prefix_reference_table. Useful for running large number of replicates.If False, the simulated hyperstat will be collected and returned as a data frame

Details

For the prior on the number of co-expansion events, hBayeSSC used a flat distribution. In the paper, we adopt the [PyMsbayes-style](http://joaks1.github.io/PyMsBayes/) prior: a gamma distribution for the alpha parameter of the dirichelete process. User need to select the two parameters for gamma distribution: concentrationShape and consentrationScale. Check [prior selection in PyMsbayes](http://joaks1.github.io/PyMsBayes/tutorials/selecting-priors.html) for how to select these two parameters.

Value

If write.reference.file is FALSE, this function returns a data frame containing the simulated hyperstats. The first column is 'uid' (prefix+the replicates number), the second column is the number of events, and the third column is the total number of species. Following are columns of the "real" expansion time for each species in the simulation, and then, the columns of hyperstats.If write.reference.file is TRUE, this function returns a character string providing the path to the reference file.


huatengh/CoExpansionValidation documentation built on Nov. 19, 2021, 11:07 a.m.