I am running a of three subpopulations where one of them experiences a selective sweep. I would like to condition the simulations on fixation (or establishment) of the mutation in this subpopulation.
I have a general question about the syntax of the Eidos conditional statements on pg. 163 of the manual, i.e.
1000:100000 late() {
if (sim.countOfMutationsOfType(m2) == 0)
{
fixed = (sum(sim.substitutions.mutationType == m2) == 1);
if (fixed)
{
cat(simID + ": FIXED\n");
sim.simulationFinished();
}
Unless I'm misunderstanding something, if the first condition countOfMutationsOfType(m2)==0 is true, then by definition there can be no mutations of type 2, so how could (given this condition) fixed (as defined below) be true?
fixed = (sum(sim.substitutions.mutationType == m2) == 1);
if (fixed)
Doesn't the fixed condition contradict the prior countofmutation==0 condition?
Additionally, if in my model I specify 3 subpopulations p1,p2,p3, would the correct syntax for checking for fixation in p3 be:
fixed = (sum(p3.substitutions.mutationType == m2) == 1);
i.e. with p3 in place of sim, or do I need to use some other object?