sucessive founder effects under partial clonality

18 views
Skip to first unread message

Reynes Lauric

unread,
Mar 23, 2026, 3:40:43 PM (13 days ago) Mar 23
to slim-discuss

Hi everyone,

I’m working on a recent biological introduction in Hawai’i (less than 20 generations ago) and am trying to parameterize SLiM to match the dynamics of this introduction. The species is partially clonal and can also spread by selfing. My main goal is to test whether partial clonality and successive founder effects could explain the high FST values and strong IBD observed through ddRADseq data.

Rather than generating random polymorphism, I used a VCF containing genotypes from the population at the initial point of introduction. I don’t have a specific question, but I would greatly appreciate feedback on my scripting to ensure that I am: i) correctly initializing simulations from this polymorphism, and ii) properly simulating successive founder events (p1 → p2 → p3 → p4) at successive generations, with all individuals evolving under partial clonality. I’m using SLiM v3.5.

Please let me know if anything looks wrong or inappropriate. I’m still a beginner with SLiM, so any guidance would be much appreciated.

Thank you for your help

Lauric Reynes 

Here is my script: 

// =====================
// SLiM 3.5
// =====================

initialize() {
setSeed(seed);
    initializeSLiMModelType("nonWF");
    initializeMutationType("m1", 0.5, "f", 0.0);
m1.convertToSubstitution = F;
    initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElement(g1, 0, 5000);
    initializeMutationRate(0);
    initializeRecombinationRate(1e-08);
}

// ------------------- Reproduction with partial clonality -------------------
reproduction() {
    CLONAL_RATE = INPUT_CLONAL;  // 10% clonal reproduction
    K = INPUT_K;           // maximum population size per subpop

    inds = subpop.individuals;
    for (ind in inds) {
        if (subpop.individualCount < K) {
            if (runif(1) < CLONAL_RATE) {
                subpop.addCloned(ind);        // clonal offspring
            } else {
                mate = subpop.sampleIndividuals(1);
                subpop.addCrossed(ind, mate[0]); // sexual offspring
            }
        }
    }
}


1 early () {
sim.addSubpop("p1", 13);
p1.genomes.readFromVCF(INPUT_VCF, m1);
catn("Clonality rate: " + INPUT_CLONAL);
catn("maximum population size per subpop: " + INPUT_K);

}

// ------------------- Founder Events: Stepping-Stone -------------------
5 late() {
    sim.addSubpop("p2", 0);
    nFounders = min(3, p1.individualCount);
    founders = sample(p1.individuals, nFounders);
    p2.takeMigrants(founders);
    catn("p2 colonized with " + nFounders + " founders");
}

8 late() {
    sim.addSubpop("p3", 0);
    nFounders = min(3, p2.individualCount);
    founders = sample(p2.individuals, nFounders);
    p3.takeMigrants(founders);
    catn("p3 colonized with " + nFounders + " founders");
}

10 late() {
    sim.addSubpop("p4", 0);
    nFounders = min(3, p3.individualCount);
    founders = sample(p3.individuals, nFounders);
    p4.takeMigrants(founders);
    catn("p4 colonized with " + nFounders + " founders");
}

// ------------------- Output -------------------

15 {

 maxSample = 20; // maximum per population
nP1 = min(p1.individualCount, maxSample);
nP2 = min(p2.individualCount, maxSample);
nP3 = min(p3.individualCount, maxSample);
nP4 = min(p4.individualCount, maxSample);

    // ----------------- Print the actual sample sizes -----------------
catn("Sampling " + nP1 + " individuals from p1");
catn("Sampling " + nP2 + " individuals from p2");
catn("Sampling " + nP3 + " individuals from p3");
catn("Sampling " + nP4 + " individuals from p4");

    inds = c(
        p1.sampleIndividuals(nP1),
        p2.sampleIndividuals(nP2),
        p3.sampleIndividuals(nP3),
        p4.sampleIndividuals(nP4)
    );

inds.genomes.outputVCF(filePath=OUT_VCF);

    catn("Generation 15: VCF output completed");

    sim.simulationFinished();
}










Ben Haller

unread,
Mar 23, 2026, 5:43:20 PM (13 days ago) Mar 23
to slim-d...@googlegroups.com
Hi Lauric!

I don't have time to review your script in great detail; this list is more for answering specific questions.  :->  In general you need to get good at reviewing your own code; nobody knows what your model is intended to do as well as you do, so nobody can catch errors as well as you can (once you get used to it).

But I took a quick glance since I happen to be in between tasks.  I'd recommend:

- if you're only going to let a limited number of individuals reproduce and then cut off reproduction, randomize the order of the individuals with sample() so that there isn't a bias in the model; the order of individuals in the subpop.individuals vector is not random;

- if you're going to manage the reproduction of the whole subpopulation in your reproduction() callback, rather than the just the focal individual, you should set self.active = 0 at the end; see section 15.3 of the SLiM manual for discussion of this way of handling reproduction;

- choosing a mate with sampleIndividuals() will allow "incidental selfing" if the focal individual happens to be chosen as the mate; you can use the exclude= parameter of sampleIndividuals() to prevent this (see section 15.2)

- mate[0] is legal but redundant; mate is a vector containing one individual, so mate[0] is the same as mate

- I see from your use of p1.genomes that you're using a version of SLiM that is more than a year old; you might want to update to get bug fixes and performance improvements

That's all I notice in my quick look.  If there are aspects of the model that you're not sure of, add print() and catn() calls to validate its behavior, use SLiMgui to observe that it appears to be behaving as intended visually, etc.

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University




However, I took a 
--
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/30c5f289-04c7-4abb-a69a-14c9c54e0a30n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages