Package: dynamic-beast
Dynamic BEASTThis command line tool can be used to create a dynamic version ofBEAST2XML files. This dynamic XML file can be used to set BEAST parameters at runtime, which can be useful for testing different configurations or quickly modifying parameters without having to edit the XML file.InstallInstalldynamic-beastwith pip (requires python -V >= 3.6.2).pip install dynamic-beastUsageGivedynamic-beastthe path to a BEAST2 XML file and specify where to save the dynamic XML file (if--outfileis not specified XML will be printed to stdout).dynamic-beasthcv_coal.xml>dynamic_hcv_coal.xmlThis will produce adynamic_hcv_coal.xmlfile that can be used as standard in a BEAST analysis.beastdynamic_hcv_coal.xmlTo modify parameters at runtime use thebeastdefinitions option-D.# Change the chain length to 1000.beast-D'mcmc.chainLength=1000'dynamic_hcv_coal.xmlMultiple definitions can be passed at the same time.# Change the treelog and tracelog sampling freq to 10000.beast-D'treelog.logEvery=10000,tracelog.logEvery=10000'dynamic_hcv_coal.xmlThe fullidof a parameter you'd like to set must be specified.beast-D'clockRate.c:hcv=7.9E-4'dynamic_hcv_coal.xmlExplanationThedynamic-beasttool replaces all the parameter values in the XML file with the$(id.key=value)format. The value variable is the default value that was initially specified in the XML file. However, the value can be redefined when running a BEAST analysis by making use of theBEAST2 definitions option(-D) that allows for user specified values.To ensure reproducibility you should recreate static XML files of runs using dynamic parameters, this can be achieved using the-DFoutargument e.g.,beast -D 'clockRate.c:hcv=7.9E-4' -DFout static_hcv_coal.xml dynamic_hcv_coal.xml.Addtional featuresCoupledMCMCMC3 options for the BEAST packageCoupledMCMCcan be added by using the--mc3option. This will add the default CoupledMCMC options which can then be configured at runtime with-D.# Create dynamic MC3 XMLdynamic-beast--mc3hcv_coal.xml>dynamic_mc3_hcv_coal.xml# Configure MC3 with BEASTbeast-D'mcmc.chains=4'dynamic_mc3_hcv_coal.xmlPath Sampling (Stepping Stone)Path sampling options for the packagemodel-selectioncan be add by using the--psoption. This will add the default model-selection options (e.g. stepping stone) which can then be configured at runtime with-D.# Create dynamic Path Sampling XMLdynamic-beast--pshcv_coal.xml>dynamic_ps_hcv_coal.xml# Configure Path Sampling with BEASTbeast-D"ps.doNotRun=true,ps.rootdir=$(pwd)"dynamic_ps_hcv_coal.xmlNested samplingNested sampling for the packagenested-samplingcan be add by using the--nsoption. This will add the default model-selection options which can then be configured at runtime with-D.# Create dynamic Nested Sampling XMLdynamic-beast--nshcv_coal.xml>dynamic_ns_hcv_coal.xml# Configure Path Sampling with BEASTbeast-D"mcmc.threads=6,mcmc.chainLength=40000"dynamic_ns_hcv_coal.xmlAuto apply optimisation suggestionAt the end of a analysis BEAST provides suggestions for optimising operators e.g.Try setting scaleFactor to about 0.96. See the end of theexample file. A path to the output file can be provided to the--optimiseflag and the suggestions will automatically be extracted and applied to the generated dynamic XML file.dynamic-beast--optimisehcv_coal.outhcv_coal.xml>dynamic_hcv_coal.xmlDynamic-beast will look for a line starting withOperatorand extract the suggestion from the lines that follow. So if you make your own.outfile (i.e. by copy-pasting the BEAST output) you need to make sure the file starts withOperatoron the first line.Produce a json file of dynamic variablesUse the--json-outfile to produce a json file for all the dynamic variables.dynamic-beast--json-outhcv_coal.jsonhcv_coal.xml>dynamic_hcv_coal.xmlCan be used with the beast -DF flagbeast-DFhcv_coal.jsondynamic_hcv_coal.xml