Skip to content

Commit ec6af77

Browse files
committed
fix #534, support uniparental inheritance in hermaphrodites
1 parent 8081e16 commit ec6af77

File tree

9 files changed

+34
-28
lines changed

9 files changed

+34
-28
lines changed

QtSLiM/help/SLiMHelpClasses.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,11 @@
387387
<p class="p6"><span class="s3">A </span><span class="s4">float</span><span class="s3"> scaling factor applied to the individual’s fitness (i.e., the fitness value computed for the individual will be multiplied by this value).<span class="Apple-converted-space">  </span>This provides a simple, fast way to modify the fitness of an individual; conceptually it is similar to returning a fitness effect for the individual from a </span><span class="s4">fitnessEffect()</span><span class="s3"> callback, but without the complexity and performance overhead of implementing such a callback.<span class="Apple-converted-space">  </span>To scale the fitness of all individuals in a subpopulation by the same factor, see the </span><span class="s4">fitnessScaling</span><span class="s3"> property of </span><span class="s4">Subpopulation</span><span class="s3">.</span></p>
388388
<p class="p6"><span class="s3">The value of </span><span class="s4">fitnessScaling</span><span class="s3"> is reset to </span><span class="s4">1.0</span><span class="s3"> every tick, so that any scaling factor set lasts for only a single tick.<span class="Apple-converted-space">  </span>This reset occurs immediately after fitness values are calculated, in both WF and nonWF models.</span></p>
389389
<p class="p5">haploidGenome1 =&gt; (object&lt;Haplosome&gt;)</p>
390-
<p class="p6">A vector of all <span class="s1">Haplosome</span> objects associated with this individual that are attributed to its first parent (the female parent, in sexual models).<span class="Apple-converted-space">  </span>This method assumes the individual was generated by the typical method for each chromosome type, as explained below; it does not trace back the true ancestry of each haplosome.<span class="Apple-converted-space">  </span>The semantics of this are more obvious for some chromosome types than others, depending on the inheritance pattern of the chromosome as described in <span class="s1">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>For chromosomes with two associated haplosomes (types <span class="s1">"A"</span>, <span class="s1">"X"</span>, <span class="s1">"Z"</span>, <span class="s1">"H-"</span>, and <span class="s1">"-Y"</span>), the first haplosome is assumed to be from the first parent, and is thus included, whereas the second haplosome is assumed to be from the second parent and is thus not included.<span class="Apple-converted-space">  </span>For chromosomes with one associated haplosome that is inherited from the female parent in one way or another (types <span class="s1">"W"</span>, <span class="s1">"HF"</span>, and <span class="s1">"FL"</span>), that haplosome is always included.<span class="Apple-converted-space">  </span>For type <span class="s1">"H"</span>, the single haplosome is assumed to have come from the first parent (since clonal inheritance is the common case), and so is included.<span class="Apple-converted-space">  </span>Other chromosome types (<span class="s1">"Y"</span>, <span class="s1">"HM"</span>, <span class="s1">"ML"</span>) are never included.<span class="Apple-converted-space">  </span>See also the <span class="s1">haploidGenome1NonNull</span> property and the <span class="s1">haplosomesForChromosomes()</span> method.</p>
390+
<p class="p6">A vector of all <span class="s1">Haplosome</span> objects associated with this individual that are attributed to its first parent (the female parent, in sexual models).<span class="Apple-converted-space">  </span>This method assumes the individual was generated by the typical method for each chromosome type, as explained below; it does not trace back the true ancestry of each haplosome.<span class="Apple-converted-space">  </span>The semantics of this are more obvious for some chromosome types than others, depending on the inheritance pattern of the chromosome as described in <span class="s1">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>For chromosomes with two associated haplosomes (types <span class="s1">"A"</span>, <span class="s1">"X"</span>, <span class="s1">"Z"</span>, <span class="s1">"H-"</span>, and <span class="s1">"-Y"</span>), the first haplosome is assumed to be from the first parent, and is thus included, whereas the second haplosome is assumed to be from the second parent and is thus not included.<span class="Apple-converted-space">  </span>For chromosomes with one associated haplosome that is inherited from the female/first parent in one way or another (types <span class="s1">"W"</span>, <span class="s1">"HF"</span>, and <span class="s1">"FL"</span>), that haplosome is always included.<span class="Apple-converted-space">  </span>For type <span class="s1">"H"</span>, the single haplosome is assumed to have come from the first parent (since clonal inheritance is the common case), and so is included.<span class="Apple-converted-space">  </span>Other chromosome types (<span class="s1">"Y"</span>, <span class="s1">"HM"</span>, <span class="s1">"ML"</span>) are never included.<span class="Apple-converted-space">  </span>See also the <span class="s1">haploidGenome1NonNull</span> property and the <span class="s1">haplosomesForChromosomes()</span> method.</p>
391391
<p class="p5">haploidGenome1NonNull =&gt; (object&lt;Haplosome&gt;)</p>
392392
<p class="p6">This provides the same vector of haplosomes as the <span class="s1">haploidGenome1</span> property, except that null haplosomes are not included in this property.<span class="Apple-converted-space">  </span>This is a convenience shorthand, sometimes useful in models that involve null haplosomes.<span class="Apple-converted-space">  </span>See also the <span class="s1">haplosomesForChromosomes()</span> method.</p>
393393
<p class="p5">haploidGenome2 =&gt; (object&lt;Haplosome&gt;)</p>
394-
<p class="p6">A vector of all <span class="s1">Haplosome</span> objects associated with this individual that are attributed to its second parent (the male parent, in sexual models).<span class="Apple-converted-space">  </span>This method assumes the individual was generated by the typical method for each chromosome type, as explained below; it does not trace back the true ancestry of each haplosome.<span class="Apple-converted-space">  </span>The semantics of this are more obvious for some chromosome types than others, depending on the inheritance pattern of the chromosome as described in <span class="s1">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>For chromosomes with two associated haplosomes (types <span class="s1">"A"</span>, <span class="s1">"X"</span>, <span class="s1">"Z"</span>, <span class="s1">"H-"</span>, and<span class="s1">"-Y"</span>), the second haplosome is assumed to be from the second parent, and is thus included, whereas the first haplosome is assumed to be from the first parent and is thus not included.<span class="Apple-converted-space">  </span>For chromosomes with one associated haplosome that is inherited from the male parent in one way or another (types <span class="s1">"Y"</span>, <span class="s1">"HM"</span>, and <span class="s1">"ML"</span>), that haplosome is always included.<span class="Apple-converted-space">  </span>For type <span class="s1">"H"</span>, the single haplosome is assumed to have come from the first parent (since clonal inheritance is the common case), and so is not included.<span class="Apple-converted-space">  </span>Other chromosome types (<span class="s1">"W"</span>, <span class="s1">"HF"</span>, <span class="s1">"FL"</span>) are never included.<span class="Apple-converted-space">  </span>See also the <span class="s1">haploidGenome2NonNull</span> property and the <span class="s1">haplosomesForChromosomes()</span> method.</p>
394+
<p class="p6">A vector of all <span class="s1">Haplosome</span> objects associated with this individual that are attributed to its second parent (the male parent, in sexual models).<span class="Apple-converted-space">  </span>This method assumes the individual was generated by the typical method for each chromosome type, as explained below; it does not trace back the true ancestry of each haplosome.<span class="Apple-converted-space">  </span>The semantics of this are more obvious for some chromosome types than others, depending on the inheritance pattern of the chromosome as described in <span class="s1">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>For chromosomes with two associated haplosomes (types <span class="s1">"A"</span>, <span class="s1">"X"</span>, <span class="s1">"Z"</span>, <span class="s1">"H-"</span>, and<span class="s1">"-Y"</span>), the second haplosome is assumed to be from the second parent, and is thus included, whereas the first haplosome is assumed to be from the first parent and is thus not included.<span class="Apple-converted-space">  </span>For chromosomes with one associated haplosome that is inherited from the male/second parent in one way or another (types <span class="s1">"Y"</span>, <span class="s1">"HM"</span>, and <span class="s1">"ML"</span>), that haplosome is always included.<span class="Apple-converted-space">  </span>For type <span class="s1">"H"</span>, the single haplosome is assumed to have come from the first parent (since clonal inheritance is the common case), and so is not included.<span class="Apple-converted-space">  </span>Other chromosome types (<span class="s1">"W"</span>, <span class="s1">"HF"</span>, <span class="s1">"FL"</span>) are never included.<span class="Apple-converted-space">  </span>See also the <span class="s1">haploidGenome2NonNull</span> property and the <span class="s1">haplosomesForChromosomes()</span> method.</p>
395395
<p class="p5">haploidGenome2NonNull =&gt; (object&lt;Haplosome&gt;)</p>
396396
<p class="p6">This provides the same vector of haplosomes as the <span class="s1">haploidGenome2</span> property, except that null haplosomes are not included in this property.<span class="Apple-converted-space">  </span>This is a convenience shorthand, sometimes useful in models that involve null haplosomes.<span class="Apple-converted-space">  </span>See also the <span class="s1">haplosomesForChromosomes()</span> method.</p>
397397
<p class="p5">haplosomes =&gt; (object&lt;Haplosome&gt;)</p>

QtSLiM/help/SLiMHelpFunctions.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@
4747
<p class="p3">The <span class="s3">type</span> parameter specifies the type of chromosome to be created.<span class="Apple-converted-space">  </span>There are numerous options, and they are somewhat complex.<span class="Apple-converted-space">  </span>They are discussed in more detail in the documentation for class <span class="s3">Chromosome</span>, particularly their specific patterns of inheritance; but they are briefly summarized here for quick reference.<span class="Apple-converted-space">  </span>Note that “–“ below indicates a null haplosome.<span class="Apple-converted-space">  </span>First of all, in hermaphroditic models <span class="s3">type</span> will generally be one of:</p>
4848
<p class="p5"><span class="s3">"A"</span> (autosome), the default, specifying a diploid autosomal chromosome.</p>
4949
<p class="p5"><span class="s3">"H"</span> (haploid), specifying a haploid autosomal chromosome that recombines in biparental crosses.</p>
50+
<p class="p5"><span class="s3">"HF"</span> (haploid female-inherited), specifying a haploid autosomal chromosome that is inherited by both sexes from the first (female) parent in biparental crosses (also allowed in hermaphroditic models for inheritance that is always from the first parent).</p>
51+
<p class="p5"><span class="s3">"HM"</span> (haploid male-inherited), specifying a haploid autosomal chromosome that is inherited by both sexes from the second (male) parent in biparental crosses (also allowed in hermaphroditic models for inheritance that is always from the second parent).</p>
5052
<p class="p3">Some sex-chromosome types are supported only in sexual models:</p>
5153
<p class="p5"><span class="s3">"X"</span> (X), specifying an X chromosome that is diploid (XX) in females, haploid (X–) in males.</p>
5254
<p class="p5"><span class="s3">"Y"</span> (Y), specifying a Y chromosome that is haploid (Y) in males, absent (–) in females.</p>
5355
<p class="p5"><span class="s3">"Z"</span> (Z), specifying a Z chromosome that is diploid (ZZ) in males, haploid (–Z) in females.</p>
5456
<p class="p5"><span class="s3">"W"</span> (W), specifying a W chromosome that is haploid (W) in females, absent (–) in males.</p>
5557
<p class="p3">And there are some haploid chromosome types that are also supported only in sexual models:</p>
56-
<p class="p5"><span class="s3">"HF"</span> (haploid female-inherited), specifying a haploid autosomal chromosome that is inherited by both sexes from the first (female) parent in biparental crosses.</p>
5758
<p class="p5"><span class="s3">"FL"</span> (female line), specifying a haploid autosomal chromosome that is inherited only by females, from the female parent, and is represented by a null haplosome in males.</p>
58-
<p class="p5"><span class="s3">"HM"</span> (haploid male-inherited), specifying a haploid autosomal chromosome that is inherited by both sexes from the second (male) parent in biparental crosses.</p>
5959
<p class="p5"><span class="s3">"ML"</span> (male line), specifying a haploid autosomal chromosome that is inherited only by males, from the male parent, and is represented by a null haplosome in females.</p>
6060
<p class="p3">Finally, two additional values of <span class="s3">type</span>, <span class="s3">"H-"</span> and <span class="s3">"-Y"</span>, are supported for backward compatibility (not intended for use in new models).<span class="Apple-converted-space">  </span>They are discussed in the <span class="s3">Chromosome</span> documentation.</p>
6161
<p class="p3">The <span class="s3">mutationRuns</span> parameter specifies how many mutation runs the chromosome should use.<span class="Apple-converted-space">  </span>Internally, SLiM divides haplosomes into a sequence of consecutive mutation runs, allowing more efficient internal computations.<span class="Apple-converted-space">  </span>The optimal mutation run length is short enough that each mutation run is relatively unlikely to be modified by mutation/recombination events when inherited, but long enough that each mutation run is likely to contain a relatively large number of mutations; these priorities are in tension, so an intermediate balance between them is generally optimal.<span class="Apple-converted-space">  </span>The optimal number of mutation runs will depend on the model’s details, and may also depend upon the machine and even the compiler used to build SLiM.<span class="Apple-converted-space">  </span>If the <span class="s3">mutationRuns</span> parameter is not <span class="s3">0</span>, SLiM will use the value given as the number of mutation runs inside <span class="s3">Haplosome</span> objects for the chromosome.<span class="Apple-converted-space">  </span>If <span class="s3">mutationRuns</span> is <span class="s3">0</span> (the default), then the behavior depends upon a parameter to the <span class="s3">initializeSLiMOptions()</span> function, <span class="s3">doMutationRunExperiments</span>.<span class="Apple-converted-space">  </span>If that flag is <span class="s3">F</span>, the behavior here is as if <span class="s3">mutationRuns=1</span> had been passed: one mutation run will be used, and mutation run experiments will not be conducted.<span class="Apple-converted-space">  </span>If that flag is <span class="s3">T</span> (the default), then for <span class="s3">mutationRuns=0</span> SLiM will conduct experiments at runtime, using different mutation run counts, to try to determine the number of mutation runs that produces the best performance.<span class="Apple-converted-space">  </span>The value that SLiM’s experiments determine may not be optimal, however, and in any case there is some overhead associated with conducting these experiments; for maximal performance it can thus be beneficial to determine the true optimal value for the simulation yourself, and set it explicitly using this parameter. Specifying the number of mutation runs is an advanced technique, but in some cases it can improve performance significantly.</p>

SLiMgui/SLiMHelpClasses.rtf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,7 +2971,7 @@ The value of
29712971
\f3\fs18 "H-"
29722972
\f4\fs20 , and
29732973
\f3\fs18 "-Y"
2974-
\f4\fs20 ), the first haplosome is assumed to be from the first parent, and is thus included, whereas the second haplosome is assumed to be from the second parent and is thus not included. For chromosomes with one associated haplosome that is inherited from the female parent in one way or another (types
2974+
\f4\fs20 ), the first haplosome is assumed to be from the first parent, and is thus included, whereas the second haplosome is assumed to be from the second parent and is thus not included. For chromosomes with one associated haplosome that is inherited from the female/first parent in one way or another (types
29752975
\f3\fs18 "W"
29762976
\f4\fs20 ,
29772977
\f3\fs18 "HF"
@@ -3019,7 +3019,7 @@ The value of
30193019
\f3\fs18 "H-"
30203020
\f4\fs20 , and
30213021
\f3\fs18 "-Y"
3022-
\f4\fs20 ), the second haplosome is assumed to be from the second parent, and is thus included, whereas the first haplosome is assumed to be from the first parent and is thus not included. For chromosomes with one associated haplosome that is inherited from the male parent in one way or another (types
3022+
\f4\fs20 ), the second haplosome is assumed to be from the second parent, and is thus included, whereas the first haplosome is assumed to be from the first parent and is thus not included. For chromosomes with one associated haplosome that is inherited from the male/second parent in one way or another (types
30233023
\f3\fs18 "Y"
30243024
\f4\fs20 ,
30253025
\f3\fs18 "HM"

0 commit comments

Comments
 (0)