run_delimitR: Run delimitR Function to use delimitR to setup standard...

View source: R/run_delimitR.R

run_delimitRR Documentation

Run delimitR Function to use delimitR to setup standard demographic models and run fastsimcoal2. Custom models other than the default ones constructed by delimitR can also be included.

Description

Run delimitR

Function to use delimitR to setup standard demographic models and run fastsimcoal2. Custom models other than the default ones constructed by delimitR can also be included.

Usage

run_delimitR(
  fsc.path = "fsc26",
  working.dir = getwd(),
  observedSFS = NULL,
  traitsfile,
  easySFS.path = NULL,
  vcf = NULL,
  custom_models = NULL,
  model.subset = NULL,
  obsprefix = 0,
  observedtree.manyspecies = NULL,
  divwgeneflow = TRUE,
  seccontact = TRUE,
  obsdivtimeprior = list(c(50000, 1e+05)),
  obsmigrateprior = list(c(5e-06, 5e-05)),
  obspopsizeprior = "default",
  maxedges = 1,
  nreps = 10000,
  nRFtrees = 500,
  nclasses.bin = 5,
  ncores = 2,
  run.parallel = T,
  threshold = 100,
  clean.wd = T,
  shuffle.traits = F
)

Arguments

fsc.path

Path to fastsimcoal executable, or the name of the executable if it is on your path or in your current directory. Default is "fsc26", but this will be different if you have a different version of fastsimcoal.

working.dir

Path to working directory where observed SFS (*.obs) and traits files (.

observedSFS

Name of the observed SFS file (with or without extension). Default NULL.

traitsfile

Name of the traits file (including extension). If 'observedSFS' is NULL and 'vcf' is non-NULL, the traits file must be formatted as required by easySFS; otherwise, the traits file must be formatted like as required by fastsimcoal2.

easySFS.path

Optional character string with path to easySFS executable. Only required when 'observedSFS' is NULL and 'vcf' is non-NULL.

vcf

Optional character string with path to VCF file. Default is NULL. If this is set, the value of observedSFS will be ignored and the an SFS will be created by calling easySFS. The format of the traits file must be as required by easySFS; the fsc2-format traits file will automatically be generated to pass to delimitR and fsc2.

custom_models

Character string with path or name (if in current directory) to a directory containing custom models to use in addition to the standard models constructed by delimitR. Default is to not include any custom models.

model.subset

NULL (default) or a numerical vector indicating which models to include. If NULL, all models generated are used. If a numerical vector, each number corresponds to the number after the prefix and before the extension of each .tpl and .est file.

obsprefix

Character string or an integer in c(0, 1). Character string specifies the prefix to use for .est and .tpl files defining demographic models. These files must have the form "obsprefix_n.tpl" or "obsprefix_n.est", where n is an integer in 1:N models. If 0 (the default), "model" will be used as the prefix. If 1, the function will attempt to infer the prefix from filenames of custom models supplied. Do not set to 1 if you are not supplying custom models. This will also fail if multiple prefixes are used for custom models, or if .est and .tpl files do not have the form 'obsprefix_n.est' and 'obsprefix_n.tpl'.

observedtree.manyspecies

Character string describing the observed species tree in Newick format. Use NULL (the default) unless > 3 populations (species) are observed.

divwgeneflow

If models should be created that include divergence with gene flow. Default is TRUE.

seccontact

If models should be created that include secondary contact. Default is TRUE.

obsdivtimeprior

List of numeric vectors indicating min and max values for divergence times (units = number of generations). Default is for a two species case (single divergence), and the values should be changed given your situation. Divergence time priors should be provided in order of coalescent interval.

obsmigrateprior

List containing one numeric vector with min and max values of migration rates in the migration matrix. A single non-zero migration matrix is allowed in the standard delimitR models. This prior does not affect any custom models in the custom_models directory.

obspopsizeprior

List of numeric vectors indicating the min and max prior values for each population. Default is "default", which uses 10000 and 100000 for the minimum and maximum, respectively, for all populations. You probably shouldnt use "default". The input has the form: list(c(min_Pop0,max_Pop0),c(min_Pop1,max_Pop1), ...) Note that these are in terms of the number of haploid individuals, so use n*2 for diploid species.

maxedges

Number of migration events to include in standard delimitR models. At present must equal 1. You can create custom models if you want to include multiple edges (migration events).

nreps

Number of fastsimcoal replicates. Default is 10000.

nRFtrees

Number of RF trees to use. Default is 500.

nclasses.bin

Number of bins for turning mSFS into binned bSFS. This number should not be greater than the sample size of the population with the fewest samples, as this results in sparse sampling of the SFS. Default is 5. Large values lead to a more complete summary of the data, but also lead to a more sparsely sampled SFS and increased computation times.

ncores

Number of cores to use. Default is 2.

run.parallel

Whether or not simulations of different models should be run in parallel. Default is TRUE, but in some cases weird issues arrise and in it can be useful to change to FALSE.

threshold

Number indicating threshold used for downsampling during SFS construction if this was done. Default is 100 (no downsampling).

clean.wd

Whether or not to delete extra/temporary files after running. Default is TRUE. Changing to FALSE can help with debugging but you will regret doing setting to FALSE for long-term because many files are generated.

shuffle.traits

Whether or not to randomly shuffle the assignment of traits to individuals. Default is FALSE. This option is not yet implemented but will probably require calling easySFS, which will require data input as vcf and some way to automate SFS options.

Value

NULL. Output files are written working.dir


JeffWeinell/misc.wrappers documentation built on Sept. 20, 2023, 12:42 p.m.