SLiM
SLiM copied to clipboard
`treeSeqRememberIndividuals(inds)` now throws an error if inds is of length zero
Consider the following script:
initialize() {
initializeTreeSeq();
initializeMutationRate(1e-7);
initializeMutationType("m1", 0.5, "f", 0.0);
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElement(g1, 0, 99999);
initializeRecombinationRate(1e-8);
}
1 early() {
sim.addSubpop("p1", 5);
}
5 early() {
inds = p1.sampleIndividuals(0);
sim.treeSeqRememberIndividuals(inds);
}
With SLiM v3.7.1, this script ran without error. In SLiM 4, it throws the error
ERROR (Species::ExecuteMethod_subsetMutations): treeSeqRememberIndividuals() requires that all individuals belong to the target species.
This is pretty inconsequential. But, it could mean that some scripts break (e.g. if the number of individuals sampled is random and might be zero), and the error message is confusing.
Aha, good catch. This should work, and apparently there's no unit test checking that.