cloning rate algorithm and identifying the number of clones

34 views
Skip to first unread message

Jay

unread,
Jun 10, 2021, 10:14:12 AM6/10/21
to slim-discuss
Hello!  Newbie in coding and pop gen. But I was wondering would it be possible to ask for help in understanding the behavior of clonal rate with SLiM. 

What I'm trying to do is to know the number of clones in the simulated populations using slim. To do this we simulated the population using slim and tried to know the number of individual clones using R. Based on the simulated population from slim with a 25% cloning rate, R revealed that we do not have 25% clones in the population. 

Based on my understanding is that the cloning rate is not a deterministic ratio, hence the number of individuals that are clones is not exactly 25%. But we would expect a cloning rate within the 25% values.
 
What I wanted to happen is: If I set 25% as cloning rate/ratio, I would expect 25%  clone individuals of my population.  How can I possibly do a set fixed ratio for the number of clones? Also how does the cloning algorithm works in slim :)


Here is the set of codes I used:

initialize() {
 initializeMutationRate(4e-9);
 initializeMutationType("m1", 0.5, "f", 0.0);
 initializeGenomicElementType("g1", m1, 1.0);
for (index in 0:1000)
initializeGenomicElement(g1, index*25000 + index*500, index*25000 + index*500 +500 );
initializeRecombinationRate(1e-8);

}

1 {
 sim.addSubpop("p1", 20000);
p1.setCloningRate(0.25);

}

50000 early() { sim.addSubpopSplit("p2", 20000, p1);
p2.setCloningRate(0.25);

}

400000 early() { sim.addSubpopSplit("p3", 20000, p2);

p2.setCloningRate(0.25);
p2.setMigrationRates(p3, 0.01);
p3.setMigrationRates(p2, 0.01); }

500000 late() { sim.outputFixedMutations();

}

500000 { sim.simulationFinished();

}

500000 late() {
o1 = p1.sampleIndividuals(100).genomes;
o2 = p2.sampleIndividuals(100).genomes;
o3 = p3.sampleIndividuals(100).genomes;
c(o1, o2, o3).outputVCF(simplifyNucleotides=T);

}

Sincerely, 

John Ordinario

Ben Haller

unread,
Jun 10, 2021, 10:48:36 AM6/10/21
to slim-discuss
Hi John!

As you've realized, in the default Wright-Fisher (WF) model type in SLiM the cloning rate is not deterministic.  As the doc for setCloningRate() says (in manual section 24.14.2), "During mating and offspring generation, the probability that any given offspring individual will be generated by cloning – by asexual reproduction without gametes or meiosis – will be equal to the cloning rate (for its sex, in sexual simulations) set in the parental (not the offspring!) subpopulation."  Section 22.2 goes into much more detail about exactly how offspring generation in the WF model works; e.g., "... migration rates, selfing rates, and cloning rates are all probabilities, not deterministic ratios, and you can think of SLiM as rolling the dice to make these decisions for each offspring individual.  This means that the sex ratio of a subpopulation does not fluctuate over time, but the fraction of offspring that are migrants, or clones, or selfed, will vary stochastically around the specified rates."

For WF models, that can't be changed; that's just how it is, in SLiM.  For users who need more control, as you apparently do, SLiM offers a more flexible type of model, the non-Wright-Fisher (nonWF) model type.  Section 1.6 of the manual will introduce you to this model type, and chapter 16 has lots of examples of nonWF models.  Once you get sufficiently familiar with this model type, doing what you want will be quite easy.  In a nonWF model, you are in complete control of the reproduction that occurs; if you want to generate a clonal offspring, you call addCloned(), if you want to generate an offspring from sexual biparental mating, you call addCrossed(), etc.  If you want a fixed number of offspring, a fixed percentage of which are clonal, you just implement that, directly in your script.  Section 16.15 illustrates the general approach, which I refer to as "big bang" reproduction because it involves reproducing the whole population in a single pre-planned step, rather than reproductive behavior being determined at the individual level (as in the WF model).

I would note that a deterministic cloning rate of *exactly* 25%, rather than a 25% chance of any given offspring being generated clonally, is generally not biologically realistic, so do think about whether that is truly what you even want.  But if you're trying to compare SLiM results to those from a deterministic analytical model, it may make sense to force the SLiM model to be closer to the analytical model, for example; just be aware that when you do so, you are probably moving further away from the biology, at the same time.

Regarding getting into all of this stuff, learning how to write nonWF models, etc., note that there is a free SLiM workshop available online that you can go through on your own (or even better, with labmates), with pre-recorded lectures and worksheets and so forth.  You can find it at http://benhaller.com/workshops/workshops.html; I highly recommend it if you're just getting started with SLiM.

Happy modeling!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University
Reply all
Reply to author
Forward
0 new messages