Learn R Programming

Rsampletrees (version 1.0.3)

restartRun: Set up a settings object for continuing a previous sampletrees run

Description

This function is used to initialize settings in order to restart a sampletrees run. The initial values for theta, rho and the initial tree are taken from the final sampled values of a previous sampletrees run.

Usage

restartRun(newrunname, oldargs = NULL, argfile = NULL, extrait = NULL, 
totalsamples = NULL)

Arguments

newrunname

The name to associate with the new run. Output files will have this run name as prefix

oldargs

An object of class `pars' with the settings for the previous sampletrees run

argfile

The name of the settings file used for the previous sampletrees run

extrait

The number of additional iterations desired

totalsamples

The total number of iterations desired in the previous and new run

Value

Returns an object of class `pars' with the settings for a sampletrees run that starts where the previous run finished.

Details

The settings of the previous sampletrees runs can be specified in terms of the settings object or a file name. Therefore, at least one of `oldargs' or 'argfile' must not be NULL.

The desired number of MCMC samples can be specified either in terms of the additional iterations to run ('extrait') or in terms of the total number of iterations desired in both the previous and new run ('totalsamples'). Therefore, at least one of 'extrait' or 'totalsamples' must not be NULL.

The settings in the new settings object are the same as the previous except:

1) The initial theta value is set to the last sampled value from the previous run

2) The initial rho value is set to the last sampled value from the previous run

3) The data for the initial tree, including the node times, internal sequence and recombination-related latent variables, are set to the last sampled values from the previous run.

References

Burkett KM, McNeney B, Graham J. Sampletrees and Rsampletrees: sampling gene genealogies conditional on SNP genotype data. Bioinformatics. 32:1580-2, 2016

Examples

Run this code
# NOT RUN {
#\dontrun{

#system.file("Examples/example_h_pars",package="Rsampletrees")
filename=paste(path.package("Rsampletrees"),"/extdata/example_h_pars",sep="")
runpars=readArgs(filename, check=FALSE)

# Include path in run name so that function can find the necessary files
runname=paste(path.package("Rsampletrees"),"extdata",runpars$RunName, sep="/")
#paste(system.file(package="Rsampletrees"),runpars$RunName, sep="/")
runpars=changeArgs(runpars,RunName=runname)

newpars=restartRun("example-h-2.pars", oldargs=runpars, totalsamples=200000)

#}
# }

Run the code above in your browser using DataLab