Extract Elements from SLiM's output() for genomes
slim_extract_genome(
output,
type = c("mutations", "genomes", "full"),
join = TRUE,
expand_mutations = FALSE
)
A character vector where each element is the result of a
call to genomes.output()
in SLiM
Which type of data to return: "mutations", or "genomes" or both.
If asking for multiple output type, should they be joined into one tibble (join = TRUE
)
or left as separate tibbles returned in a list (join = FALSE
)?
If asking for "genomes" output, should mutations be expanded into their own column (expand_mutations = TRUE
)
or left as a vector of mutation ids in a list column (expand_mutations = FALSE
)?
A tibble
if(slim_is_avail()) {
test_sim <- slim_script(
slim_block_init_minimal(mutation_rate = 1e-6),
slim_block_add_subpops(1, 100),
slim_block(1, 20, late(), {
r_output(p1.genomes.output(), "out", do_every = 10)
})
) %>%
slim_run()
slim_extract_genome(test_sim$output_data, type = "mutations")
}
#>
#>
#> Simulation finished with exit status: 0
#>
#> Success!
#> # A tibble: 180 × 11
#> generation mut_id unique_mut_id mut_type chrome_pos selection dominance
#> <int> <int> <int> <chr> <int> <dbl> <dbl>
#> 1 10 7 15 m1 80276 0 0.5
#> 2 10 9 17 m1 36010 0 0.5
#> 3 10 34 30 m1 33892 0 0.5
#> 4 10 5 36 m1 90917 0 0.5
#> 5 10 65 40 m1 70995 0 0.5
#> 6 10 32 46 m1 22935 0 0.5
#> 7 10 33 47 m1 29872 0 0.5
#> 8 10 0 48 m1 34994 0 0.5
#> 9 10 54 49 m1 60144 0 0.5
#> 10 10 1 51 m1 73426 0 0.5
#> # ℹ 170 more rows
#> # ℹ 4 more variables: subpop <chr>, first_gen <int>, prevalence <int>,
#> # nucleotide <chr>