Hi,
I am looking for a software that I could use to simulate loci under sex-specific and sexually antagonistic selection, where the selective advantage of alleles differs (or is opposed) between the two sexes. I would be grateful for some advice on whether SLiM would suit my purposes.
There are two specific elements to what I need. The first is that selection coefficients can differ between sexes. Having looked through the SLiM manual, I think this can be implemented with a fitness() callback that is specific to one sex.
The other element is that fitness should be evaluated separately in each sex (comparing an individual's relative fitness to the average of that sex, rather than the population-wide average). This is potentially trickier and I've not been able to find anything obvious in the manual. But maybe I missed something?
initialize() {
initializeSLiMModelType("nonWF");
defineConstant("K", 500); // carrying capacity
initializeMutationType("m1", 0.5, "f", 0.0);
m1.convertToSubstitution = T;
initializeMutationType("m2", 0.5, "f", 0.3); // sex-specific
m2.color = "red";
initializeGenomicElementType("g1", c(m1,m2), c(1.0, 0.001));
initializeGenomicElement(g1, 0, 99999);
initializeMutationRate(1e-7);
initializeRecombinationRate(1e-8);
initializeSex("A");
}
reproduction(NULL, "F") {
// females reproduce with a randomly chosen male mate
subpop.addCrossed(individual, p1.sampleIndividuals(1, sex="M"));
}
fitness(m2)
{
// m2 mutations are beneficial in males, deleterious in females
if (individual.sex == "M")
return relFitness;
else
return 1 / relFitness;
}
1 early() {
sim.addSubpop("p1", K);
}
early() {
// force an early fitness recalculation
// this is based only on mutations
sim.recalculateFitness();
// get fitness values for all individuals
inds = p1.individuals;
fit = p1.cachedFitness(NULL);
// calculate mean absolute fitness of males and females
m = (inds.sex == "M");
f = (inds.sex == "F");
mean_fit_M = mean(fit[m]);
mean_fit_F = mean(fit[f]);
// rescale to make fitness relative not absolute
inds[m].fitnessScaling = 1 / mean_fit_M;
inds[f].fitnessScaling = 1 / mean_fit_F;
// also have density-dependence so we stay near K
p1.fitnessScaling = K / p1.individualCount;
}
20000 late() { sim.outputFixedMutations(); }
Any input would be greatly appreciated!