Description Usage Arguments Details Value Examples
Produce a set of DNA sequences by simulation a population with multiple generations allowing mutation and recombination
1 2 3 4 5 6 7 8 9 10 |
ancestors |
A list of DNA sequences with which to start the population. Include the same sequence multiple times to achieve a target ratio. |
r0 |
The number of offspring each molecule produces. Currently restricted to being an integer, but this will become a more complex construct in future versions (GH issue #17). |
n_gen |
The number of generations to simulate. |
n_pop |
Stop the simulation when the population size exceeds this number. |
mutator |
A list with two elements fun and args specifying the name of the function that mutates parents into their offspring and the list of arguments said function requires. |
fitness_evaluator |
A list with two elements fun and args, specifying the name of the function that evaluates the fitness of each sequence and the list of arguments the function requires. |
ps_rate |
The chance that any given sequence will be a recombinant. |
verbose |
If TRUE, progress is printed to STDOUT. |
Details: Simulated multiple generations TODO - expand this
A genealogy data structure. TODO: link to general documentation on a genealogy. GH issue #6.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Five generations, ancestor 60 As, mutation rate 10% per base per generation
x <- sim_pop(ancestors = paste(rep("A", 60), collapse = ''),
r0 = 2,
n_gen = 5,
n_pop = Inf,
mutator = list(fun = "mutator_uniform_fun",
args = list(mu = 0.1)),
fitness_evaluator = list(fun = "fitness_evaluator_uniform_fun",
args = NULL))
# Prints sequences of current generation
x %>% filter(gen_num == max(gen_num)) %>% select('the_seq')
# Plots a histogram of the number of mutations between each parent
# and its offspring in the last generation
## Not run:
ggplot(subset(x, gen_num == max(gen_num)), aes(n_mut)) +
geom_histogram(binwidth = 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.