You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pclass="p3">where <i>q</i> is the frequency of a given deleterious allele, <i>s</i> is the absolute value of the selection coefficient, and <i>h</i> is its dominance coefficient.<spanclass="Apple-converted-space"></span>Note that the implementation, viewable with <spanclass="s3">functionSource()</span>, sets a maximum |<i>s</i>| of <spanclass="s3">1.0</span> (i.e., a lethal allele); |<i>s</i>| can sometimes be greater than <spanclass="s3">1.0</span> when <i>s</i> is drawn from a distribution, but in practice an allele with <i>s</i> < <spanclass="s3">-1.0</span> has the same lethal effect as when <i>s</i> = <spanclass="s3">-1.0</span>.<spanclass="Apple-converted-space"></span>Also note that this implementation will not work when the model changes the dominance coefficients of mutations using <spanclass="s3">mutationEffect()</span> callbacks, since it relies on the <spanclass="s3">dominanceCoeff</span> property of <spanclass="s3">MutationType</span>. Finally, note that, to estimate the diploid number of lethal equivalents (2<i>B</i>), the result from this function can simply be multiplied by two.</p>
223
223
<pclass="p3">This function was contributed by Chris Kyriazis; thanks, Chris!</p>
<pclass="p3">Calculates the linkage disequilibrium (LD) coefficient <i>D</i> between a focal mutation <spanclass="s3">mut1</span> and one or more mutations in <spanclass="s3">mut2</span>, evaluated across a set of haplosomes given by <spanclass="s3">haplosomes</span>.<spanclass="Apple-converted-space"></span>The result is a <spanclass="s3">float</span> vector that matches the size and order of <spanclass="s3">mut2</span>.<spanclass="Apple-converted-space"></span>The implementation of this function, viewable with <spanclass="s3">functionSource()</span>, calculates <i>D</i> as defined by Hill and Robertson (1968, p. 226).<spanclass="Apple-converted-space"></span>The coefficient <i>D</i> is within [−<i>p</i>(1−<i>p</i>), <i>p</i>(1−<i>p</i>)], where <i>p</i> is the frequency of the more common mutation (that is, <i>p</i> = max(<i>f</i><spanclass="s4"><sub>1</sub></span>, <i>f</i><spanclass="s4"><sub>2</sub></span>) where <i>f</i><spanclass="s4"><sub>1</sub></span> and <i>f</i><spanclass="s4"><sub>2</sub></span> are the frequencies of the two mutations for which <i>D</i> is being calculated); for the normalized LD metric <i>r</i><spanclass="s4"><sup>2</sup></span>, which is within [0, 1], see <spanclass="s3">calcLD_Rsquared()</span>.<spanclass="Apple-converted-space"></span>Departures of <i>D</i> from zero indicate LD; more specifically, <i>D</i> > 0 indicates that the mutations occur together more often than expected by chance (positive linkage), whereas <i>D</i> < 0 indicates they occur together less often than expected by chance (negative linkage).</p>
226
+
<pclass="p3">All mutations in <spanclass="s3">mut2</span> must be associated with the same chromosome as <spanclass="s3">mut1</span>; this function does not currently calculate LD between mutations associated with different chromosomes.<spanclass="Apple-converted-space"></span>If <spanclass="s3">mut2</span> is <spanclass="s3">NULL</span> (the default), all such mutations in the population (including <spanclass="s3">mut1</span> itself) will be used.<spanclass="Apple-converted-space"></span>Similarly, all haplosomes must be associated with the same chromosome as <spanclass="s3">mut1</span>.<spanclass="Apple-converted-space"></span>If the <spanclass="s3">haplosomes</span> parameter is <spanclass="s3">NULL</span> (the default), all such haplosomes in the population will be used.</p>
227
+
<pclass="p3">This function was written by Vitor Sudbrack (currently affiliated with University of Lausanne).</p>
<pclass="p3">Calculates the linkage disequilibrium (LD) squared correlation coefficient <i>r</i><spanclass="s4"><sup>2</sup></span> between a focal mutation <spanclass="s3">mut1</span> and one or more mutations in <spanclass="s3">mut2</span>, evaluated across a set of haplosomes given by <spanclass="s3">haplosomes</span>.<spanclass="Apple-converted-space"></span>The result is a <spanclass="s3">float</span> vector that matches the size and order of <spanclass="s3">mut2</span>.<spanclass="Apple-converted-space"></span>The implementation of this function, viewable with <spanclass="s3">functionSource()</span>, calculates <i>r</i><spanclass="s4"><sup>2</sup></span> as defined by Hill and Robertson (1968, p. 227).<spanclass="Apple-converted-space"></span>The squared correlation coefficient <i>r</i><spanclass="s4"><sup>2</sup></span> is a normalized measure of LD within [0, 1] (for the unnormalized LD coefficient <i>D</i>, see <spanclass="s3">calcLD_D()</span>).<spanclass="Apple-converted-space"></span>When <i>r</i><spanclass="s4"><sup>2</sup></span> = 0, there is no statistical association between the mutations; they co-occur as expected by chance.<spanclass="Apple-converted-space"></span>A value of <i>r</i><spanclass="s4"><sup>2</sup></span> = 1 indicates complete correlation: the mutations either always appear together or never appear together, depending on the sign of the underlying correlation coefficient <i>r</i>.<spanclass="Apple-converted-space"></span>To obtain the raw (signed) <i>r</i> value instead of <i>r</i><spanclass="s4"><sup>2</sup></span>, you can pass <spanclass="s3">squared=F</span> instead of the default of <spanclass="s3">T</span>.</p>
230
+
<pclass="p3">All mutations in <spanclass="s3">mut2</span> must be associated with the same chromosome as <spanclass="s3">mut1</span>; this function does not currently calculate LD between mutations associated with different chromosomes.<spanclass="Apple-converted-space"></span>If <spanclass="s3">mut2</span> is <spanclass="s3">NULL</span> (the default), all such mutations in the population (including <spanclass="s3">mut1</span> itself) will be used.<spanclass="Apple-converted-space"></span>Similarly, all haplosomes must be associated with the same chromosome as <spanclass="s3">mut1</span>.<spanclass="Apple-converted-space"></span>If the <spanclass="s3">haplosomes</span> parameter is <spanclass="s3">NULL</span> (the default), all such haplosomes in the population will be used.</p>
231
+
<pclass="p3">This function was written by Vitor Sudbrack (currently affiliated with University of Lausanne).</p>
<pclass="p3">Calculates the mean value of the <i>F</i><spanclass="s4"><sub>roh</sub></span> statistic across the individuals passed in <spanclass="s3">individuals</span>.<spanclass="Apple-converted-space"></span>This statistic is a measure of individual autozygosity, likely resulting from inbreeding, and is calculated based upon “runs of homozygosity”, or ROH, in the genome of an individual.<spanclass="Apple-converted-space"></span>Broadly speaking, <i>F</i><spanclass="s4"><sub>roh</sub></span> is the proportion of an individual’s genome that is spanned by ROH longer than a given threshold length.<spanclass="Apple-converted-space"></span>However, it should be noted that there are many different ways of calculating <i>F</i><spanclass="s4"><sub>roh</sub></span>, producing different results.<spanclass="Apple-converted-space"></span>For example, the threshold length might be a given constant, or might be determined statistically from the characteristics of the population.<spanclass="Apple-converted-space"></span>Furthermore, some heterozygous sites might be discarded (to compensate for genotyping errors), a minimum SNP density might be required within a sliding window for an ROH to be diagnosed, and so forth – it can get quite complex, as seen in the software PLINK (Purcell et al., 2007) and GARLIC (Szpiech, Blant and Pemberton, 2017).<spanclass="Apple-converted-space"></span>The method used by <spanclass="s3">calcMeanFroh()</span> is the simplest possible method, assessing ROH for each individual directly from the simulated mutations without filtering or modification, and applying a given constant threshold length.<spanclass="Apple-converted-space"></span>If a more sophisticated <i>F</i><spanclass="s4"><sub>roh</sub></span> algorithm is desired, one could modify the implementation of <spanclass="s3">calcMeanFroh()</span>, which is viewable with <spanclass="s3">functionSource()</span>, or one could output VCF data from SLiM and analyze it with other tools, perhaps calling out from the running SLiM script with <spanclass="s3">system()</span>.</p>
226
234
<pclass="p3">The threshold ROH length used by <spanclass="s3">calcMeanFroh()</span> is supplied by the parameter <spanclass="s3">minimumLength</span>.<spanclass="Apple-converted-space"></span>It defaults to <spanclass="s3">1e6</span>, or 1 Mbp, since that is a length commonly used in the literature, but can be adjusted as desired.</p>
Note that by default in WF models, all mutations of a given mutation type will be converted into
936
937
\f1\fs18 Substitution
937
938
\f2\fs20 objects when they reach fixation, for efficiency reasons. If you need to disable this conversion, to keep mutations of a given type active in the simulation even after they have fixed, you can do so by setting the
@@ -1155,9 +1156,8 @@ There is no way to disable sex once it has been enabled; if you don\'92t want to
1155
1156
\f2\fs20 property of
1156
1157
\f1\fs18 Individual
1157
1158
\f2\fs20 , for example), and manage the consequences of that in your script yourself, in terms of which individuals can mate with which, and exactly how the offspring is produced.\
\cf0 This function will likely be extended with further options in the future, added on to the end of the argument list. Using named arguments with this call is recommended for readability. Note that turning on optional features may increase the runtime and memory footprint of SLiM.\
\f2\fs20\cf2 Calculates the linkage disequilibrium (LD) squared correlation coefficient
2424
+
\f3\i r
2425
+
\f2\i0\fs13\fsmilli6667\super 2
2426
+
\fs20\nosupersub between a focal mutation
2427
+
\f1\fs18 mut1
2428
+
\f2\fs20 and one or more mutations in
2429
+
\f1\fs18 mut2
2430
+
\f2\fs20 , evaluated across a set of haplosomes given by
2431
+
\f1\fs18 haplosomes
2432
+
\f2\fs20 . The result is a
2433
+
\f1\fs18 float
2434
+
\f2\fs20 vector that matches the size and order of
2435
+
\f1\fs18 mut2
2436
+
\f2\fs20 . The implementation of this function, viewable with
2437
+
\f1\fs18 functionSource()
2438
+
\f2\fs20 , calculates
2439
+
\f3\i r
2440
+
\f2\i0\fs13\fsmilli6667\super 2
2441
+
\fs20\nosupersub as defined by Hill and Robertson (1968, p. 227). The squared correlation coefficient
2442
+
\f3\i r
2443
+
\f2\i0\fs13\fsmilli6667\super 2
2444
+
\fs20\nosupersub is a normalized measure of LD within [0, 1] (for the unnormalized LD coefficient
2445
+
\f3\i D
2446
+
\f2\i0 , see
2447
+
\f1\fs18 calcLD_D()
2448
+
\f2\fs20 ). When
2449
+
\f3\i r
2450
+
\f2\i0\fs13\fsmilli6667\super 2
2451
+
\fs20\nosupersub\'a0=\'a00, there is no statistical association between the mutations; they co-occur as expected by chance. A value of
2452
+
\f3\i r
2453
+
\f2\i0\fs13\fsmilli6667\super 2
2454
+
\fs20\nosupersub\'a0=\'a01 indicates complete correlation: the mutations either always appear together or never appear together, depending on the sign of the underlying correlation coefficient
2455
+
\f3\i r
2456
+
\f2\i0 . To obtain the raw (signed)
2457
+
\f3\i r
2458
+
\f2\i0 value instead of
2459
+
\f3\i r
2460
+
\f2\i0\fs13\fsmilli6667\super 2
2461
+
\fs20\nosupersub , you can pass
2462
+
\f1\fs18 squared=F
2463
+
\f2\fs20 instead of the default of
2464
+
\f1\fs18 T
2465
+
\f2\fs20 .\
2466
+
All mutations in
2467
+
\f1\fs18 mut2
2468
+
\f2\fs20 must be associated with the same chromosome as
2469
+
\f1\fs18 mut1
2470
+
\f2\fs20 ; this function does not currently calculate LD between mutations associated with different chromosomes. If
2471
+
\f1\fs18 mut2
2472
+
\f2\fs20 is
2473
+
\f1\fs18 NULL
2474
+
\f2\fs20 (the default), all such mutations in the population (including
2475
+
\f1\fs18 mut1
2476
+
\f2\fs20 itself) will be used. Similarly, all haplosomes must be associated with the same chromosome as
2477
+
\f1\fs18 mut1
2478
+
\f2\fs20 . If the
2479
+
\f1\fs18 haplosomes
2480
+
\f2\fs20 parameter is
2481
+
\f1\fs18 NULL
2482
+
\f2\fs20 (the default), all such haplosomes in the population will be used.\
2483
+
This function was written by Vitor Sudbrack (currently affiliated with University of Lausanne).\
Copy file name to clipboardExpand all lines: VERSIONS
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,7 @@ development head (in the master branch):
42
42
add matrix() method to Plot to add a matrix-based image to a plot: (void)matrix(numeric matrix, numeric$ x1, numeric$ x2, numeric$ y1, numeric$ y2, [logical$ flipped = F], [Nif valueRange = NULL], [Ns$ colors = NULL], [float$ alpha = 1.0])
43
43
fix #538, check for unique SLiM ids only for alive individuals when loading a tree sequence
44
44
fix #533, memory smasher in Haplosome method nucleotides(format="char"); besides causing random crashes, this also caused this method to return incorrect results
45
+
fix #527, add calcLD_D() and calcLD_Rsquared() popgen functions, contributed by Vitor Sudbrack
0 commit comments