Skip to content

Commit e5649a9

Browse files
committed
initializeMutationType() sets the DES for all traits; naming shifts
1 parent d958550 commit e5649a9

43 files changed

Lines changed: 499 additions & 475 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EidosScribe/EidosHelpFunctions.rtf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3519,8 +3519,8 @@ This is quite similar to a function in R of the same name; note, however, that E
35193519
\f1\fs18 x
35203520
\f3\fs20 according to which sorting should be done. This must be a simple property name; it cannot be a property path. For example, to sort a
35213521
\f1\fs18 Mutation
3522-
\f3\fs20 vector by the selection coefficients of the mutations, you would simply pass
3523-
\f1\fs18 "selectionCoeff"
3522+
\f3\fs20 vector by the dominance coefficients of the mutations, you would simply pass
3523+
\f1\fs18 "dominance"
35243524
\f3\fs20 , including the quotes, for
35253525
\f1\fs18 property
35263526
\f2\fs20 .
@@ -6748,8 +6748,9 @@ Named
67486748
\f1\fs18 c()
67496749
\f3\fs20 function (including the possibility of type promotion).\
67506750
Since this function can be hard to understand at first, here is an example:\
6751+
\pard\pardeftab397\li547\ri720\sb60\sa60\partightenfactor0
67516752

6752-
\f1\fs18 sapply(1:10, "if (applyValue % 2) applyValue ^ 2; else NULL;");\
6753+
\f1\fs18 \cf2 sapply(1:10, "if (applyValue % 2) applyValue ^ 2; else NULL;");\
67536754
\pard\pardeftab397\li547\ri720\sb60\sa60\partightenfactor0
67546755

67556756
\f3\fs20 \cf2 \kerning1\expnd0\expndtw0 This produces the output

PARALLEL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PARALLEL changes (now in the master branch, but disabled):
7171
add support for parallel reproduction with tree-sequence recording
7272
add parallel reproduction in nonWF models, with no callbacks (recombination(), mutation()) active - modifyChild() callbacks are legal but cannot access child haplosomes since they are deferred
7373
this is achieved by passing defer=T to addCrossed(), addCloned(), addSelfed(), addMultiRecombinant(), or addRecombinant()
74-
thread-safety work - break in backward reproducibility for scripts that use a type 's' DFE, because the code path for that shifted
74+
thread-safety work - break in backward reproducibility for scripts that use a type 's' DES, because the code path for that shifted
7575
algorithm change for nearestNeighbors() and nearestNeighborsOfPoint(), when count is >1 and <N; the old algorithm was not thread-safe, and was inefficient; breaks backward reproducibility for the relevant case
7676
the break in backward reproducibility is because the old algorithm returned the neighbors in a scrambled order, whereas the new algorithm returns them in sorted order; the order is not documented, so both are compliant
7777
add max thread counts for each parallel loop, allowing flexible customization both by Eidos and by the user

QtSLiM/QtSLiMChromosomeWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void QtSLiMChromosomeWidgetController::runChromosomeContextMenuAtPoint(QPoint p_
480480
MutationType *muttype = muttype_iter.second;
481481
slim_objectid_t muttype_id = muttype->mutation_type_id_;
482482

483-
if (muttype->IsPureNeutralDFE())
483+
if (muttype->IsPureNeutralDES())
484484
displayMuttypes_.emplace_back(muttype_id);
485485
}
486486
}

QtSLiM/QtSLiMChromosomeWidget_GL.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
225225
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
226226
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
227227

228-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
228+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
229229
}
230230

231231
int height_adjust = mutationTickRect.height() - static_cast<int>(ceil((mutationRefCount / totalHaplosomeCount) * interiorRect.height()));
@@ -241,9 +241,9 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
241241
{
242242
// We have a lot of mutations, so let's try to be smarter. It's hard to be smarter. The overhead from allocating the NSColors and such
243243
// is pretty negligible; practially all the time is spent in NSRectFill(). Unfortunately, NSRectFillListWithColors() provides basically
244-
// no speedup; Apple doesn't appear to have optimized it. So, here's what I came up with. For each mutation type that uses a fixed DFE,
244+
// no speedup; Apple doesn't appear to have optimized it. So, here's what I came up with. For each mutation type that uses a fixed DES,
245245
// and thus a fixed color, we can do a radix sort of mutations into bins corresponding to each pixel in our displayed image. Then we
246-
// can draw each bin just once, making one bar for the highest bar in that bin. Mutations from non-fixed DFEs, and mutations which have
246+
// can draw each bin just once, making one bar for the highest bar in that bin. Mutations from non-fixed DESs, and mutations which have
247247
// had their selection coefficient changed, will be drawn at the end in the usual (slow) way.
248248
int displayPixelWidth = interiorRect.width();
249249
int16_t *heightBuffer = static_cast<int16_t *>(malloc(static_cast<size_t>(displayPixelWidth) * sizeof(int16_t)));
@@ -261,22 +261,22 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
261261
for (auto mutationTypeIter : mut_types)
262262
{
263263
MutationType *mut_type = mutationTypeIter.second;
264-
EffectDistributionInfo &ed_info = mut_type->effect_distributions_[0]; // FIXME MULTITRAIT
264+
EffectDistributionInfo &DES_info = mut_type->effect_distributions_[0]; // FIXME MULTITRAIT
265265

266266
if (mut_type->mutation_type_displayed_)
267267
{
268268
if (draw_muttypes_sequentially)
269269
{
270270
bool mut_type_fixed_color = !mut_type->color_.empty();
271271

272-
// We optimize fixed-DFE mutation types only, and those using a fixed color set by the user
273-
if ((ed_info.dfe_type_ == DFEType::kFixed) || mut_type_fixed_color)
272+
// We optimize fixed-DES mutation types only, and those using a fixed color set by the user
273+
if ((DES_info.DES_type_ == DESType::kFixed) || mut_type_fixed_color)
274274
{
275-
slim_effect_t mut_type_selcoeff = (mut_type_fixed_color ? 0.0 : static_cast<slim_effect_t>(ed_info.dfe_parameters_[0]));
275+
slim_effect_t mut_type_effect = (mut_type_fixed_color ? 0.0 : static_cast<slim_effect_t>(DES_info.DES_parameters_[0]));
276276

277277
EIDOS_BZERO(heightBuffer, static_cast<size_t>(displayPixelWidth) * sizeof(int16_t));
278278

279-
// Scan through the mutation list for mutations of this type with the right selcoeff
279+
// Scan through the mutation list for mutations of this type with the right effect
280280
for (int mutation_index = 0; mutation_index < (int)mutations.size(); ++mutation_index)
281281
{
282282
const Mutation *mutation = mutations[mutation_index];
@@ -285,11 +285,11 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
285285
#pragma GCC diagnostic ignored "-Wfloat-equal"
286286
#pragma clang diagnostic push
287287
#pragma clang diagnostic ignored "-Wfloat-equal"
288-
// We do want to do an exact floating-point equality compare here; we want to see whether the mutation's selcoeff is unmodified from the fixed DFE
288+
// We do want to do an exact floating-point equality compare here; we want to see whether the mutation's effect is unmodified from the fixed DES
289289
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
290290
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
291291

292-
if ((mutation->mutation_type_ptr_ == mut_type) && (mut_type_fixed_color || (mut_trait_info[0].effect_size_ == mut_type_selcoeff)))
292+
if ((mutation->mutation_type_ptr_ == mut_type) && (mut_type_fixed_color || (mut_trait_info[0].effect_size_ == mut_type_effect)))
293293
#pragma clang diagnostic pop
294294
#pragma GCC diagnostic pop
295295
{
@@ -320,7 +320,7 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
320320
}
321321
else
322322
{
323-
RGBForSelectionCoeff(static_cast<double>(mut_type_selcoeff), &colorRed, &colorGreen, &colorBlue, scalingFactor);
323+
RGBForEffectSize(static_cast<double>(mut_type_effect), &colorRed, &colorGreen, &colorBlue, scalingFactor);
324324
}
325325

326326
for (int binIndex = 0; binIndex < displayPixelWidth; ++binIndex)
@@ -381,7 +381,7 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
381381
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
382382
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
383383

384-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
384+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
385385

386386
SLIM_GL_DEFCOORDS(mutationTickRect);
387387
SLIM_GL_PUSHRECT();
@@ -437,7 +437,7 @@ void QtSLiMChromosomeWidget::glDrawMutations(QRect &interiorRect, Chromosome *ch
437437
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
438438
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
439439

440-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
440+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
441441

442442
SLIM_GL_DEFCOORDS(mutationTickRect);
443443
SLIM_GL_PUSHRECT();
@@ -505,7 +505,7 @@ void QtSLiMChromosomeWidget::glDrawFixedSubstitutions(QRect &interiorRect, Chrom
505505
else
506506
{
507507
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
508-
RGBForSelectionCoeff(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
508+
RGBForEffectSize(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
509509
}
510510
}
511511

@@ -585,7 +585,7 @@ void QtSLiMChromosomeWidget::glDrawFixedSubstitutions(QRect &interiorRect, Chrom
585585
else
586586
{
587587
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
588-
RGBForSelectionCoeff(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
588+
RGBForEffectSize(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
589589
}
590590

591591
mutationTickRect.setX(interiorRect.x() + binIndex);

QtSLiM/QtSLiMChromosomeWidget_QT.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
221221
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
222222
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
223223

224-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
224+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
225225
}
226226

227227
int height_adjust = mutationTickRect.height() - static_cast<int>(ceil((mutationRefCount / totalHaplosomeCount) * interiorRect.height()));
@@ -237,9 +237,9 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
237237
{
238238
// We have a lot of mutations, so let's try to be smarter. It's hard to be smarter. The overhead from allocating the NSColors and such
239239
// is pretty negligible; practially all the time is spent in NSRectFill(). Unfortunately, NSRectFillListWithColors() provides basically
240-
// no speedup; Apple doesn't appear to have optimized it. So, here's what I came up with. For each mutation type that uses a fixed DFE,
240+
// no speedup; Apple doesn't appear to have optimized it. So, here's what I came up with. For each mutation type that uses a fixed DES,
241241
// and thus a fixed color, we can do a radix sort of mutations into bins corresponding to each pixel in our displayed image. Then we
242-
// can draw each bin just once, making one bar for the highest bar in that bin. Mutations from non-fixed DFEs, and mutations which have
242+
// can draw each bin just once, making one bar for the highest bar in that bin. Mutations from non-fixed DESs, and mutations which have
243243
// had their selection coefficient changed, will be drawn at the end in the usual (slow) way.
244244
int displayPixelWidth = interiorRect.width();
245245
int16_t *heightBuffer = static_cast<int16_t *>(malloc(static_cast<size_t>(displayPixelWidth) * sizeof(int16_t)));
@@ -263,16 +263,16 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
263263
if (draw_muttypes_sequentially)
264264
{
265265
bool mut_type_fixed_color = !mut_type->color_.empty();
266-
EffectDistributionInfo &ed_info = mut_type->effect_distributions_[0]; // FIXME MULTITRAIT
266+
EffectDistributionInfo &DES_info = mut_type->effect_distributions_[0]; // FIXME MULTITRAIT
267267

268-
// We optimize fixed-DFE mutation types only, and those using a fixed color set by the user
269-
if ((ed_info.dfe_type_ == DFEType::kFixed) || mut_type_fixed_color)
268+
// We optimize fixed-DES mutation types only, and those using a fixed color set by the user
269+
if ((DES_info.DES_type_ == DESType::kFixed) || mut_type_fixed_color)
270270
{
271-
slim_effect_t mut_type_selcoeff = (mut_type_fixed_color ? 0.0 : static_cast<slim_effect_t>(ed_info.dfe_parameters_[0]));
271+
slim_effect_t mut_type_effect = (mut_type_fixed_color ? 0.0 : static_cast<slim_effect_t>(DES_info.DES_parameters_[0]));
272272

273273
EIDOS_BZERO(heightBuffer, static_cast<size_t>(displayPixelWidth) * sizeof(int16_t));
274274

275-
// Scan through the mutation list for mutations of this type with the right selcoeff
275+
// Scan through the mutation list for mutations of this type with the right effect
276276
for (int mutation_index = 0; mutation_index < (int)mutations.size(); ++mutation_index)
277277
{
278278
const Mutation *mutation = mutations[mutation_index];
@@ -281,11 +281,11 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
281281
#pragma GCC diagnostic ignored "-Wfloat-equal"
282282
#pragma clang diagnostic push
283283
#pragma clang diagnostic ignored "-Wfloat-equal"
284-
// We do want to do an exact floating-point equality compare here; we want to see whether the mutation's selcoeff is unmodified from the fixed DFE
284+
// We do want to do an exact floating-point equality compare here; we want to see whether the mutation's effect is unmodified from the fixed DES
285285
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
286286
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
287287

288-
if ((mutation->mutation_type_ptr_ == mut_type) && (mut_type_fixed_color || (mut_trait_info[0].effect_size_ == mut_type_selcoeff)))
288+
if ((mutation->mutation_type_ptr_ == mut_type) && (mut_type_fixed_color || (mut_trait_info[0].effect_size_ == mut_type_effect)))
289289
#pragma clang diagnostic pop
290290
#pragma GCC diagnostic pop
291291
{
@@ -316,7 +316,7 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
316316
}
317317
else
318318
{
319-
RGBForSelectionCoeff(static_cast<double>(mut_type_selcoeff), &colorRed, &colorGreen, &colorBlue, scalingFactor);
319+
RGBForEffectSize(static_cast<double>(mut_type_effect), &colorRed, &colorGreen, &colorBlue, scalingFactor);
320320
}
321321

322322
for (int binIndex = 0; binIndex < displayPixelWidth; ++binIndex)
@@ -377,7 +377,7 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
377377
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
378378
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
379379

380-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
380+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
381381

382382
SLIM_GL_DEFCOORDS(mutationTickRect);
383383
SLIM_GL_PUSHRECT();
@@ -433,7 +433,7 @@ void QtSLiMChromosomeWidget::qtDrawMutations(QRect &interiorRect, Chromosome *ch
433433
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
434434
MutationTraitInfo *mut_trait_info = mutation_block->TraitInfoForMutation(mutation);
435435

436-
RGBForSelectionCoeff(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
436+
RGBForEffectSize(static_cast<double>(mut_trait_info[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
437437

438438
SLIM_GL_DEFCOORDS(mutationTickRect);
439439
SLIM_GL_PUSHRECT();
@@ -501,7 +501,7 @@ void QtSLiMChromosomeWidget::qtDrawFixedSubstitutions(QRect &interiorRect, Chrom
501501
else
502502
{
503503
// FIXME MULTITRAIT: should be a way to choose which trait is being used for colors in the chromosome view!
504-
RGBForSelectionCoeff(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
504+
RGBForEffectSize(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
505505
}
506506
}
507507

@@ -580,7 +580,7 @@ void QtSLiMChromosomeWidget::qtDrawFixedSubstitutions(QRect &interiorRect, Chrom
580580
}
581581
else
582582
{
583-
RGBForSelectionCoeff(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
583+
RGBForEffectSize(static_cast<double>(substitution->trait_info_[0].effect_size_), &colorRed, &colorGreen, &colorBlue, scalingFactor);
584584
}
585585

586586
mutationTickRect.setX(interiorRect.x() + binIndex);

QtSLiM/QtSLiMExtras.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ void RGBForFitness(double value, float *colorRed, float *colorGreen, float *colo
278278
}
279279
}
280280

281-
void RGBForSelectionCoeff(double value, float *colorRed, float *colorGreen, float *colorBlue, double scalingFactor)
281+
void RGBForEffectSize(double value, float *colorRed, float *colorGreen, float *colorBlue, double scalingFactor)
282282
{
283283
// apply a scaling factor; this could be user-adjustible since different models have different relevant fitness ranges
284284
value *= scalingFactor;
@@ -394,7 +394,7 @@ void QtSLiMColorScaleWidget::paintEvent(QPaintEvent * /*p_paintEvent*/)
394394
double sliverFraction = (x - (stripe2.left() + 1)) / (stripe2.width() - 3.0);
395395
double fitness = sliverFraction * 2.0 - 1; // cover mutation effect values of -1.0 to 1.0
396396
float r, g, b;
397-
RGBForSelectionCoeff(fitness, &r, &g, &b, scalingFactor);
397+
RGBForEffectSize(fitness, &r, &g, &b, scalingFactor);
398398
painter.fillRect(sliver, QColor(round(r * 255), round(g * 255), round(b * 255)));
399399

400400
//qDebug() << "x =" << x << " << sliverFraction =" << sliverFraction << " fitness =" << fitness;

0 commit comments

Comments
 (0)