reproduction() {
if (individual.tagL0==F) {
mates = sample(p1.individuals, 2);
for (mate in mates);
subpop.addCrossed(individual, mate);
initialize() {
initializeSLiMModelType("nonWF");
defineConstant("K", 1000);
initializeMutationRate(1.3e-6); // scaled
initializeMutationType("m1", 0.5, "f", 0.0); // neutral
initializeMutationType("m2", 0.5, "f", 0.0); // Gene drive
initializeMutationType("m3", 0.5, "f", 0.0); // S-locus mutation
m2.convertToSubstitution = T;
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElementType("g2", m3, 1.0); // S-locus mutations
initializeGenomicElement(g1, 0, 999);
initializeGenomicElement(g1, 1001, 20000);
initializeGenomicElement(g2, 20001, 21000); // S-locus
initializeGenomicElement(g1, 21001, 99999);
initializeRecombinationRate(5e-6); //scaled
}
1 early() {
sim.addSubpop("p1", 100);
}
1: early() {
sim.killIndividuals(p1.subsetIndividuals(minAge=9));
}
early() {
p1.fitnessScaling = K / p1.individualCount;
}
2: early () {
inds = p1.individuals;
inds.color = ifelse(inds.haploidGenome1.containsMarkerMutation(m2, 1000), "red", "green");
}
reproduction() {
//subpop.addCrossed(individual, sample(p1.individuals, 1));
///// gene drive carriers produce no eggs
if (individual.tagL0==F) {
mates = sample(p1.individuals, 1);
for (mate in mates);
subpop.addCrossed(individual, mate);
}
}
120 late() {
driveSeeders = p1.individuals[0:499];
driveSeeders.haplosomes.addNewDrawnMutation(m2, 1000);
catn(size(driveSeeders) + " carriers released");
}
121: late() {
catn(sim.cycle + ": " + 100*(sim.mutationFrequencies(NULL, sim.mutationsOfType(m2))) + "% carriers");
}
120:10000 late() {
if (sim.countOfMutationsOfType(m2) == 0)
{
fixed = any(sim.substitutions.mutationType == m2);
cat(ifelse(fixed, "FIXED\n", "LOST\n"));
catn("in " + (sim.cycle - 120) + " generations");
sim.simulationFinished();
}
}
modifyChild() {
mut = sim.mutationsOfType(m2);
if (size(mut) == 1)
{
hasMutOnChromosome1 = child.haploidGenome1.containsMutations(mut);
hasMutOnChromosome2 = child.haploidGenome2.containsMutations(mut);
if (hasMutOnChromosome1 & !hasMutOnChromosome2)
child.haploidGenome2.addMutations(mut);
else if (hasMutOnChromosome2 & !hasMutOnChromosome1)
child.haploidGenome1.addMutations(mut);
}
return T;
}
1: late() {
p1.individuals.tagL0 = p1.individuals.haploidGenome1.containsMarkerMutation(m2, 1000) & p1.individuals.haploidGenome2.containsMarkerMutation(m2, 1000);
}
for (mate in mates);
subpop.addCrossed(individual, mate);
--
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/fefbbde5-dacc-44d9-b1b8-9a6bc24d8bb3n%40googlegroups.com.
initialize() {
initializeSLiMModelType("nonWF");
defineConstant("K", 1000);
defineConstant("GERMLINE_CONVERSION", T); // if F, default embryo conversion
if (!GERMLINE_CONVERSION){
hasMutOnChromosome1 = child.haploidGenome1.containsMutations(mut);
hasMutOnChromosome2 = child.haploidGenome2.containsMutations(mut);
if (hasMutOnChromosome1 & !hasMutOnChromosome2)
child.haploidGenome2.addMutations(mut);
else if (hasMutOnChromosome2 & !hasMutOnChromosome1)
child.haploidGenome1.addMutations(mut);
} else {
// handle germline conversion in mother and father separately
mother_passed_wt = !(child.haploidGenome1.containsMutations(mut));
mother_drive_on_1 = parent1.haploidGenome1.containsMutations(mut);
mother_drive_on_2 = parent1.haploidGenome2.containsMutations(mut);
if (mother_passed_wt & (mother_drive_on_1 | mother_drive_on_2))
// wt chrom was converted to drive in germline
child.haploidGenome1.addMutations(mut);
father_passed_wt = !(child.haploidGenome2.containsMutations(mut));
father_drive_on_1 = parent2.haploidGenome1.containsMutations(mut);
father_drive_on_2 = parent2.haploidGenome2.containsMutations(mut);
if (father_passed_wt & (father_drive_on_1 | father_drive_on_2))
// wt chrom was converted to drive in germline
child.haploidGenome2.addMutations(mut);