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="p6">Sets the individual offset(s) for the trait(s) specified by <span class="s1">trait</span>.<span class="Apple-converted-space"> </span>The traits can be specified as <span class="s1">integer</span> indices of traits in the species, or directly as <span class="s1">Trait</span> objects; <span class="s1">NULL</span> represents all of the traits in the species, in the order in which they were defined.</p>
502
502
<p class="p6">The parameter <span class="s1">offset</span> must follow one of four patterns.<span class="Apple-converted-space"> </span>In the first pattern, <span class="s1">offset</span> is <span class="s1">NULL</span>; this draws the offset for each of the specified traits from each trait’s individual-offset distribution (defined by each trait’s <span class="s1">individualOffsetMean</span> and <span class="s1">individualOffsetSD</span> properties) in each target individual.<span class="Apple-converted-space"> </span>(Note that individual offsets are automatically drawn from these distributions when an individual is created; this re-draws new offset values.)<span class="Apple-converted-space"> </span>In the second pattern, <span class="s1">offset</span> is a singleton value; this sets the given offset for each of the specified traits in each target individual.<span class="Apple-converted-space"> </span>In the third pattern, <span class="s1">offset</span> is of length equal to the number of specified traits; this sets the offset for each of the specified traits to the corresponding offset value in each target individual.<span class="Apple-converted-space"> </span>In the fourth pattern, <span class="s1">offset</span> is of length equal to the number of specified traits times the number of target individuals; this uses <span class="s1">offset</span> to provide a different offset value for each trait in each individual, using consecutive values from <span class="s1">offset</span> to set the offset for each of the specified traits in one individual before moving to the next individual.</p>
<p class="p6">Sets the individual phenotype(s) for the trait(s) specified by <span class="s1">trait</span>.<span class="Apple-converted-space"> </span>The traits can be specified as <span class="s1">integer</span> indices of traits in the species, or directly as <span class="s1">Trait</span> objects; <span class="s1">NULL</span> represents all of the traits in the species, in the order in which they were defined.</p>
505
+
<p class="p6">The parameter <span class="s1">phenotype</span> must follow one of three patterns.<span class="Apple-converted-space"> </span>In the first pattern, <span class="s1">phenotype</span> is a singleton value; this sets the given phenotype for each of the specified traits in each target individual.<span class="Apple-converted-space"> </span>In the second pattern, <span class="s1">phenotype</span> is of length equal to the number of specified traits; this sets the phenotype for each of the specified traits to the corresponding phenotype in each target individual.<span class="Apple-converted-space"> </span>In the third pattern, <span class="s1">phenotype</span> is of length equal to the number of specified traits times the number of target individuals; this uses <span class="s1">phenotype</span> to provide a different phenotype for each trait in each individual, using consecutive values from <span class="s1">phenotype</span> to set the phenotype for each of the specified traits in one individual before moving to the next individual.</p>
<p class="p6"><span class="s3">Sets the spatial position of the individual (as accessed through the </span><span class="s4">spatialPosition</span><span class="s3"> property).<span class="Apple-converted-space"> </span>The length of </span><span class="s4">position</span><span class="s3"> (the number of coordinates in the spatial position of an individual) depends upon the spatial dimensionality declared with </span><span class="s4">initializeSLiMOptions()</span><span class="s3">.<span class="Apple-converted-space"> </span>If the spatial dimensionality is zero (as it is by default), it is an error to call this method.<span class="Apple-converted-space"> </span>The elements of </span><span class="s4">position</span><span class="s3"> are set into the values of the </span><span class="s4">x</span><span class="s3">, </span><span class="s4">y</span><span class="s3">, and </span><span class="s4">z</span><span class="s3"> properties (if those properties are encompassed by the spatial dimensionality of the simulation).<span class="Apple-converted-space"> </span>In other words, if the declared dimensionality is </span><span class="s4">"xy"</span><span class="s3">, calling </span><span class="s4">individual.setSpatialPosition(c(1.0, 0.5))</span><span class="s3"> property is equivalent to </span><span class="s4">individual.x = 1.0; individual.y = 0.5</span><span class="s3">; </span><span class="s4">individual.z</span><span class="s3"> is not set (even if a third value is supplied in </span><span class="s4">position</span><span class="s3">) since it is not encompassed by the simulation’s dimensionality in this example.</span></p>
505
508
<p class="p6"><span class="s3">Note that this is an Eidos class method, somewhat unusually, which allows it to work in a special way when called on a vector of individuals.<span class="Apple-converted-space"> </span>When the target vector of individuals is non-singleton, this method can do one of two things.<span class="Apple-converted-space"> </span>If </span><span class="s4">position</span><span class="s3"> contains just a single point (i.e., is equal in length to the spatial dimensionality of the model), the spatial position of all of the target individuals will be set to the given point.<span class="Apple-converted-space"> </span>Alternatively, if </span><span class="s4">position</span><span class="s3"> contains one point per target individual (i.e., is equal in length to the number of individuals multiplied by the spatial dimensionality of the model), the spatial position of each target individual will be set to the corresponding point from </span><span class="s4">position</span><span class="s3"> (where the point data is concatenated, not interleaved, just as it would be returned by accessing the </span><span class="s4">spatialPosition</span><span class="s3"> property on the vector of target individuals).<span class="Apple-converted-space"> </span>Calling this method with a </span><span class="s4">position</span><span class="s3"> vector of any other length is an error.</span></p>
\f4\fs20 \cf2 Sets the individual phenotype(s) for the trait(s) specified by
4229
+
\f3\fs18 trait
4230
+
\f4\fs20 . The traits can be specified as
4231
+
\f3\fs18 integer
4232
+
\f4\fs20 indices of traits in the species, or directly as
4233
+
\f3\fs18 Trait
4234
+
\f4\fs20 objects;
4235
+
\f3\fs18 NULL
4236
+
\f4\fs20 represents all of the traits in the species, in the order in which they were defined.\
4237
+
The parameter
4238
+
\f3\fs18 phenotype
4239
+
\f4\fs20 must follow one of three patterns. In the first pattern,
4240
+
\f3\fs18 phenotype
4241
+
\f4\fs20 is a singleton value; this sets the given phenotype for each of the specified traits in each target individual. In the second pattern,
4242
+
\f3\fs18 phenotype
4243
+
\f4\fs20 is of length equal to the number of specified traits; this sets the phenotype for each of the specified traits to the corresponding phenotype in each target individual. In the third pattern,
4244
+
\f3\fs18 phenotype
4245
+
\f4\fs20 is of length equal to the number of specified traits times the number of target individuals; this uses
4246
+
\f3\fs18 phenotype
4247
+
\f4\fs20 to provide a different phenotype for each trait in each individual, using consecutive values from
4248
+
\f3\fs18 phenotype
4249
+
\f4\fs20 to set the phenotype for each of the specified traits in one individual before moving to the next individual.\
Copy file name to clipboardExpand all lines: VERSIONS
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,7 @@ multitrait branch:
67
67
rename the selectionCoeff property to effect, for both Mutation and Substitution; it changes from float$ to float, and now returns all trait effects; and SLiMgui autofixes this change
68
68
remove the old C++ selection_coeff_ and dominance_coeff_ ivars in Mutation and Substitution, and begin the transition over to the new MutationTraitInfo struct
69
69
add Individual method -(float)phenotypeForTrait([Nio<Trait> traits = NULL]) to get trait values
70
+
add Individual method +(void)setPhenotypeForTrait([Nio<Trait> trait = NULL], [Nif phenotype = NULL]) to set trait values
Species *species = Community::SpeciesForIndividuals(p_target);
4449
+
4450
+
if (!species)
4451
+
EIDOS_TERMINATION << "ERROR (Individual_Class::ExecuteMethod_setPhenotypeForTrait): setPhenotypeForTrait() requires that all individuals belong to the same species." << EidosTerminate();
EIDOS_TERMINATION << "ERROR (Individual_Class::ExecuteMethod_setPhenotypeForTrait): setPhenotypeForTrait() requires that phenotype be (a) singleton, providing one phenotype for all traits, (b) equal in length to the number of traits in the species, providing one phenotype per trait, or (c) equal in length to the number of traits times the number of target individuals, providing one phenotype per trait per individual." << EidosTerminate();
0 commit comments