Skip to content

Commit a65f82d

Browse files
committed
change policy on the default symbol for an implicit chromosome
1 parent 10ae8d3 commit a65f82d

File tree

6 files changed

+59
-22
lines changed

6 files changed

+59
-22
lines changed

QtSLiM/help/SLiMHelpClasses.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
<p class="p3">species =&gt; (object&lt;Species&gt;$)</p>
131131
<p class="p6"><span class="s3">The species to which the target object belongs.</span></p>
132132
<p class="p5">symbol =&gt; (string$)</p>
133-
<p class="p6">The symbol for the chromosome, as given to <span class="s1">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>For an implicitly defined chromosome, the <span class="s1">symbol</span> will be <span class="s1">"1"</span>.<span class="Apple-converted-space">  </span>The <span class="s1">symbol</span> can be used to refer to the chromosome; see also <span class="s1">id</span>.</p>
133+
<p class="p6">The symbol for the chromosome, as given to <span class="s1">initializeChromosome()</span>; see the documentation for that function.<span class="Apple-converted-space">  </span>For an implicitly defined chromosome, the symbol is <span class="s1">"A"</span> for non-sexual models, and for sexual models (for historical reasons) is determined by the model type passed to <span class="s1">initializeSex()</span> as documented there.<span class="Apple-converted-space">  </span>The <span class="s1">symbol</span> can be used to refer to the chromosome; see also <span class="s1">id</span>.</p>
134134
<p class="p3">tag &lt;–&gt; (integer$)</p>
135135
<p class="p4">A user-defined <span class="s1">integer</span> value.<span class="Apple-converted-space">  </span>The value of <span class="s1">tag</span> is initially undefined<span class="s7">, and it is an error to try to read it</span>; if you wish it to have a defined value, you must arrange that yourself by explicitly setting its value prior to using it elsewhere in your code.<span class="Apple-converted-space">  </span>The value of <span class="s1">tag</span> is not used by SLiM; it is free for you to use.</p>
136136
<p class="p5">type =&gt; (string$)</p>

QtSLiM/help/SLiMHelpFunctions.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@
111111
<p class="p3">There are two ways to call this function.<span class="Apple-converted-space">  </span>If the optional <span class="s3">ends</span> parameter is <span class="s3">NULL</span> (the default), then <span class="s3">rates</span> must be a singleton value that specifies a single recombination rate to be used along the entire chromosome.<span class="Apple-converted-space">  </span>If, on the other hand, <span class="s3">ends</span> is supplied, then <span class="s3">rates</span> and <span class="s3">ends</span> must be the same length, and the values in <span class="s3">ends</span> must be specified in ascending order.<span class="Apple-converted-space">  </span>In that case, <span class="s3">rates</span> and <span class="s3">ends</span> taken together specify the recombination rates to be used along successive contiguous stretches of the chromosome, from beginning to end; the last position specified in <span class="s3">ends</span> should extend to the end of the chromosome (i.e. at least to the end of the last genomic element, if not further).</p>
112112
<p class="p3">If the optional <span class="s3">sex</span> parameter is <span class="s3">"*"</span> (the default), then the supplied recombination rate map will be used for both sexes (which is the only option for hermaphroditic simulations).<span class="Apple-converted-space">  </span>In sexual simulations <span class="s3">sex</span> may be <span class="s3">"M"</span> or <span class="s3">"F"</span> instead, in which case the supplied recombination map is used only for that sex.<span class="Apple-converted-space">  </span>In this case, two calls must be made to <span class="s3">initializeRecombinationRate()</span>, one for each sex, even if a rate of zero is desired for the other sex; no default recombination map is supplied.</p>
113113
<p class="p4">(void)initializeSex([Ns$ chromosomeType = NULL])</p>
114-
<p class="p3">Enable sex in the simulation.<span class="Apple-converted-space">  </span>Beginning in SLiM 5, this method should generally be passed <span class="s3">NULL</span>, simply indicating that sex should be enabled: individuals will be male and female (rather than hermaphroditic), biparental crosses will be required to be between a female first parent and a male second parent, and selfing will not be allowed.<span class="Apple-converted-space">  </span>There is no way to disable sex once it has been enabled; if you don’t want to have sex, don’t call this function.</p>
115-
<p class="p3">In this new configuration style, if a sexual simulation involving sex chromosomes is desired, the new <span class="s3">initializeChromosome()</span> call should be used to configure the chromosome setup for the simulation (see the <span class="s3">initializeChromosome()</span> documentation in section 25.1).</p>
116-
<p class="p3">For backward compatibility, the old style of configuring a sexual simulation is still supported, however.<span class="Apple-converted-space">  </span>In this style, the argument <span class="s3">chromosomeType</span> gives the type of chromosome to be simulated; this should be <span class="s3">"A"</span>, <span class="s3">"X"</span>, or <span class="s3">"Y"</span>.<span class="Apple-converted-space">  </span>These correspond to the new chromosome types <span class="s3">"A"</span>, <span class="s3">"X"</span>, and <span class="s3">"-Y"</span> (not <span class="s3">"Y"</span>), respectively, when using <span class="s3">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>This old style of chromosome configuration is much less flexible, however, allowing fewer chromosome types, and only allowing a single chromosome to be set up.<span class="Apple-converted-space">  </span>This backward compatibility mode may be removed for SLiM in the future, and should be considered deprecated.</p>
114+
<p class="p3">Enable sex in the simulation.<span class="Apple-converted-space">  </span>Beginning in SLiM 5, this method should generally be passed <span class="s3">NULL</span>, simply indicating that sex should be enabled: individuals will then be male and female (rather than hermaphroditic), biparental crosses will be required to be between a female first parent and a male second parent, and selfing will not be allowed.<span class="Apple-converted-space">  </span>In this new configuration style, if a sexual simulation involving sex chromosomes is desired, the new <span class="s3">initializeChromosome()</span> call should be used to configure the chromosome setup for the simulation.</p>
115+
<p class="p3">For backward compatibility, the old style of configuring a sexual simulation is still supported, however.<span class="Apple-converted-space">  </span>This implicitly defines a single chromosome, without a call to <span class="s3">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>With this old configuration approach, the <span class="s3">chromosomeType</span> parameter to <span class="s3">initializeSex()</span> gives the type of chromosome that should be simulated; this should be <span class="s3">"A"</span>, <span class="s3">"X"</span>, or <span class="s3">"Y"</span>, and this <span class="s3">chromosomeType</span> value will be used as the symbol (<span class="s3">"A"</span>, <span class="s3">"X"</span>, or <span class="s3">"Y"</span>) for the implicit chromosome.<span class="Apple-converted-space">  </span>These legacy chromosome types correspond to the new chromosome types <span class="s3">"A"</span>, <span class="s3">"X"</span>, and <span class="s3">"-Y"</span> respectively (note that it is <i>not</i> <span class="s3">"Y"</span>), when using <span class="s3">initializeChromosome()</span>.<span class="Apple-converted-space">  </span>The implicit chromosome’s <span class="s3">id</span> property is always <span class="s3">1</span>.<span class="Apple-converted-space">  </span>This old style of chromosome configuration is much less flexible, however, allowing only these three chromosome types, and only allowing a single chromosome to be set up.<span class="Apple-converted-space">  </span>This backward compatibility mode may be removed for SLiM in the future, and should be considered deprecated; new models should call <span class="s3">initializeChromosome()</span> explicitly instead.</p>
116+
<p class="p3">There is no way to disable sex once it has been enabled; if you don’t want to have sex, don’t call this function.<span class="Apple-converted-space">  </span>If you require more flexibility with mating types and reproductive strategies than SLiM’s built-in support for sex provides, do not call <span class="s3">initializeSex()</span>; instead, track the sex or mating type of individuals yourself in script (with the <span class="s3">tag</span> property of <span class="s3">Individual</span>, 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.</p>
117117
<p class="p9"><span class="s8"><b>The </b></span><span class="s9"><b>xDominanceCoeff</b></span><span class="s8"><b> parameter has been deprecated and removed.</b><span class="Apple-converted-space">  </span>In SLiM 5 and later, use the </span><span class="s9">hemizygousDominanceCoeff</span><span class="s8"> property of </span><span class="s9">MutationType</span><span class="s8"> instead.<span class="Apple-converted-space">  </span></span>If the <span class="s3">chromosomeType</span> is <span class="s3">"X"</span>, the optional <span class="s3">xDominanceCoeff</span> parameter can supply the dominance coefficient used when a mutation is present in an XY male, and is thus “heterozygous” (but in a different sense than the heterozygosity of an XX female with one copy of the mutation).</p>
118118
<p class="p2">(void)initializeSLiMModelType(string$ modelType)</p>
119119
<p class="p3"><span class="s1">Configure the type of SLiM model used for the simulation.<span class="Apple-converted-space">  </span>At present, one of two model types may be selected.<span class="Apple-converted-space">  </span>If </span><span class="s2">modelType</span><span class="s1"> is </span><span class="s2">"WF"</span><span class="s1">, SLiM will use a Wright-Fisher (WF) model; this is the model type that has always been supported by SLiM, and is the model type used if </span><span class="s2">initializeSLiMModelType()</span><span class="s1"> is not called.<span class="Apple-converted-space">  </span>If </span><span class="s2">modelType</span><span class="s1"> is </span><span class="s2">"nonWF"</span><span class="s1">, SLiM will use a non-Wright-Fisher (nonWF) model instead; this is a new model type supported by SLiM 3.0 and above.</span></p>

SLiMgui/SLiMHelpClasses.rtf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,11 +397,11 @@ The species to which the target object belongs.\
397397

398398
\f4\fs20 \cf2 The symbol for the chromosome, as given to
399399
\f3\fs18 initializeChromosome()
400-
\f4\fs20 . For an implicitly defined chromosome, the
401-
\f3\fs18 symbol
402-
\f4\fs20 will be
403-
\f3\fs18 "1"
404-
\f4\fs20 . The
400+
\f4\fs20 ; see the documentation for that function. For an implicitly defined chromosome, the symbol is
401+
\f3\fs18 "A"
402+
\f4\fs20 for non-sexual models, and for sexual models (for historical reasons) is determined by the model type passed to
403+
\f3\fs18 initializeSex()
404+
\f4\fs20 as documented there. The
405405
\f3\fs18 symbol
406406
\f4\fs20 can be used to refer to the chromosome; see also
407407
\f3\fs18 id

SLiMgui/SLiMHelpFunctions.rtf

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -939,31 +939,55 @@ If the optional
939939

940940
\f2\fs20 \cf2 Enable sex in the simulation. Beginning in SLiM 5, this method should generally be passed
941941
\f1\fs18 NULL
942-
\f2\fs20 , simply indicating that sex should be enabled: individuals will be male and female (rather than hermaphroditic), biparental crosses will be required to be between a female first parent and a male second parent, and selfing will not be allowed. There is no way to disable sex once it has been enabled; if you don\'92t want to have sex, don\'92t call this function.\
943-
In this new configuration style, if a sexual simulation involving sex chromosomes is desired, the new
942+
\f2\fs20 , simply indicating that sex should be enabled: individuals will then be male and female (rather than hermaphroditic), biparental crosses will be required to be between a female first parent and a male second parent, and selfing will not be allowed. In this new configuration style, if a sexual simulation involving sex chromosomes is desired, the new
944943
\f1\fs18 initializeChromosome()
945-
\f2\fs20 call should be used to configure the chromosome setup for the simulation (see the
944+
\f2\fs20 call should be used to configure the chromosome setup for the simulation.\
945+
For backward compatibility, the old style of configuring a sexual simulation is still supported, however. This implicitly defines a single chromosome, without a call to
946946
\f1\fs18 initializeChromosome()
947-
\f2\fs20 documentation in section 25.1).\
948-
For backward compatibility, the old style of configuring a sexual simulation is still supported, however. In this style, the argument
947+
\f2\fs20 . With this old configuration approach, the
949948
\f1\fs18 chromosomeType
950-
\f2\fs20 gives the type of chromosome to be simulated; this should be
949+
\f2\fs20 parameter to
950+
\f1\fs18 initializeSex()
951+
\f2\fs20 gives the type of chromosome that should be simulated; this should be
952+
\f1\fs18 "A"
953+
\f2\fs20 ,
954+
\f1\fs18 "X"
955+
\f2\fs20 , or
956+
\f1\fs18 "Y"
957+
\f2\fs20 , and this
958+
\f1\fs18 chromosomeType
959+
\f2\fs20 value will be used as the symbol (
951960
\f1\fs18 "A"
952961
\f2\fs20 ,
953962
\f1\fs18 "X"
954963
\f2\fs20 , or
955964
\f1\fs18 "Y"
956-
\f2\fs20 . These correspond to the new chromosome types
965+
\f2\fs20 ) for the implicit chromosome. These legacy chromosome types correspond to the new chromosome types
957966
\f1\fs18 "A"
958967
\f2\fs20 ,
959968
\f1\fs18 "X"
960969
\f2\fs20 , and
961970
\f1\fs18 "-Y"
962-
\f2\fs20 (not
971+
\f2\fs20 respectively (note that it is
972+
\f3\i not
973+
\f2\i0
963974
\f1\fs18 "Y"
964-
\f2\fs20 ), respectively, when using
975+
\f2\fs20 ), when using
965976
\f1\fs18 initializeChromosome()
966-
\f2\fs20 . This old style of chromosome configuration is much less flexible, however, allowing fewer chromosome types, and only allowing a single chromosome to be set up. This backward compatibility mode may be removed for SLiM in the future, and should be considered deprecated.\
977+
\f2\fs20 . The implicit chromosome\'92s
978+
\f1\fs18 id
979+
\f2\fs20 property is always
980+
\f1\fs18 1
981+
\f2\fs20 . This old style of chromosome configuration is much less flexible, however, allowing only these three chromosome types, and only allowing a single chromosome to be set up. This backward compatibility mode may be removed for SLiM in the future, and should be considered deprecated; new models should call
982+
\f1\fs18 initializeChromosome()
983+
\f2\fs20 explicitly instead.\
984+
There is no way to disable sex once it has been enabled; if you don\'92t want to have sex, don\'92t call this function. If you require more flexibility with mating types and reproductive strategies than SLiM\'92s built-in support for sex provides, do not call
985+
\f1\fs18 initializeSex()
986+
\f2\fs20 ; instead, track the sex or mating type of individuals yourself in script (with the
987+
\f1\fs18 tag
988+
\f2\fs20 property of
989+
\f1\fs18 Individual
990+
\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.\
967991
\pard\pardeftab397\li547\ri720\sb60\sa60\partightenfactor0
968992

969993
\f0\b \cf2 The
@@ -1136,7 +1160,6 @@ If
11361160
\f1\fs18 initializeChromosome()
11371161
\f2\fs20 , allowing a different mutation run count to be specified for each chromosome in multi-chromosome models.\expnd0\expndtw0\kerning0
11381162
\
1139-
\pard\pardeftab720\li547\ri720\sb60\sa60\partightenfactor0
11401163
\cf0 \kerning1\expnd0\expndtw0 If
11411164
\f1\fs18 preventIncidentalSelfing
11421165
\f2\fs20 is
@@ -1203,7 +1226,6 @@ If
12031226
\f2\fs20 , the order of individuals returned will be non-random (regardless of the setting of this option); you should use
12041227
\f1\fs18 sample()
12051228
\f2\fs20 to shuffle the order of the individuals vector if necessary to avoid order-dependency issues in your script.\
1206-
\pard\pardeftab720\li547\ri720\sb60\sa60\partightenfactor0
12071229
\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.\
12081230
\pard\pardeftab720\li720\fi-446\ri720\sb180\sa60\partightenfactor0
12091231

VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ development head (in the master branch):
110110
recombination() callbacks can now be optionally declared with a chromosome specifier (id or symbol), to apply to just one chromosome
111111
registerRecombinationCallback() now takes an optional chromosome parameter to specify that focal chromosome
112112
fix up the calc...() functions for multiple chromosomes, and to be robust to the case of zero mutations (existing at all, or within the supplied haplosomes), and to improve error-checking and documentation
113+
the default symbol for implicit chromosomes should be "A", "X", or "Y", so output formats don't change for legacy models
113114

114115

115116
version 4.3 (Eidos version 3.3):

core/species.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,22 @@ void Species::MakeImplicitChromosome(ChromosomeType p_type)
317317
if (num_chromosome_inits_ != 0)
318318
EIDOS_TERMINATION << "ERROR (Species::MakeImplicitChromosome): (internal error) explicit chromosome already exists." << EidosTerminate();
319319

320+
// Only these three chromosome types are supported for an implicitly defined chromosome. The symbols used
321+
// here match the symbols that were output for chromosome types in various built-in output methods prior to
322+
// SLiM 5, for backward compatibility.
323+
std::string chromosome_symbol;
324+
325+
if (p_type == ChromosomeType::kA_DiploidAutosome)
326+
chromosome_symbol = "A";
327+
else if (p_type == ChromosomeType::kX_XSexChromosome)
328+
chromosome_symbol = "X";
329+
else if (p_type == ChromosomeType::kNullY_YSexChromosomeWithNull)
330+
chromosome_symbol = "Y";
331+
else
332+
EIDOS_TERMINATION << "ERROR (Species::MakeImplicitChromosome): (internal error) unsupported implicit chromosome type." << EidosTerminate();
333+
320334
// Create an implicit Chromosome object with a retain on it from EidosDictionaryRetained::EidosDictionaryRetained()
321-
Chromosome *chromosome = new Chromosome(*this, p_type, 1, "1", /* p_index */ 0, /* p_preferred_mutcount */ 0);
335+
Chromosome *chromosome = new Chromosome(*this, p_type, 1, chromosome_symbol, /* p_index */ 0, /* p_preferred_mutcount */ 0);
322336

323337
// Add it to our registry; AddChromosome() takes its retain count
324338
AddChromosome(chromosome);

0 commit comments

Comments
 (0)