Hello,
I am reporting this assuming that the intended behavior is that a single mutation has a single mutation type value.
When using setMutationType() several times (sometimes once) on the same mutation it seems that the mutation gets "labeled" with all those mutation types, and it will be selected with functions such as mutationsOfType() for all the mutation types it has been assigned. However, sim.mutations.mutationType shows only the last mutation type assigned.
The behavior is not consistent, note in the example (below) that some m0 mutations "lost" the "m0" label in the first use of setMutationType(), but kept it in the second use of setMutationType().
I was using SLiM 5.0 in Linux when I first detected the issue, I have updated to version 5.2 which has the same behavior.
mutation_types_bug.slim
initialize() {
initializeMutationType("m0", 0.10, "f", 0.0);
initializeMutationType("m1", 0.11, "f", 0.1);
initializeMutationType("m2", 0.12, "f", 0.2);
initializeGenomicElementType("g1", c(m0, m1, m2), c(1.0, 1.0, 10));
initializeGenomicElement(g1, 0, 9);
initializeRecombinationRate(0);
initializeMutationRate(0);
}
1 early() {
sim.addSubpop("p1", 500);
}
1 late() {
for (i in 0:9){
mutant = sample(p1.individuals.haplosomes, 10);
mutant.addNewDrawnMutation(m0, i);
}
catn("Total number of mutations: " + length(sim.mutations));
catn("Number of mutations m0: " + sim.countOfMutationsOfType(m0));
catn("\n\n\n");
catn("CHANGE OF MUTATION TYPE TO m1");
mut_m1 = sim.mutations[0:4];
mut_m1.setMutationType(m1);
catn("Total number of mutations: " + length(sim.mutations));
catn("Number of mutations m0: " + sim.countOfMutationsOfType(m0));
catn("Number of mutations m1: " + sim.countOfMutationsOfType(m1));
catn("Mutations m0: ");
catn(sim.mutationsOfType(m0));
catn("Mutations m1: ");
catn(sim.mutationsOfType(m1));
catn("\n\n\n");
catn("CHANGE OF MUTATION TYPE TO m2");
mut_m2 = sim.mutations[c(0,2,4,6,8)];
mut_m2.setMutationType(m2);
catn("Total number of mutations: " + length(sim.mutations));
catn("Number of mutations m0: " + sim.countOfMutationsOfType(m0));
catn("Number of mutations m1: " + sim.countOfMutationsOfType(m1));
catn("Number of mutations m2: " + sim.countOfMutationsOfType(m2));
catn("Mutations m0: ");
catn(sim.mutationsOfType(m0));
catn("Mutations m1: ");
catn(sim.mutationsOfType(m1));
catn("Mutations m2: ");
catn(sim.mutationsOfType(m2));
catn("\n\n\n");
catn("However, looking at mutationType property one gets different values:");
catn("Number of mutations m0: " + sum(sim.mutations.mutationType==m0));
catn("Number of mutations m1: " + sum(sim.mutations.mutationType==m1));
catn("Number of mutations m2: " + sum(sim.mutations.mutationType==m2));
}
This is the output I get:
// Initial random seed:
1014198062745544215
// RunInitializeCallbacks():
initializeMutationType(0, 0.1, "f", 0);
initializeMutationType(1, 0.11, "f", 0.1);
initializeMutationType(2, 0.12, "f", 0.2);
initializeGenomicElementType(1, c(m0, m1, m2), c(1, 1, 10));
initializeGenomicElement(g1, 0, 9);
initializeRecombinationRate(0);
initializeMutationRate(0);
// Starting run at tick :
1
Total number of mutations: 10
Number of mutations m0: 10
CHANGE OF MUTATION TYPE TO m1
Total number of mutations: 10
Number of mutations m0: 5
Number of mutations m1: 5
Mutations m0:
Mutation<5:0> Mutation<6:0> Mutation<7:0> Mutation<8:0> Mutation<9:0>
Mutations m1:
Mutation<0:0> Mutation<1:0> Mutation<2:0> Mutation<3:0> Mutation<4:0>
CHANGE OF MUTATION TYPE TO m2
Total number of mutations: 10
Number of mutations m0: 5
Number of mutations m1: 5
Number of mutations m2: 5
Mutations m0:
Mutation<5:0> Mutation<6:0> Mutation<7:0> Mutation<8:0> Mutation<9:0>
Mutations m1:
Mutation<0:0> Mutation<1:0> Mutation<2:0> Mutation<3:0> Mutation<4:0>
Mutations m2:
Mutation<0:0> Mutation<2:0> Mutation<4:0> Mutation<6:0> Mutation<8:0>
However, looking at mutationType property one gets different values:
Number of mutations m0: 3
Number of mutations m1: 2
Number of mutations m2: 5
Hello,
I am reporting this assuming that the intended behavior is that a single mutation has a single mutation type value.
When using setMutationType() several times (sometimes once) on the same mutation it seems that the mutation gets "labeled" with all those mutation types, and it will be selected with functions such as mutationsOfType() for all the mutation types it has been assigned. However, sim.mutations.mutationType shows only the last mutation type assigned.
The behavior is not consistent, note in the example (below) that some m0 mutations "lost" the "m0" label in the first use of setMutationType(), but kept it in the second use of setMutationType().
I was using SLiM 5.0 in Linux when I first detected the issue, I have updated to version 5.2 which has the same behavior.
mutation_types_bug.slim
This is the output I get:
// Initial random seed:
1014198062745544215
// RunInitializeCallbacks():
initializeMutationType(0, 0.1, "f", 0);
initializeMutationType(1, 0.11, "f", 0.1);
initializeMutationType(2, 0.12, "f", 0.2);
initializeGenomicElementType(1, c(m0, m1, m2), c(1, 1, 10));
initializeGenomicElement(g1, 0, 9);
initializeRecombinationRate(0);
initializeMutationRate(0);
// Starting run at tick :
1
Total number of mutations: 10
Number of mutations m0: 10
CHANGE OF MUTATION TYPE TO m1
Total number of mutations: 10
Number of mutations m0: 5
Number of mutations m1: 5
Mutations m0:
Mutation<5:0> Mutation<6:0> Mutation<7:0> Mutation<8:0> Mutation<9:0>
Mutations m1:
Mutation<0:0> Mutation<1:0> Mutation<2:0> Mutation<3:0> Mutation<4:0>
CHANGE OF MUTATION TYPE TO m2
Total number of mutations: 10
Number of mutations m0: 5
Number of mutations m1: 5
Number of mutations m2: 5
Mutations m0:
Mutation<5:0> Mutation<6:0> Mutation<7:0> Mutation<8:0> Mutation<9:0>
Mutations m1:
Mutation<0:0> Mutation<1:0> Mutation<2:0> Mutation<3:0> Mutation<4:0>
Mutations m2:
Mutation<0:0> Mutation<2:0> Mutation<4:0> Mutation<6:0> Mutation<8:0>
However, looking at mutationType property one gets different values:
Number of mutations m0: 3
Number of mutations m1: 2
Number of mutations m2: 5