This reconstructs a slimrlang
input sequence to regenerate the given slimr_script
object. This is useful if you want to edit the SLiM script to add additional functionality,
for example, where you want to incorporate the results of slimrlang
's internal edits, e.g.
such as removing %.%
special operators, etc. It is also useful when the
slimr_script
object has been created from converting a text-based SLiM script, such as when
using as_slimr_script
from the slimr
package on a character variable.
reconstruct(x, ...)
slimr_script object to reconstruct
Further arguments, passed to or from other methods.
A character vector of length one containing the reconstructed code.
slim_script(
slim_block(initialize(),
{
.Init$initializeMutationRate(1e-7);
.Init$initializeMutationType("m1", 0.5, "f", 0.0);
.Init$initializeGenomicElementType("g1", m1, 1.0);
.Init$initializeGenomicElement(g1, 0, 99999);
.Init$initializeRecombinationRate(1e-8);
}),
slim_block(1,
{
sim%.%.SS$addSubpop("p1", 500);
}),
slim_block(10000,
{
sim%.%.SS$simulationFinished();
})
) -> script
reconstruct(script)
#> [1] "slim_script(\n\n slim_block(initialize(), {\n .Init$initializeMutationRate(1e-07)\n .Init$initializeMutationType(\"m1\", 0.5, \"f\", 0)\n .Init$initializeGenomicElementType(\"g1\", m1, 1)\n .Init$initializeGenomicElement(g1, 0, 99999)\n .Init$initializeRecombinationRate(1e-08)\n }),\n\n slim_block(1, early(), {\n sim %.% .SS$addSubpop(\"p1\", 500)\n }),\n\n slim_block(10000, early(), {\n sim %.% .SS$simulationFinished()\n })\n)"