Skip to main content

Simulating Samples

Requires PopGenSims.jl

To perfom simulations, you will need add and import the package PopGenSims.jl (available here).

Simulate samples within populations

simulate(data::PopData; n::Int)
simulate(data::PopData; n::Dict{String,Int})
simulate(data::PopData; scale::Int)

Simulate data using per-population allele frequencies. The simulated samples will have the naming convention sim_1...sim_# where # is the total number of simulated samples in the new PopData.

simulate(data::PopData; n::Int)

If you want to simulate data with a fixed number of individuals per population, you can do so with simulate(PopData, n = Int), which takes a PopData object and simulates n number of individuals per population. Returns a new PopData with samples having the same ploidy as the source PopData, but will not work on mixed-ploidy data.

In the example below, we simulate 100 individuals per population using the nancycats data, which has 17 populations, therefore the resulting PopData will have 1700 samples (100 samples x 17 populations).

Example

julia> cats = @nancycats;

julia> sims = simulate(cats , n = 100)
PopData{Diploid, 9 Microsatellite loci}
Samples: 1700
Populations: 17