Convert a character vector into a slim_script object

as_slimr_script(slim_script_text)

Arguments

slim_script_text

A character vector giving the full SLiM script to convert to a slimr_script object. Character vectors with length greater than 1 will be concatenated with newline separators

Value

A slimr_script object

Examples

cat(slim_recipes[[1]])
#> // Keywords: 
#> 
#> // set up a simple neutral simulation
#> initialize()
#> {
#> 	// set the overall mutation rate
#> 	initializeMutationRate(1e-7);
#> 	
#> 	// m1 mutation type: neutral
#> 	initializeMutationType("m1", 0.5, "f", 0.0);
#> 	
#> 	// g1 genomic element type: uses m1 for all mutations
#> 	initializeGenomicElementType("g1", m1, 1.0);
#> 	
#> 	// uniform chromosome of length 100 kb
#> 	initializeGenomicElement(g1, 0, 99999);
#> 	
#> 	// uniform recombination along the chromosome
#> 	initializeRecombinationRate(1e-8);
#> }
#> 
#> // create a population of 500 individuals
#> 1 early()
#> {
#> 	sim.addSubpop("p1", 500);
#> }
#> 
#> // run to tick 10000
#> 10000 early()
#> {
#> 	sim.simulationFinished();
#> }
as_slimr_script(slim_recipes[[1]])
#> <slimr_script[3]>
#> block_init_1:initialize() {
#>     initializeMutationRate(1e-07);
#>     initializeMutationType("m1", 0.5, "f", asFloat(0));
#>     initializeGenomicElementType("g1", m1, asFloat(1));
#>     initializeGenomicElement(g1, 0, 99999);
#>     initializeRecombinationRate(1e-08);
#> }
#> 
#> block_2:1 early() {
#>     sim.addSubpop("p1", 500);
#> }
#> 
#> block_3:10000 early() {
#>     sim.simulationFinished();
#> }