Skip to content

Commit

Permalink
add a sharedParentCount() method on Individual
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaller committed Sep 3, 2023
1 parent 0f79294 commit 931a33f
Show file tree
Hide file tree
Showing 12 changed files with 391 additions and 80 deletions.
48 changes: 31 additions & 17 deletions QtSLiM/help/SLiMHelpClasses.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion QtSLiM/help/SLiMHelpFunctions.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<p class="p3"><span class="s1">If </span><span class="s2">initializeSLiMModelType()</span><span class="s1"> is called at all then it must be called before any other initialization function, so that SLiM knows from the outset which features are enabled and which are not.</span></p>
<p class="p2">(void)initializeSLiMOptions([logical$ keepPedigrees = F], [string$ dimensionality = ""], [string$ periodicity = ""], [integer$ mutationRuns = 0], [logical$ preventIncidentalSelfing = F]<span class="s4">, [logical$ nucleotideBased = F], [logical$ randomizeCallbacks = T]</span>)</p>
<p class="p3"><span class="s1">Configure options for the simulation.<span class="Apple-converted-space">  </span>If </span><span class="s2">initializeSLiMOptions()</span><span class="s1"> is called at all then it must be called before any other initialization function (except </span><span class="s2">initializeSLiMModelType()</span><span class="s1">), so that SLiM knows from the outset which optional features are enabled and which are not.</span></p>
<p class="p3">If <span class="s3">keepPedigrees</span> is <span class="s3">T</span>, SLiM will keep pedigree information for every individual in the simulation, tracking the identity of its parents and grandparents.<span class="Apple-converted-space">  </span>This allows individuals to assess their degree of pedigree-based relatedness to other individuals (see <span class="s3">Individual</span>’s <span class="s3">relatedness()</span> method), as well as allowing a model to find “trios” (two parents and an offspring they generated) using the pedigree properties of <span class="s3">Individual</span>.<span class="Apple-converted-space">  </span>As a side effect of <span class="s3">keepPedigrees</span> being <span class="s3">T</span>, the <span class="s3">pedigreeID</span>, <span class="s3">pedigreeParentIDs</span>, and <span class="s3">pedigreeGrandparentIDs</span> properties of <span class="s3">Individual</span> will have defined values, as will the <span class="s3">genomePedigreeID</span> property of <span class="s3">Genome</span>.<span class="Apple-converted-space">  </span>Note that pedigree-based relatedness doesn’t necessarily correspond to genetic relatedness, due to effects such as assortment and recombination.<span class="Apple-converted-space">  </span>Beginning in SLiM 3.5, <span class="s3">keepPedigrees=T</span> also enables tracking of individual reproductive output, available through the <span class="s3">reproductiveOutput</span> property of <span class="s3">Individual</span> and the <span class="s3">lifetimeReproductiveOutput</span> property of <span class="s3">Subpopulation</span>.</p>
<p class="p3">If <span class="s3">keepPedigrees</span> is <span class="s3">T</span>, SLiM will keep pedigree information for every individual in the simulation, tracking the identity of its parents and grandparents.<span class="Apple-converted-space">  </span>This allows individuals to assess their degree of pedigree-based relatedness to other individuals (see <span class="s3">Individual</span>’s <span class="s3">relatedness()</span> and <span class="s3">sharedParentCount()</span> methods), as well as allowing a model to find “trios” (two parents and an offspring they generated) using the pedigree properties of <span class="s3">Individual</span>.<span class="Apple-converted-space">  </span>As a side effect of <span class="s3">keepPedigrees</span> being <span class="s3">T</span>, the <span class="s3">pedigreeID</span>, <span class="s3">pedigreeParentIDs</span>, and <span class="s3">pedigreeGrandparentIDs</span> properties of <span class="s3">Individual</span> will have defined values, as will the <span class="s3">genomePedigreeID</span> property of <span class="s3">Genome</span>.<span class="Apple-converted-space">  </span>Note that pedigree-based relatedness doesn’t necessarily correspond to genetic relatedness, due to effects such as assortment and recombination.<span class="Apple-converted-space">  </span>Beginning in SLiM 3.5, <span class="s3">keepPedigrees=T</span> also enables tracking of individual reproductive output, available through the <span class="s3">reproductiveOutput</span> property of <span class="s3">Individual</span> and the <span class="s3">lifetimeReproductiveOutput</span> property of <span class="s3">Subpopulation</span>.</p>
<p class="p5">If <span class="s3">dimensionality</span> is not <span class="s3">""</span>, SLiM will enable its optional “continuous space” facility.<span class="Apple-converted-space">  </span>Three values for <span class="s3">dimensionality</span> are presently supported: <span class="s3">"x"</span>, <span class="s3">"xy"</span>, and <span class="s3">"xyz"</span>, specifying that continuous space should be enabled for one, two, or three dimensions, respectively, using (<i>x</i>), (<i>x</i>, <i>y</i>), and (<i>x</i>, <i>y</i>, <i>z</i>) coordinates respectively.<span class="Apple-converted-space">  </span>This has a number of side effects.<span class="Apple-converted-space">  </span>First of all, it means that the specified properties of <span class="s3">Individual</span> (<span class="s3">x</span>, <span class="s3">y</span>, and/or <span class="s3">z</span>) will be interpreted by SLiM as spatial positions; in particular, SLiMgui will use those properties to display subpopulations spatially.<span class="Apple-converted-space">  </span>Second, it allows spatial interactions to be defined, evaluated, and queried using <span class="s3">initializeInteractionType()</span> and <span class="s3">interaction()</span> callbacks.<span class="Apple-converted-space">  </span>And third, it enables the use of any other properties and methods related to continuous space, such as setting the spatial boundaries of subpopulations, which would otherwise raise an error.</p>
<p class="p3"><span class="s1">If </span><span class="s2">periodicity</span><span class="s1"> is not </span><span class="s2">""</span><span class="s1">, SLiM will designate the specified spatial dimensions as being periodic – wrapping around at the edges of the spatial boundaries of that dimension.<span class="Apple-converted-space">  </span>This option may only be used if the </span><span class="s2">dimensionality</span><span class="s1"> parameter to </span><span class="s2">initializeSLiMOptions()</span><span class="s1"> has been used to enable spatiality in the model, and only spatial dimensions that were specified in the dimensionality of the model may be declared to be periodic (but if desired, it is permissible to make just a subset of those dimensions periodic; it is not an all-or-none proposition).<span class="Apple-converted-space">  </span>For example, if the specified dimensionality is </span><span class="s2">"xy"</span><span class="s1">, the model’s periodicity may be </span><span class="s2">"x"</span><span class="s1">, </span><span class="s2">"y"</span><span class="s1">, or </span><span class="s2">"xy"</span><span class="s1"> (or </span><span class="s2">""</span><span class="s1">, the default, to specify that there are no periodic dimensions).<span class="Apple-converted-space">  </span>A one-dimensional periodic model would model a space like the perimeter of a circle.<span class="Apple-converted-space">  </span>A two-dimensional model periodic in one of those dimensions would model a space like a cylinder without its end caps; if periodic in both dimensions, the modeled space is a torus.<span class="Apple-converted-space">  </span>The shapes of three-dimensional periodic models are harder to visualize, but are essentially higher-dimensional analogues of these concepts.<span class="Apple-converted-space">  </span>Periodic boundary conditions are commonly used to model spatial scenarios without “edge effects”, since there are no edges in the periodic spatial dimensions.<span class="Apple-converted-space">  </span>The </span><span class="s2">pointPeriodic()</span><span class="s1"> method of </span><span class="s2">Subpopulation</span><span class="s1"> is typically used in conjunction with this option, to actually implement the periodic boundary condition for the specified dimensions.</span></p>
<p class="p5">If <span class="s3">mutationRuns</span> is not <span class="s3">0</span>, SLiM will use the value given as the number of mutation runs inside <span class="s3">Genome</span> objects; if it is <span class="s3">0</span> (the default), SLiM will calculate a number of mutation runs that it estimates will work well.<span class="Apple-converted-space">  </span>Internally, SLiM divides genomes 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 desirable.<span class="Apple-converted-space">  </span>The optimal number of mutation runs will depend upon the machine and even the compiler used to build SLiM, so SLiM’s default value may not be optimal; for maximal performance it can thus be beneficial to experiment with different values and find the optimal value for the simulation.<span class="Apple-converted-space">  </span>Specifying the number of mutation runs is an advanced technique, but in certain cases it can improve performance significantly; in particular, if a simulation involves a very long chromosome but only a small portion of that chromosome is actually used by the simulation, it may be beneficial to specify that a single mutation run be used with <span class="s3">mutationRuns=1</span><span class="s6">.</span></p>
Expand Down
Loading

0 comments on commit 931a33f

Please sign in to comment.