A --
SLiM forward genetic simulation: http://messerlab.org/slim/
---
You received this message because you are subscribed to the Google Groups "slim-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slim-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/slim-discuss/856e5882-68e6-4818-a257-bfd975756f92n%40googlegroups.com.
initialize() {
// Initialize nonWF model
initializeSLiMModelType("nonWF"); // Non-WF model
// Define parameters
defineConstant("gen", 500); // number of generations
defineConstant("chrom_len", 5e4);
defineConstant("C_num_QTN", 10); // number of chromosomes with selection (for later part of the simulation)
defineConstant("C_num_Nut", 10); // number of chromosomes with only neutral SNPs
defineConstant("C_num", C_num_QTN + C_num_Nut); // number of chromosomes in total
defineConstant("C_lengths", rep(chrom_len, C_num)); // lengths for each chromosome
defineConstant("R", 1e-5); // recombination rate
defineConstant("MU_base", 1e-7); // base mutation rate overall
defineConstant("N", 4000); // Total size
// Initialize other parameters
initializeSex("A");
initializeMutationType("m1", 0.5, "f", 0.0);
m1.convertToSubstitution = T;
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElementType("g2", m1, 1.0); // Initialise separate genomic element type for now, QTL to be added
// Initialize chromosomes
for (i in seq(1, C_num_QTN)){
initializeChromosome(i, chrom_len);
initializeGenomicElement(g1, 0, chrom_len-1);
initializeMutationRate(MU_base);
initializeRecombinationRate(R);
}
for (i in seq(C_num_QTN + 1, C_num)){
initializeChromosome(i, chrom_len);
initializeGenomicElement(g2, 0, chrom_len-1);
initializeMutationRate(MU_base);
initializeRecombinationRate(R);
}
defineConstant("K", 500); // carrying capacity
}
1:gen reproduction() {
subpops=sim.subpopulations;
for (pop in subpops){
// parents are chosen proportional to fitness
female=which(pop.individuals.sex=="F");
male=which(pop.individuals.sex=="M");
parents1 = sample(pop.individuals[female], N, replace=T);
parents2 = sample(pop.individuals[male], N, replace=T);
for (i in seqLen(N)){
pop.addCrossed(parents1[i], parents2[i]);
}
self.active = 0; // call the reproduction callback only once
}
}
1:gen survival() {
return (individual.age == 0);
}
1 early() {
// Add initial panmictic pops p0
sim.addSubpop("p0", N);
}
initialize() {
// Initialize nonWF model
initializeSLiMModelType("nonWF"); // Non-WF model
// Define parameters
defineConstant("gen", 500); // number of generations
defineConstant("chrom_len", 5e4);
defineConstant("C_num_QTN", 10); // number of chromosomes with selection (for later part of the simulation)
defineConstant("C_num_Nut", 10); // number of chromosomes with only neutral SNPs
defineConstant("C_num", C_num_QTN + C_num_Nut); // number of chromosomes in total
defineConstant("C_lengths", rep( chrom_len , C_num)); // lengths for each chromosome
defineConstant("R", 1e-5); // recombination rate
defineConstant("MU_base", 1e-7); // base mutation rate overall
defineConstant("N", 4000); // Total size
// Initialize other parameters
initializeMutationRate(MU_base);
initializeSex("A");
initializeMutationType("m1", 0.5, "f", 0.0);
m1.convertToSubstitution = T;
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElementType("g2", m1, 1.0); // Initialise separate genomic element type for now, QTL to be added
// Initialize genome
defineConstant("g2_start", sum(C_lengths[0:(C_num_QTN - 1)]));
defineConstant("gen_len", sum(C_lengths[0:(C_num - 1)]) - 1);
initializeGenomicElement(g1, 0, g2_start-1);
initializeGenomicElement(g2, g2_start, gen_len-1);
// C_num chromosomes of 50 kb each
rates = c(rep(c(R, 0.5), C_num-1), R);
ends = repEach(cumSum(C_lengths), 2);
ends = ends[0:(length(ends) - 2)];
ends = ends - c(rep(c(1,0), C_num-1), 1);
initializeRecombinationRate(rates, ends);
defineConstant("K", 500); // carrying capacity
}
1:gen reproduction() {
subpops=sim.subpopulations;
for (pop in subpops){
// parents are chosen proportional to fitness
female=which(pop.individuals.sex=="F");
male=which(pop.individuals.sex=="M");
parents1 = sample(pop.individuals[female], N, replace=T);
parents2 = sample(pop.individuals[male], N, replace=T);
for (i in seqLen(N)){
pop.addCrossed(parents1[i], parents2[i]);
}
self.active = 0; // call the reproduction callback only once
}
}
1:gen survival() {
return (individual.age == 0);
}
1 early() {
// Add initial panmictic pops p0
sim.addSubpop("p0", N);
}
To view this discussion visit https://groups.google.com/d/msgid/slim-discuss/96111e59-79b6-4af3-b849-405842ffd8a3n%40googlegroups.com.