Skip to content

Commit 7ab3856

Browse files
committed
make Substitution nucleotide[Value] properties read-only
1 parent 0fc082f commit 7ab3856

5 files changed

Lines changed: 9 additions & 32 deletions

File tree

EidosScribe/EidosHelpController.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,8 @@ - (void)drawRow:(NSInteger)rowIndex clipRect:(NSRect)clipRect
12891289
@"nucleotideBased =>",
12901290
@"nucleotide <–>",
12911291
@"nucleotideValue <–>",
1292+
@"nucleotide =>",
1293+
@"nucleotideValue =>",
12921294
@"mutationMatrix =>",
12931295
@"\u00A0setMutationMatrix()",
12941296
@"\u00A0ancestralNucleotides()",

QtSLiM/help/SLiMHelpClasses.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,9 @@
13531353
<p class="p4">The tick in which this mutation fixed.</p>
13541354
<p class="p3">mutationType =&gt; (object&lt;MutationType&gt;$)</p>
13551355
<p class="p4">The <span class="s1">MutationType</span> from which this mutation was drawn.</p>
1356-
<p class="p5"><span class="s3">nucleotide &lt;–&gt; (string$)</span></p>
1356+
<p class="p5"><span class="s3">nucleotide =&gt; (string$)</span></p>
13571357
<p class="p6"><span class="s3">A </span><span class="s4">string</span><span class="s3"> representing the nucleotide associated with this mutation; this will be </span><span class="s4">"A"</span><span class="s3">, </span><span class="s4">"C"</span><span class="s3">, </span><span class="s4">"G"</span><span class="s3">, or </span><span class="s4">"T"</span><span class="s3">.<span class="Apple-converted-space">  </span>If the mutation is not nucleotide-based, this property is unavailable.</span></p>
1358-
<p class="p5"><span class="s3">nucleotideValue &lt;–&gt; (integer$)</span></p>
1358+
<p class="p5"><span class="s3">nucleotideValue =&gt; (integer$)</span></p>
13591359
<p class="p6"><span class="s3">An </span><span class="s4">integer</span><span class="s3"> representing the nucleotide associated with this mutation; this will be </span><span class="s4">0</span><span class="s3"> (A), </span><span class="s4">1</span><span class="s3"> (C), </span><span class="s4">2</span><span class="s3"> (G), or </span><span class="s4">3</span><span class="s3"> (T).<span class="Apple-converted-space">  </span>If the mutation is not nucleotide-based, this property is unavailable.</span></p>
13601360
<p class="p3">originTick =&gt; (integer$)</p>
13611361
<p class="p4">The tick in which this mutation arose.</p>

SLiMgui/SLiMHelpClasses.rtf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14056,7 +14056,7 @@ Note that this method is only for use in nonWF models, in which migration is man
1405614056
\pard\pardeftab720\li720\fi-446\ri720\sb180\sa60\partightenfactor0
1405714057

1405814058
\f3\fs18 \cf2 \expnd0\expndtw0\kerning0
14059-
nucleotide <\'96> (string$)\
14059+
nucleotide => (string$)\
1406014060
\pard\pardeftab720\li547\ri720\sb60\sa60\partightenfactor0
1406114061

1406214062
\f4\fs20 \cf2 A
@@ -14072,7 +14072,7 @@ nucleotide <\'96> (string$)\
1407214072
\f4\fs20 . If the mutation is not nucleotide-based, this property is unavailable.\
1407314073
\pard\pardeftab720\li720\fi-446\ri720\sb180\sa60\partightenfactor0
1407414074

14075-
\f3\fs18 \cf2 nucleotideValue <\'96> (integer$)\
14075+
\f3\fs18 \cf2 nucleotideValue => (integer$)\
1407614076
\pard\pardeftab720\li547\ri720\sb60\sa60\partightenfactor0
1407714077

1407814078
\f4\fs20 \cf2 An

VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ multitrait branch:
8080
Mutation: add +setHemizygousDominanceForTrait([Nio<Trait> traits = NULL], [Nif dominance = NULL]) method
8181
Mutation: add read-write <trait-name>HemizygousDominance property to Mutation
8282
Substitution: add read-only <trait-name>HemizygousDominance property
83+
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...?)
8384

8485

8586
version 5.1 (Eidos version 4.1):

core/substitution.cpp

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -516,32 +516,6 @@ void Substitution::SetProperty(EidosGlobalStringID p_property_id, const EidosVal
516516
// All of our strings are in the global registry, so we can require a successful lookup
517517
switch (p_property_id)
518518
{
519-
case gID_nucleotide:
520-
{
521-
const std::string &nucleotide = ((EidosValue_String &)p_value).StringRefAtIndex_NOCAST(0, nullptr);
522-
523-
if (nucleotide_ == -1)
524-
EIDOS_TERMINATION << "ERROR (Substitution::SetProperty): property nucleotide is only defined for nucleotide-based substitutions." << EidosTerminate();
525-
526-
if (nucleotide == gStr_A) nucleotide_ = 0;
527-
else if (nucleotide == gStr_C) nucleotide_ = 1;
528-
else if (nucleotide == gStr_G) nucleotide_ = 2;
529-
else if (nucleotide == gStr_T) nucleotide_ = 3;
530-
else EIDOS_TERMINATION << "ERROR (Substitution::SetProperty): property nucleotide may only be set to 'A', 'C', 'G', or 'T'." << EidosTerminate();
531-
return;
532-
}
533-
case gID_nucleotideValue:
534-
{
535-
int64_t nucleotide = p_value.IntAtIndex_NOCAST(0, nullptr);
536-
537-
if (nucleotide_ == -1)
538-
EIDOS_TERMINATION << "ERROR (Substitution::SetProperty): property nucleotideValue is only defined for nucleotide-based substitutions." << EidosTerminate();
539-
if ((nucleotide < 0) || (nucleotide > 3))
540-
EIDOS_TERMINATION << "ERROR (Substitution::SetProperty): property nucleotideValue may only be set to 0 (A), 1 (C), 2 (G), or 3 (T)." << EidosTerminate();
541-
542-
nucleotide_ = (int8_t)nucleotide;
543-
return;
544-
}
545519
case gID_subpopID:
546520
{
547521
slim_objectid_t value = SLiMCastToObjectidTypeOrRaise(p_value.IntAtIndex_NOCAST(0, nullptr));
@@ -706,8 +680,8 @@ const std::vector<EidosPropertySignature_CSP> *Substitution_Class::Properties(vo
706680
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_dominance, true, kEidosValueMaskFloat)));
707681
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_hemizygousDominance,true, kEidosValueMaskFloat)));
708682
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_subpopID, false, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_subpopID));
709-
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_nucleotide, false, kEidosValueMaskString | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_nucleotide));
710-
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_nucleotideValue, false, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_nucleotideValue));
683+
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_nucleotide, true, kEidosValueMaskString | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_nucleotide));
684+
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_nucleotideValue, true, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_nucleotideValue));
711685
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_originTick, true, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_originTick));
712686
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_fixationTick, true, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_fixationTick));
713687
properties->emplace_back((EidosPropertySignature *)(new EidosPropertySignature(gStr_tag, false, kEidosValueMaskInt | kEidosValueMaskSingleton))->DeclareAcceleratedGet(Substitution::GetProperty_Accelerated_tag));

0 commit comments

Comments
 (0)