-
Notifications
You must be signed in to change notification settings - Fork 0
/
const-Ne-10000_single-pulse_t-m-s.slim
executable file
·56 lines (48 loc) · 1.58 KB
/
const-Ne-10000_single-pulse_t-m-s.slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// single-pulse admixture simulation for N=10000
// user specifies:
// *timing of selection onset
// *selection coefficient
// *total number of generations
// *P1 admixture contribution
// *outfile directory/name
// usage: slim -d s=s -d mig=m -d tsel=t -d tend=gen -d pos=pos -d out='"out"' const-Ne-10000_single-pulse_t-m-s.slim
initialize() {
defineConstant("L", 1e8); // 100Mb chromosome
initializeTreeSeq();
initializeMutationRate(0);
initializeMutationType("m1", 0.5, "f", 0);
initializeGenomicElementType("g1", m1, 1.0);
initializeGenomicElement(g1, 0, L);
initializeRecombinationRate(1e-8); // uniform recombination rate
}
1 {
selstart = asInteger(tsel); // set timing of selection onset
genend = asInteger(tend); // set total number of generations
sim.rescheduleScriptBlock(s1, start=1*selstart);
sim.rescheduleScriptBlock(s2, 1*genend, 1*genend);
}
//source populations each have 1 diploid individual
1 late() {
sim.addSubpop("p1", 1);
sim.addSubpop("p2", 1);
sim.treeSeqRememberIndividuals(sim.subpopulations.individuals);
locus = asInteger(pos); // set variant position
p1.genomes.addNewDrawnMutation(m1, locus);
sim.addSubpop("p3", 10000);
m = asFloat(mig); // set admixture proportion
p3.setMigrationRates(c(p1, p2), c(m, 1-m));
}
2 late() {
p3.setMigrationRates(c(p1, p2), c(0.0, 0.0));
p1.setSubpopulationSize(0);
p2.setSubpopulationSize(0);
}
s1 1000 late() {
mut = sim.mutationsOfType(m1);
mut.setSelectionCoeff(s); // set selection coefficient
}
s2 1000 late() {
outname = "" + out + ".trees";
sim.treeSeqOutput(outname);
sim.simulationFinished();
}