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
<p class="p4">Set the cloning rate of this subpopulation.<span class="Apple-converted-space"> </span>The rate is changed to <span class="s1">rate</span>, which should be between 0.0 and 1.0, inclusive (see the SLiM manual for further details).<span class="Apple-converted-space"> </span>Clonal reproduction can be enabled in both non-sexual (i.e. hermaphroditic) and sexual simulations.<span class="Apple-converted-space"> </span>In non-sexual simulations, <span class="s1">rate</span> must be a singleton value representing the overall clonal reproduction rate for the subpopulation.<span class="Apple-converted-space"> </span>In sexual simulations, <span class="s1">rate</span> may be either a singleton (specifying the clonal reproduction rate for both sexes) or a vector containing two numeric values (the female and male cloning rates specified separately, at indices <span class="s1">0</span> and <span class="s1">1</span> respectively).<span class="Apple-converted-space"> </span>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.</p>
<p class="p4">Set the migration rates to this subpopulation from the subpopulations in <span class="s1">sourceSubpops</span> to the corresponding rates specified in <span class="s1">rates</span>; in other words, <span class="s1">rates</span> gives the expected fractions of the children in this subpopulation that will subsequently be generated from parents in the subpopulations <span class="s1">sourceSubpops</span> (see the SLiM manual for further details).<span class="Apple-converted-space"> </span>This method will only set the migration fractions from the subpopulations given; migration rates from other subpopulations will be left unchanged (explicitly set a zero rate to turn off migration from a given subpopulation).<span class="Apple-converted-space"> </span>The type of <span class="s1">sourceSubpops</span> may be either <span class="s1">integer</span>, specifying subpopulations by identifier, or <span class="s1">object</span>, specifying subpopulations directly.</p>
1316
+
<p class="p6">Set the migration rates to this subpopulation from the subpopulations in <span class="s1">sourceSubpops</span> to the corresponding rates specified in <span class="s1">rates</span>; in other words, <span class="s1">rates</span> gives the expected fractions of the children in this subpopulation that will subsequently be generated from parents in the subpopulations <span class="s1">sourceSubpops</span> (see section 24.2.1).<span class="Apple-converted-space"> </span>The <span class="s1">rates</span> parameter may be a singleton value, in which case that rate is used for all subpopulations in <span class="s1">sourceSubpops</span>.<span class="Apple-converted-space"> </span>This method will only set the migration fractions from the subpopulations given; migration rates from other subpopulations will be left unchanged (explicitly set a zero rate to turn off migration from a given subpopulation).<span class="Apple-converted-space"> </span>The type of <span class="s1">sourceSubpops</span> may be either <span class="s1">integer</span>, specifying subpopulations by identifier, or <span class="s1">object</span>, specifying subpopulations directly.</p>
1317
+
<p class="p6">In general it is illegal to try to set the migration rate into a subpopulation from itself; that rate is, by definition, equal to the remainder after all migration from other subpopulations.<span class="Apple-converted-space"> </span>As a special case for convenience, it is legal to set a rate of <span class="s1">0.0</span> for all subpopulations in the species, including the target subpopulation.<span class="Apple-converted-space"> </span>For example, <span class="s1">subpops.setMigrationRates(allSubpops, 0.0)</span> will turn off all migration into the subpopulations in <span class="s1">subpops</span>.<span class="Apple-converted-space"> </span>The given rate of <span class="s1">0.0</span> from a subpop into itself is simply ignored, for this specific case only.</p>
<p class="p4">Set the selfing rate of this subpopulation.<span class="Apple-converted-space"> </span>The rate is changed to <span class="s1">rate</span>, which should be between 0.0 and 1.0, inclusive (see the SLiM manual for further details).<span class="Apple-converted-space"> </span>Selfing can only be enabled in non-sexual (i.e. hermaphroditic) simulations.<span class="Apple-converted-space"> </span>During mating and offspring generation, the probability that any given offspring individual will be generated by selfing – by self-fertilization via gametes produced by meiosis by a single parent – will be equal to the selfing rate set in the parental (not the offspring!) subpopulation.</p>
\f4\fs20 \cf0 Set the migration rates to this subpopulation from the subpopulations in
13666
+
\f4\fs20 \cf2 Set the migration rates to this subpopulation from the subpopulations in
13667
13667
\f3\fs18 sourceSubpops
13668
13668
\f4\fs20 to the corresponding rates specified in
13669
13669
\f3\fs18 rates
13670
13670
\f4\fs20 ; in other words,
13671
13671
\f3\fs18 rates
13672
13672
\f4\fs20 gives the expected fractions of the children in this subpopulation that will subsequently be generated from parents in the subpopulations
13673
13673
\f3\fs18 sourceSubpops
13674
-
\f4\fs20 (see the SLiM manual for further details). This method will only set the migration fractions from the subpopulations given; migration rates from other subpopulations will be left unchanged (explicitly set a zero rate to turn off migration from a given subpopulation). The type of
13674
+
\f4\fs20 (see section 24.2.1). The
13675
+
\f3\fs18 rates
13676
+
\f4\fs20 parameter may be a singleton value, in which case that rate is used for all subpopulations in
13677
+
\f3\fs18 sourceSubpops
13678
+
\f4\fs20 . This method will only set the migration fractions from the subpopulations given; migration rates from other subpopulations will be left unchanged (explicitly set a zero rate to turn off migration from a given subpopulation). The type of
13675
13679
\f3\fs18 sourceSubpops
13676
13680
\f4\fs20 may be either
13677
13681
\f3\fs18 integer
13678
13682
\f4\fs20 , specifying subpopulations by identifier, or
13679
13683
\f3\fs18 object
13680
-
\f4\fs20 , specifying subpopulations directly.
13681
-
\f5 \
13684
+
\f4\fs20 , specifying subpopulations directly.\
13685
+
In general it is illegal to try to set the migration rate into a subpopulation from itself; that rate is, by definition, equal to the remainder after all migration from other subpopulations. As a special case for convenience, it is legal to set a rate of
13686
+
\f3\fs18 0.0
13687
+
\f4\fs20 for all subpopulations in the species, including the target subpopulation. For example,
policy change: the nucleotide and nucleotideValue properties of Substitution are now read-only (I think it was a bug that they were ever read-write...?)
86
86
fix #564, initializeMutationRateFromFile() needs a `sex` parameter; I'm doing this in multitrait to avoid the annoying doc conflicts
87
+
fix #570, setMigrationRates() should make it easier to stop all migration (done in multitrait to avoid the annoying doc conflicts)
88
+
specifically, this entails two changes:
89
+
allow a singleton migration rate value, applied for all subpops given
90
+
allow the destination subpop to be given as a source, iff all rates supplied are 0.0, to stop all migration: allSubpops.setMigrationRates(allSubpops, 0.0)
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_setMigrationRates): setMigrationRates() requires sourceSubpops and rates to be equal in size." << EidosTerminate();
8980
+
if ((source_subpops_count != rates_count) && (rates_count != 1))
8981
+
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_setMigrationRates): setMigrationRates() requires sourceSubpops and rates to be equal in size, or rates to be singleton." << EidosTerminate();
8981
8982
8982
8983
for (int value_index = 0; value_index < source_subpops_count; ++value_index)
// BCH 11/16/2025: We used to require that the target subpop was not a member of sourceSubpops; we would
8990
+
// raise an error in all cases if that occurred. Now we relax those rules slightly, to make it easier
8991
+
// to zero out all immigration into a subpop or subpops; we allow self-reference, but *only* if *all*
8992
+
// rates specified in the call are 0.0. So you can do, e.g., allSubpops.setMigrationRates(allSubpops, 0).
8993
+
// See https://github.com/MesserLab/SLiM/issues/570. As part of that fix, we also now allow rates to
8994
+
// provide a singleton value, used for all sourceSubpops.
8995
+
if (migrant_fraction != 0.0)
8996
+
saw_nonzero_rate = true;
8987
8997
if (source_subpop_id == subpopulation_id_)
8988
-
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_setMigrationRates): setMigrationRates() does not allow migration to be self-referential (originating within the destination subpopulation)." << EidosTerminate();
8998
+
saw_self_reference = true;
8999
+
if (saw_self_reference && saw_nonzero_rate)
9000
+
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_setMigrationRates): setMigrationRates() does not allow migration to be self-referential (originating within the destination subpopulation), except when all rates are zero (for convenience)." << EidosTerminate();
9001
+
9002
+
// can't specify the same source subpopulation twice
8989
9003
if (std::find(subpops_seen.begin(), subpops_seen.end(), source_subpop_id) != subpops_seen.end())
8990
9004
EIDOS_TERMINATION << "ERROR (Subpopulation::ExecuteMethod_setMigrationRates): setMigrationRates() two rates set for subpopulation p" << source_subpop_id << "." << EidosTerminate();
0 commit comments