From bd4038ac85fd46223be8011fdb5716e763ed3738 Mon Sep 17 00:00:00 2001 From: Ben Haller Date: Thu, 12 Sep 2024 12:58:40 -0400 Subject: [PATCH] add terminology autofixes, revise recipes and cal...() functions --- QtSLiM/QtSLiMWindow.cpp | 190 +++++++++++++++--- QtSLiM/recipes.qrc | 2 +- ...ion of genomic background, Epistasis I.txt | 4 +- ...on of genomic background, Epistasis II.txt | 4 +- ...n selection and the green-beard effect.txt | 2 +- .../Recipe 11.1 - Assortative mating.txt | 4 +- ....3 - Gametophytic self-incompatibility.txt | 6 +- .../Recipe 12.2 - Lethal epistasis I.txt | 8 +- .../Recipe 12.2 - Lethal epistasis II.txt | 8 +- .../Recipe 12.3 - Simulating gene drive.txt | 10 +- .../Recipe 13.1 - Polygenic selection.txt | 2 +- ...L effects with a structured chromosome.txt | 2 +- ...ative phenotypic traits and pleiotropy.txt | 2 +- ...edness, inbreeding, and heterozygosity.txt | 2 +- ...ecipe 14.11 - Modeling microsatellites.txt | 16 +- ...14.12 - Modeling transposable elements.txt | 26 +-- ...elic loci with a mutation() callback I.txt | 4 +- ...lic loci with a mutation() callback II.txt | 18 +- ...lation state from an MS output file II.txt | 10 +- ...rsions with a recombination() callback.txt | 10 +- ...s with a Pseudo-Autosomal Region (PAR).txt | 10 +- ...ng local ancestry along the chromosome.txt | 6 +- ...cipe 14.9 - Modeling haploid organisms.txt | 8 +- ...in a nonWF model with addRecombinant().txt | 2 +- ...bacteria with horizontal gene transfer.txt | 8 +- ...ipe 15.14 - Alternation of generations.txt | 18 +- .../recipes/Recipe 15.15 - Meiotic drive.txt | 14 +- ...ng haplodiploidy with addRecombinant().txt | 16 +- ...eficial mutations and absolute fitness.txt | 2 +- ...n after simulation with recapitation I.txt | 2 +- ...tion of a sweep, preserving ancestry I.txt | 2 +- ...ion of a sweep, preserving ancestry II.txt | 2 +- ...xture (analyzing ancestry in Python) I.txt | 4 +- ... WF model with a coalescent history II.txt | 2 +- ...eling GC-biased gene conversion (gBGC).txt | 2 +- ... files to create nucleotide-based SNPs.txt | 2 +- ...back-mutations to the ancestral state).txt | 6 +- ...ce output from nucleotide-based models.txt | 6 +- ...nt mutational lineages, and VCF output.txt | 2 +- ...and equilibrium nucleotide frequencies.txt | 2 +- ...roduced non-nucleotide-based mutations.txt | 2 +- ...itness effects at the nucleotide level.txt | 4 +- ...itness effects at the amino acid level.txt | 6 +- ...ry host-parasite matching-allele model.txt | 4 +- ...ng individuals rather than haplosomes.txt} | 2 +- ...output, Automatic logging with LogFile.txt | 2 +- ...Basic output, Custom output with Eidos.txt | 12 +- ... random, sparse spatial metapopulation.txt | 2 +- ... IV (Custom display colors in SLiMgui).txt | 2 +- ...e 9.1 - Introducing adaptive mutations.txt | 2 +- ...cking the fate of background mutations.txt | 2 +- ...ion size versus census population size.txt | 4 +- ... Making sweeps conditional on fixation.txt | 4 +- ...ng sweeps conditional on establishment.txt | 4 +- .../recipes/Recipe 9.4 - Partial sweeps.txt | 2 +- ...e novo mutations in a large population.txt | 4 +- ...with a fixed de novo mutation schedule.txt | 4 +- ...ith a random de novo mutation schedule.txt | 2 +- ...ing variation at a predetermined locus.txt | 4 +- .../Recipe 9.7 - Adaptive introgression.txt | 2 +- ...eeping a reference to a sweep mutation.txt | 2 +- ...ion of genomic background, Epistasis I.txt | 4 +- ...on of genomic background, Epistasis II.txt | 4 +- ...n selection and the green-beard effect.txt | 2 +- .../Recipe 11.1 - Assortative mating.txt | 4 +- ....3 - Gametophytic self-incompatibility.txt | 6 +- .../Recipe 12.2 - Lethal epistasis I.txt | 8 +- .../Recipe 12.2 - Lethal epistasis II.txt | 8 +- .../Recipe 12.3 - Simulating gene drive.txt | 10 +- .../Recipe 13.1 - Polygenic selection.txt | 2 +- ...L effects with a structured chromosome.txt | 2 +- ...ative phenotypic traits and pleiotropy.txt | 2 +- ...edness, inbreeding, and heterozygosity.txt | 2 +- ...ecipe 14.11 - Modeling microsatellites.txt | 16 +- ...14.12 - Modeling transposable elements.txt | 26 +-- ...elic loci with a mutation() callback I.txt | 4 +- ...lic loci with a mutation() callback II.txt | 18 +- ...lation state from an MS output file II.txt | 10 +- ...rsions with a recombination() callback.txt | 10 +- ...s with a Pseudo-Autosomal Region (PAR).txt | 10 +- ...ng local ancestry along the chromosome.txt | 6 +- ...cipe 14.9 - Modeling haploid organisms.txt | 8 +- ...in a nonWF model with addRecombinant().txt | 2 +- ...bacteria with horizontal gene transfer.txt | 8 +- ...ipe 15.14 - Alternation of generations.txt | 18 +- .../Recipes/Recipe 15.15 - Meiotic drive.txt | 14 +- ...ng haplodiploidy with addRecombinant().txt | 16 +- ...eficial mutations and absolute fitness.txt | 2 +- ...n after simulation with recapitation I.txt | 2 +- ...tion of a sweep, preserving ancestry I.txt | 2 +- ...ion of a sweep, preserving ancestry II.txt | 2 +- ...xture (analyzing ancestry in Python) I.txt | 4 +- ... WF model with a coalescent history II.txt | 2 +- ...eling GC-biased gene conversion (gBGC).txt | 2 +- ... files to create nucleotide-based SNPs.txt | 2 +- ...back-mutations to the ancestral state).txt | 6 +- ...ce output from nucleotide-based models.txt | 6 +- ...nt mutational lineages, and VCF output.txt | 2 +- ...and equilibrium nucleotide frequencies.txt | 2 +- ...roduced non-nucleotide-based mutations.txt | 2 +- ...itness effects at the nucleotide level.txt | 4 +- ...itness effects at the amino acid level.txt | 6 +- ...ry host-parasite matching-allele model.txt | 4 +- ...ng individuals rather than haplosomes.txt} | 2 +- ...output, Automatic logging with LogFile.txt | 2 +- ...Basic output, Custom output with Eidos.txt | 12 +- ... random, sparse spatial metapopulation.txt | 2 +- ... IV (Custom display colors in SLiMgui).txt | 2 +- ...e 9.1 - Introducing adaptive mutations.txt | 2 +- ...cking the fate of background mutations.txt | 2 +- ...ion size versus census population size.txt | 4 +- ... Making sweeps conditional on fixation.txt | 4 +- ...ng sweeps conditional on establishment.txt | 4 +- .../Recipes/Recipe 9.4 - Partial sweeps.txt | 2 +- ...e novo mutations in a large population.txt | 4 +- ...with a fixed de novo mutation schedule.txt | 4 +- ...ith a random de novo mutation schedule.txt | 2 +- ...ing variation at a predetermined locus.txt | 4 +- .../Recipe 9.7 - Adaptive introgression.txt | 2 +- ...eeping a reference to a sweep mutation.txt | 2 +- VERSIONS | 7 +- core/slim_functions.cpp | 10 +- 122 files changed, 494 insertions(+), 367 deletions(-) rename QtSLiM/recipes/{Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt => Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt} (93%) rename SLiMgui/Recipes/{Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt => Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt} (93%) diff --git a/QtSLiM/QtSLiMWindow.cpp b/QtSLiM/QtSLiMWindow.cpp index 9008e2489..7dabdd804 100644 --- a/QtSLiM/QtSLiMWindow.cpp +++ b/QtSLiM/QtSLiMWindow.cpp @@ -1703,6 +1703,8 @@ bool QtSLiMWindow::checkTerminationForAutofix(QString terminationMessage) QTextCursor selection = ui->scriptTextEdit->textCursor(); QString selectionString = selection.selectedText(); + // Note that is important to test the selection string to make sure it makes sense, because the error position might not be correct! + // get the four characters prior to the selected error range, to recognize if the error is preceded by "sim."; note this is a heuristic, not precise QTextCursor beforeSelection4 = selection; beforeSelection4.setPosition(beforeSelection4.selectionStart(), QTextCursor::MoveAnchor); @@ -1710,6 +1712,10 @@ bool QtSLiMWindow::checkTerminationForAutofix(QString terminationMessage) beforeSelection4.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 4); QString beforeSelection4String = beforeSelection4.selectedText(); + // + // Changes for SLiM 4.0: multispecies SLiM, mostly, plus fitness() -> mutationEffect() and fitness(NULL) -> fitnessEffect() + // + // early() events are no longer default if (terminationMessage.contains("unexpected token {") && terminationMessage.contains("expected an event declaration") && @@ -1718,91 +1724,124 @@ bool QtSLiMWindow::checkTerminationForAutofix(QString terminationMessage) return offerAndExecuteAutofix(selection, "early() {", "Script blocks no longer default to `early()`; `early()` must be explicitly specified.", terminationMessage); // sim to community changes - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method createLogFile() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "createLogFile") && + terminationMessage.contains("method createLogFile() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `createLogFile()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method deregisterScriptBlock() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "deregisterScriptBlock") && + terminationMessage.contains("method deregisterScriptBlock() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `deregisterScriptBlock()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method registerFirstEvent() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "registerFirstEvent") && + terminationMessage.contains("method registerFirstEvent() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `registerFirstEvent()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method registerEarlyEvent() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "registerEarlyEvent") && + terminationMessage.contains("method registerEarlyEvent() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `registerEarlyEvent()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method registerLateEvent() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "registerLateEvent") && + terminationMessage.contains("method registerLateEvent() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `registerLateEvent()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method rescheduleScriptBlock() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "rescheduleScriptBlock") && + terminationMessage.contains("method rescheduleScriptBlock() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `rescheduleScriptBlock()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method simulationFinished() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "simulationFinished") && + terminationMessage.contains("method simulationFinished() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `simulationFinished()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("method outputUsage() is not defined on object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "outputUsage") && + terminationMessage.contains("method outputUsage() is not defined on object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `outputUsage()` method has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("property logFiles is not defined for object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "logFiles") && + terminationMessage.contains("property logFiles is not defined for object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `logFiles` property has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("property generationStage is not defined for object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "generationStage") && + terminationMessage.contains("property generationStage is not defined for object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `generationStage` property has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("property modelType is not defined for object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "modelType") && + terminationMessage.contains("property modelType is not defined for object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `modelType` property has been moved to the Community class.", terminationMessage); - if ((beforeSelection4String == "sim.") && terminationMessage.contains("property verbosity is not defined for object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "verbosity") && + terminationMessage.contains("property verbosity is not defined for object element type Species")) return offerAndExecuteAutofix(beforeSelection4, "community.", "The `verbosity` property has been moved to the Community class.", terminationMessage); // generation to tick changes - if (terminationMessage.contains("property originGeneration is not defined for object element type Mutation")) + if (terminationMessage.contains("property originGeneration is not defined for object element type Mutation") && + (selectionString == "originGeneration")) return offerAndExecuteAutofix(selection, "originTick", "The `originGeneration` property has been removed from Mutation; in its place is `originTick` (which measures in ticks, not generations).", terminationMessage); - if (terminationMessage.contains("property originGeneration is not defined for object element type Substitution")) + if (terminationMessage.contains("property originGeneration is not defined for object element type Substitution") && + (selectionString == "originGeneration")) return offerAndExecuteAutofix(selection, "originTick", "The `originGeneration` property has been removed from Substitution; in its place is `originTick` (which measures in ticks, not generations).", terminationMessage); - if (terminationMessage.contains("property fixationGeneration is not defined for object element type Substitution")) + if (terminationMessage.contains("property fixationGeneration is not defined for object element type Substitution") && + (selectionString == "fixationGeneration")) return offerAndExecuteAutofix(selection, "fixationTick", "The `fixationGeneration` property has been removed from Substitution; in its place is `fixationTick` (which measures in ticks, not generations).", terminationMessage); // generation to cycle changes - if (terminationMessage.contains("property generation is not defined for object element type Species")) + if (terminationMessage.contains("property generation is not defined for object element type Species") && + (selectionString == "generation")) return offerAndExecuteAutofix(selection, "cycle", "The `generation` property of Species has been renamed to `cycle`.", terminationMessage); - if (terminationMessage.contains("property generationStage is not defined for object element type Community")) + if (terminationMessage.contains("property generationStage is not defined for object element type Community") && + (selectionString == "generationStage")) return offerAndExecuteAutofix(selection, "cycleStage", "The `generationStage` property of Community has been renamed to `cycleStage`.", terminationMessage); - if (terminationMessage.contains("method addGeneration() is not defined on object element type LogFile")) + if (terminationMessage.contains("method addGeneration() is not defined on object element type LogFile") && + (selectionString == "addGeneration")) return offerAndExecuteAutofix(selection, "addCycle", "The `addGeneration()` method of Community has been renamed to `addCycle()`.", terminationMessage); - if (terminationMessage.contains("method addGenerationStage() is not defined on object element type LogFile")) + if (terminationMessage.contains("method addGenerationStage() is not defined on object element type LogFile") && + (selectionString == "addGenerationStage")) return offerAndExecuteAutofix(selection, "addCycleStage", "The `addGenerationStage()` method of Community has been renamed to `addCycleStage()`.", terminationMessage); // removal of various callback pseudo-parameters - if (terminationMessage.contains("undefined identifier genome1")) - return offerAndExecuteAutofix(selection, "individual.genome1", "The `genome1` pseudo-parameter has been removed; it is now accessed as `individual.genome1`.", terminationMessage); - - if (terminationMessage.contains("undefined identifier genome2")) - return offerAndExecuteAutofix(selection, "individual.genome2", "The `genome2` pseudo-parameter has been removed; it is now accessed as `individual.genome2`.", terminationMessage); - - if (terminationMessage.contains("undefined identifier childGenome1")) + // genome1 and genome2 are now handled below, since there are two possible fixes now + if (terminationMessage.contains("undefined identifier childGenome1") && + (selectionString == "childGenome1")) return offerAndExecuteAutofix(selection, "child.genome1", "The `childGenome1` pseudo-parameter has been removed; it is now accessed as `child.genome1`.", terminationMessage); - if (terminationMessage.contains("undefined identifier childGenome2")) + if (terminationMessage.contains("undefined identifier childGenome2") && + (selectionString == "childGenome2")) return offerAndExecuteAutofix(selection, "child.genome2", "The `childGenome2` pseudo-parameter has been removed; it is now accessed as `child.genome2`.", terminationMessage); - if (terminationMessage.contains("undefined identifier parent1Genome1")) + if (terminationMessage.contains("undefined identifier parent1Genome1") && + (selectionString == "parent1Genome1")) return offerAndExecuteAutofix(selection, "parent1.genome1", "The `parent1Genome1` pseudo-parameter has been removed; it is now accessed as `parent1.genome1`.", terminationMessage); - if (terminationMessage.contains("undefined identifier parent1Genome2")) + if (terminationMessage.contains("undefined identifier parent1Genome2") && + (selectionString == "parent1Genome2")) return offerAndExecuteAutofix(selection, "parent1.genome2", "The `parent1Genome2` pseudo-parameter has been removed; it is now accessed as `parent1.genome2`.", terminationMessage); - if (terminationMessage.contains("undefined identifier parent2Genome1")) + if (terminationMessage.contains("undefined identifier parent2Genome1") && + (selectionString == "parent2Genome1")) return offerAndExecuteAutofix(selection, "parent2.genome1", "The `parent2Genome1` pseudo-parameter has been removed; it is now accessed as `parent2.genome1`.", terminationMessage); - if (terminationMessage.contains("undefined identifier parent2Genome2")) + if (terminationMessage.contains("undefined identifier parent2Genome2") && + (selectionString == "parent2Genome2")) return offerAndExecuteAutofix(selection, "parent2.genome2", "The `parent2Genome2` pseudo-parameter has been removed; it is now accessed as `parent2.genome2`.", terminationMessage); - if (terminationMessage.contains("undefined identifier childIsFemale")) + if (terminationMessage.contains("undefined identifier childIsFemale") && + (selectionString == "childIsFemale")) return offerAndExecuteAutofix(selection, "(child.sex == \"F\")", "The `childIsFemale` pseudo-parameter has been removed; it is now accessed as `child.sex == \"F\"`.", terminationMessage); // changes to InteractionType -evaluate() @@ -1915,7 +1954,9 @@ bool QtSLiMWindow::checkTerminationForAutofix(QString terminationMessage) return offerAndExecuteAutofix(selection, "effect", "The `relFitness` pseudo-parameter has been renamed to `effect`.", terminationMessage); // other deprecated APIs, unrelated to multispecies and multi-phenotype - if ((beforeSelection4String == "sim.") && terminationMessage.contains("property inSLiMgui is not defined for object element type Species")) + if ((beforeSelection4String == "sim.") && + (selectionString == "inSLiMgui") && + terminationMessage.contains("property inSLiMgui is not defined for object element type Species")) { QTextCursor simAndSelection = beforeSelection4; simAndSelection.setPosition(selection.selectionEnd(), QTextCursor::KeepAnchor); @@ -1923,6 +1964,89 @@ bool QtSLiMWindow::checkTerminationForAutofix(QString terminationMessage) return offerAndExecuteAutofix(simAndSelection, "exists(\"slimgui\")", "The `inSLiMgui` property has been removed; now use `exists(\"slimgui\")`.", terminationMessage); } + // + // Shift from genome to haplosome, probably for SLiM 5.0 + // + + if (terminationMessage.contains("could not find an Eidos class named 'Genome'") && + (selectionString == "Genome")) + return offerAndExecuteAutofix(selection, "Haplosome", "The `Genome` class has been renamed to `Haplosome`.", terminationMessage); + + if (terminationMessage.contains("property genomeType is not defined for object element type Haplosome") && + (selectionString == "genomeType")) + return offerAndExecuteAutofix(selection, "chromosome.type", "The `genomeType` property of Haplosome has been removed; it is now accessed as `chromosome.type`.", terminationMessage); + + if (terminationMessage.contains("property isNullGenome is not defined for object element type Haplosome") && + (selectionString == "isNullGenome")) + return offerAndExecuteAutofix(selection, "isNullHaplosome", "The `isNullGenome` property of Haplosome has been renamed to `isNullHaplosome`.", terminationMessage); + + if (terminationMessage.contains("property genomePedigreeID is not defined for object element type Haplosome") && + (selectionString == "genomePedigreeID")) + return offerAndExecuteAutofix(selection, "haplosomePedigreeID", "The `genomePedigreeID` property of Haplosome has been renamed to `haplosomePedigreeID`.", terminationMessage); + + if (terminationMessage.contains("method mutationCountsInGenomes() is not defined on object element type Haplosome") && + (selectionString == "mutationCountsInGenomes")) + return offerAndExecuteAutofix(selection, "mutationCountsInHaplosomes", "The `mutationCountsInGenomes` method of Haplosome has been renamed to `mutationCountsInHaplosomes`.", terminationMessage); + + if (terminationMessage.contains("method mutationFrequenciesInGenomes() is not defined on object element type Haplosome") && + (selectionString == "mutationFrequenciesInGenomes")) + return offerAndExecuteAutofix(selection, "mutationFrequenciesInHaplosomes", "The `mutationFrequenciesInGenomes` property of Haplosome has been renamed to `mutationFrequenciesInHaplosomes`.", terminationMessage); + + if (terminationMessage.contains("property genomes is not defined for object element type Individual") && + (selectionString == "genomes")) + return offerAndExecuteAutofix(selection, "haplosomes", "The `genomes` property of Individual has been renamed to `haplosomes`.", terminationMessage); + + if (terminationMessage.contains("property genomesNonNull is not defined for object element type Individual") && + (selectionString == "genomesNonNull")) + return offerAndExecuteAutofix(selection, "haplosomesNonNull", "The `genomesNonNull` property of Individual has been renamed to `haplosomesNonNull`.", terminationMessage); + + if (terminationMessage.contains("property genome1 is not defined for object element type Individual") && + (selectionString == "genome1")) + return offerAndExecuteAutofix(selection, "haplosomesFromParent1", "The `genome1` property of Individual has been renamed to `haplosomesFromParent1`.", terminationMessage); + + if (terminationMessage.contains("property genome2 is not defined for object element type Individual") && + (selectionString == "genome2")) + return offerAndExecuteAutofix(selection, "haplosomesFromParent2", "The `genome2` property of Individual has been renamed to `haplosomesFromParent2`.", terminationMessage); + + if (terminationMessage.contains("property genomes is not defined for object element type Subpopulation") && + (selectionString == "genomes")) + return offerAndExecuteAutofix(selection, "haplosomes", "The `genomes` property of Subpopulation has been renamed to `haplosomes`.", terminationMessage); + + if (terminationMessage.contains("property genomesNonNull is not defined for object element type Subpopulation") && + (selectionString == "genomesNonNull")) + return offerAndExecuteAutofix(selection, "haplosomesNonNull", "The `genomesNonNull` property of Subpopulation has been renamed to `haplosomesNonNull`.", terminationMessage); + + if (terminationMessage.contains("property chromosome is not defined for object element type Species") && + (selectionString == "chromosome")) + return offerAndExecuteAutofix(selection, "chromosomes", "The `chromosome` property of Species has been renamed to `chromosomes`.", terminationMessage); + + if (terminationMessage.contains("property chromosomeType is not defined for object element type Species") && + (selectionString == "chromosomeType")) + return offerAndExecuteAutofix(selection, "chromosomes.type", "The `chromosomeType` property of Species has been removed; it is now accessed as `chromosomes.type`.", terminationMessage); + + if (terminationMessage.contains("undefined identifier genome") && + (selectionString == "genome")) + return offerAndExecuteAutofix(selection, "haplosome", "The `genome` pseudo-parameter has been renamed to `haplosome`.", terminationMessage); + + // genome1 and genome2 for some callback types were removed in favor of individual.genome1 and individual.genome2 for SLiM 4.0, + // and used to be autofixed above; however, in recombination() callbacks genome1 has become haplosome1 and genome2 has + // become haplosome2, which conflicted with the previous autofix. This sequence of fixes works for all cases. + if (terminationMessage.contains("undefined identifier genome1") && + (selectionString == "genome1")) + return offerAndExecuteAutofix(selection, "haplosome1", "The `genome1` pseudo-parameter has been renamed to `haplosome1`.", terminationMessage); + + if (terminationMessage.contains("undefined identifier haplosome1") && + (selectionString == "haplosome1")) + return offerAndExecuteAutofix(selection, "individual.haplosomesFromParent1", "The `haplosome1` pseudo-parameter has been removed; it is now accessed as `individual.haplosomesFromParent1`.", terminationMessage); + + if (terminationMessage.contains("undefined identifier genome2") && + (selectionString == "genome2")) + return offerAndExecuteAutofix(selection, "haplosome2", "The `genome2` pseudo-parameter has been renamed to `haplosome2`.", terminationMessage); + + if (terminationMessage.contains("undefined identifier haplosome2") && + (selectionString == "haplosome2")) + return offerAndExecuteAutofix(selection, "individual.haplosomesFromParent2", "The `haplosome2` pseudo-parameter has been removed; it is now accessed as `individual.haplosomesFromParent2`.", terminationMessage); + return false; } diff --git a/QtSLiM/recipes.qrc b/QtSLiM/recipes.qrc index 89a25f75a..b65222849 100644 --- a/QtSLiM/recipes.qrc +++ b/QtSLiM/recipes.qrc @@ -4,7 +4,7 @@ recipes/Recipe 4.1 - A basic neutral simulation.txt recipes/Recipe 4.2.1 - Basic output, Entire population.txt recipes/Recipe 4.2.2 - Basic output, Random population sample.txt - recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt + recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt recipes/Recipe 4.2.4 - Basic output, Substitutions.txt recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt diff --git a/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt b/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt index a550fb5ad..b1891e502 100644 --- a/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt +++ b/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt @@ -18,9 +18,9 @@ initialize() { 1 early() { sim.addSubpop("p1", 500); } 10000 early() { sim.simulationFinished(); } mutationEffect(m3) { - if (individual.genome1.countOfMutationsOfType(m2)) + if (individual.haplosomesFromParent1.countOfMutationsOfType(m2)) return 0.5; - else if (individual.genome2.countOfMutationsOfType(m2)) + else if (individual.haplosomesFromParent2.countOfMutationsOfType(m2)) return 0.5; else return effect; diff --git a/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt b/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt index 02b7cb2c6..80aa8c287 100644 --- a/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt +++ b/QtSLiM/recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt @@ -20,9 +20,9 @@ initialize() { 1 early() { sim.addSubpop("p1", 500); } 10000 early() { sim.simulationFinished(); } mutationEffect(m3) { - if (individual.genome1.countOfMutationsOfType(m2)) + if (individual.haplosomesFromParent1.countOfMutationsOfType(m2)) return 0.5; - else if (individual.genome2.countOfMutationsOfType(m2)) + else if (individual.haplosomesFromParent2.countOfMutationsOfType(m2)) return 0.5; else return effect; diff --git a/QtSLiM/recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt b/QtSLiM/recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt index 95288da4e..408bef7b7 100644 --- a/QtSLiM/recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt +++ b/QtSLiM/recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt @@ -12,7 +12,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1 late() { - target = sample(p1.genomes, 100); + target = sample(p1.haplosomes, 100); target.addNewDrawnMutation(m2, 10000); } 1: late() { diff --git a/QtSLiM/recipes/Recipe 11.1 - Assortative mating.txt b/QtSLiM/recipes/Recipe 11.1 - Assortative mating.txt index 261c148ef..92e6667c0 100644 --- a/QtSLiM/recipes/Recipe 11.1 - Assortative mating.txt +++ b/QtSLiM/recipes/Recipe 11.1 - Assortative mating.txt @@ -16,7 +16,7 @@ initialize() { p2.setMigrationRates(p1, 0.1); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } mutationEffect(m2, p2) { return 0.2; } @@ -40,7 +40,7 @@ mutationEffect(m2, p2) { return 0.2; } return weights * sourceSubpop.getValue("weights2"); } 10000: late() { - FST = calcFST(p1.genomes, p2.genomes); + FST = calcFST(p1.haplosomes, p2.haplosomes); sim.setValue("FST", sim.getValue("FST") + FST); } 19999 late() { diff --git a/QtSLiM/recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt b/QtSLiM/recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt index 2124b011c..aa3959d95 100644 --- a/QtSLiM/recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt +++ b/QtSLiM/recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt @@ -17,9 +17,9 @@ initialize() { cat("m2 mutation count: " + sim.countOfMutationsOfType(m2) + "\n"); } modifyChild(p1) { - pollenSMuts = child.genome2.mutationsOfType(m2); - styleSMuts1 = parent1.genome1.mutationsOfType(m2); - styleSMuts2 = parent1.genome2.mutationsOfType(m2); + pollenSMuts = child.haplosomesFromParent2.mutationsOfType(m2); + styleSMuts1 = parent1.haplosomesFromParent1.mutationsOfType(m2); + styleSMuts2 = parent1.haplosomesFromParent2.mutationsOfType(m2); if (identical(pollenSMuts, styleSMuts1)) if (runif(1) < 0.99) return F; diff --git a/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis I.txt b/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis I.txt index 976f34aa3..87d209e30 100644 --- a/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis I.txt +++ b/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis I.txt @@ -15,12 +15,12 @@ initialize() { sim.addSubpop("p1", 500); } 1 late() { - sample(p1.genomes, 20).addNewDrawnMutation(m2, 10000); // add A - sample(p1.genomes, 20).addNewDrawnMutation(m3, 20000); // add B + sample(p1.haplosomes, 20).addNewDrawnMutation(m2, 10000); // add A + sample(p1.haplosomes, 20).addNewDrawnMutation(m3, 20000); // add B } modifyChild() { - hasMutA = any(child.genomes.countOfMutationsOfType(m2) > 0); - hasMutB = any(child.genomes.countOfMutationsOfType(m3) > 0); + hasMutA = any(child.haplosomes.countOfMutationsOfType(m2) > 0); + hasMutB = any(child.haplosomes.countOfMutationsOfType(m3) > 0); if (hasMutA & hasMutB) return F; return T; diff --git a/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis II.txt b/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis II.txt index d1e62e19f..5be4323f3 100644 --- a/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis II.txt +++ b/QtSLiM/recipes/Recipe 12.2 - Lethal epistasis II.txt @@ -15,12 +15,12 @@ initialize() { sim.addSubpop("p1", 500); } 1 late() { - sample(p1.genomes, 20).addNewDrawnMutation(m2, 10000); // add A - sample(p1.genomes, 20).addNewDrawnMutation(m3, 20000); // add B + sample(p1.haplosomes, 20).addNewDrawnMutation(m2, 10000); // add A + sample(p1.haplosomes, 20).addNewDrawnMutation(m3, 20000); // add B } modifyChild() { - mutACount = sum(child.genomes.countOfMutationsOfType(m2)); - mutBCount = sum(child.genomes.countOfMutationsOfType(m3)); + mutACount = sum(child.haplosomes.countOfMutationsOfType(m2)); + mutBCount = sum(child.haplosomes.countOfMutationsOfType(m3)); if ((mutACount == 2) & (mutBCount == 2)) return F; return T; diff --git a/QtSLiM/recipes/Recipe 12.3 - Simulating gene drive.txt b/QtSLiM/recipes/Recipe 12.3 - Simulating gene drive.txt index 3a28ccc88..9ae33724d 100644 --- a/QtSLiM/recipes/Recipe 12.3 - Simulating gene drive.txt +++ b/QtSLiM/recipes/Recipe 12.3 - Simulating gene drive.txt @@ -17,7 +17,7 @@ initialize() { sim.subpopulations[i].setMigrationRates(i+1, 0.1); } 100 late() { - p0.genomes[0:49].addNewDrawnMutation(m2, 10000); + p0.haplosomes[0:49].addNewDrawnMutation(m2, 10000); } 100:10000 late() { if (sim.countOfMutationsOfType(m2) == 0) @@ -34,12 +34,12 @@ mutationEffect(m2) { mut = sim.mutationsOfType(m2); if (size(mut) == 1) { - hasMutOnChromosome1 = child.genome1.containsMutations(mut); - hasMutOnChromosome2 = child.genome2.containsMutations(mut); + hasMutOnChromosome1 = child.haplosomesFromParent1.containsMutations(mut); + hasMutOnChromosome2 = child.haplosomesFromParent2.containsMutations(mut); if (hasMutOnChromosome1 & !hasMutOnChromosome2) - child.genome2.addMutations(mut); + child.haplosomesFromParent2.addMutations(mut); else if (hasMutOnChromosome2 & !hasMutOnChromosome1) - child.genome1.addMutations(mut); + child.haplosomesFromParent1.addMutations(mut); } return T; } diff --git a/QtSLiM/recipes/Recipe 13.1 - Polygenic selection.txt b/QtSLiM/recipes/Recipe 13.1 - Polygenic selection.txt index e1b55e7a3..0af39c7fd 100644 --- a/QtSLiM/recipes/Recipe 13.1 - Polygenic selection.txt +++ b/QtSLiM/recipes/Recipe 13.1 - Polygenic selection.txt @@ -15,7 +15,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } fitnessEffect() { - phenotype = sum(individual.genomes.countOfMutationsOfType(m2)); + phenotype = sum(individual.haplosomes.countOfMutationsOfType(m2)); return 1.5 - (phenotype - 10.0)^2 * 0.005; } 5000 late() { diff --git a/QtSLiM/recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt b/QtSLiM/recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt index 396bbc8f8..5360e7d4d 100644 --- a/QtSLiM/recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt +++ b/QtSLiM/recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt @@ -52,7 +52,7 @@ initialize() { community.registerEarlyEvent("s2", s1.source, 2, 2); // optional: give m2 mutations to everyone, as standing variation - g = sim.subpopulations.genomes; + g = sim.subpopulations.haplosomes; for (q in Q) { diff --git a/QtSLiM/recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt b/QtSLiM/recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt index 091d92edd..a34cce59b 100644 --- a/QtSLiM/recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt +++ b/QtSLiM/recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt @@ -71,7 +71,7 @@ late() { for (ind in sim.subpopulations.individuals) { // construct phenotypes from additive effects of QTL mutations - muts = ind.genomes.mutationsOfType(m2); + muts = ind.haplosomes.mutationsOfType(m2); phenotype0 = size(muts) ? sum(muts.getValue("e0")) else 0.0; phenotype1 = size(muts) ? sum(muts.getValue("e1")) else 0.0; ind.setValue("phenotype0", phenotype0); diff --git a/QtSLiM/recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt b/QtSLiM/recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt index 1db7945df..ac3d744e7 100644 --- a/QtSLiM/recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt +++ b/QtSLiM/recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt @@ -17,6 +17,6 @@ mateChoice() { } 1000 late() { // Print mean heterozygosity across the population - heterozygosity = calcHeterozygosity(p1.genomes); + heterozygosity = calcHeterozygosity(p1.haplosomes); cat("Mean heterozygosity = " + heterozygosity + "\n"); } diff --git a/QtSLiM/recipes/Recipe 14.11 - Modeling microsatellites.txt b/QtSLiM/recipes/Recipe 14.11 - Modeling microsatellites.txt index 540782324..099dc3dab 100644 --- a/QtSLiM/recipes/Recipe 14.11 - Modeling microsatellites.txt +++ b/QtSLiM/recipes/Recipe 14.11 - Modeling microsatellites.txt @@ -21,14 +21,14 @@ initialize() { sim.addSubpop("p1", 500); // create some microsatellites at random positions - genomes = sim.subpopulations.genomes; + haplosomes = sim.subpopulations.haplosomes; positions = rdunif(msatCount, 0, L-1); repeats = rpois(msatCount, 20) + 5; for (msatIndex in 0:(msatCount-1)) { pos = positions[msatIndex]; - mut = genomes.addNewDrawnMutation(m2, pos); + mut = haplosomes.addNewDrawnMutation(m2, pos); mut.tag = repeats[msatIndex]; } @@ -37,14 +37,14 @@ initialize() { } modifyChild() { // mutate microsatellites with rate msatMu - for (genome in child.genomes) + for (haplosome in child.haplosomes) { mutCount = rpois(1, msatMu * msatCount); if (mutCount) { mutSites = sample(msatPositions, mutCount); - msats = genome.mutationsOfType(m2); + msats = haplosome.mutationsOfType(m2); for (mutSite in mutSites) { @@ -66,15 +66,15 @@ modifyChild() { if (matchingMut.size() == 1) { - genome.removeMutations(msat); - genome.addMutations(matchingMut); + haplosome.removeMutations(msat); + haplosome.addMutations(matchingMut); next; } } // make a new mutation with the new repeat count - genome.removeMutations(msat); - msat = genome.addNewDrawnMutation(m2, mutSite); + haplosome.removeMutations(msat); + msat = haplosome.addNewDrawnMutation(m2, mutSite); msat.tag = repeats; } } diff --git a/QtSLiM/recipes/Recipe 14.12 - Modeling transposable elements.txt b/QtSLiM/recipes/Recipe 14.12 - Modeling transposable elements.txt index f74d7c32f..1f7ceb770 100644 --- a/QtSLiM/recipes/Recipe 14.12 - Modeling transposable elements.txt +++ b/QtSLiM/recipes/Recipe 14.12 - Modeling transposable elements.txt @@ -28,22 +28,22 @@ initialize() { sim.tag = 0; // the next unique tag value to use for TEs // create some transposons at random positions - genomes = sim.subpopulations.genomes; + haplosomes = sim.subpopulations.haplosomes; positions = rdunif(teInitialCount, 0, L-1); for (teIndex in 0:(teInitialCount-1)) { pos = positions[teIndex]; - mut = genomes.addNewDrawnMutation(m2, pos); + mut = haplosomes.addNewDrawnMutation(m2, pos); mut.tag = sim.tag; sim.tag = sim.tag + 1; } } modifyChild() { // disable transposons with rate teDisableP - for (genome in child.genomes) + for (haplosome in child.haplosomes) { - tes = genome.mutationsOfType(m2); + tes = haplosome.mutationsOfType(m2); teCount = tes.size(); mutatedCount = teCount ? rpois(1, teCount * teDisableP) else 0; @@ -59,14 +59,14 @@ modifyChild() { if (size(disabledTE)) { // use the existing disabled TE mutation - genome.removeMutations(te); - genome.addMutations(disabledTE); + haplosome.removeMutations(te); + haplosome.addMutations(disabledTE); next; } // make a new disabled TE mutation with the right tag - genome.removeMutations(te); - disabledTE = genome.addNewDrawnMutation(m3, te.position); + haplosome.removeMutations(te); + disabledTE = haplosome.addNewDrawnMutation(m3, te.position); disabledTE.tag = te.tag; } } @@ -78,9 +78,9 @@ late() { // make active transposons copy themselves with rate teJumpP for (individual in sim.subpopulations.individuals) { - for (genome in individual.genomes) + for (haplosome in individual.haplosomes) { - tes = genome.mutationsOfType(m2); + tes = haplosome.mutationsOfType(m2); teCount = tes.size(); jumpCount = teCount ? rpois(1, teCount * teJumpP) else 0; @@ -92,7 +92,7 @@ late() { { // make a new TE mutation pos = rdunif(1, 0, L-1); - jumpTE = genome.addNewDrawnMutation(m2, pos); + jumpTE = haplosome.addNewDrawnMutation(m2, pos); jumpTE.tag = sim.tag; sim.tag = sim.tag + 1; } @@ -104,7 +104,7 @@ late() { // print information on each TE, including the fraction of it disabled all_tes = sortBy(sim.mutationsOfType(m2), "position"); all_disabledTEs = sortBy(sim.mutationsOfType(m3), "position"); - genomeCount = size(sim.subpopulations.genomes); + haplosomeCount = size(sim.subpopulations.haplosomes); catn("Active TEs:"); for (te in all_tes) @@ -126,7 +126,7 @@ late() { total = active + disabled; - cat("frequency " + format("%0.3f", total / genomeCount) + ", "); + cat("frequency " + format("%0.3f", total / haplosomeCount) + ", "); catn(round(active / total * 100) + "% active"); } diff --git a/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt b/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt index f4e2981d2..5815360a9 100644 --- a/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt +++ b/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt @@ -24,7 +24,7 @@ initialize() { sim.addSubpop("p1", 100); // create the canonical mutation objects - target = p1.genomes[0]; + target = p1.haplosomes[0]; target.addNewDrawnMutation(m2, 0:99); defineConstant("MUT2", target.mutations); target.removeMutations(); @@ -33,7 +33,7 @@ initialize() { target.removeMutations(); // start homozygous "aa" at every position - p1.genomes.addMutations(MUT3); + p1.haplosomes.addMutations(MUT3); // log results log = community.createLogFile("freq.csv", logInterval=10); diff --git a/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt b/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt index 0eaff07e7..51e63457e 100644 --- a/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt +++ b/QtSLiM/recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt @@ -22,7 +22,7 @@ initialize() { sim.addSubpop("p1", 100); // create the permanent m2 mutation objects we will use - target = p1.genomes[0]; + target = p1.haplosomes[0]; target.addNewDrawnMutation(m2, 0:99); defineConstant("MUT", target.mutations); @@ -37,7 +37,7 @@ initialize() { mutation(m3) { // if we already have an m2 mutation at the site, allow // the new m3 mutation; we will remove the stack below - if (genome.containsMarkerMutation(m2, mut.position)) + if (haplosome.containsMarkerMutation(m2, mut.position)) return T; // no m2 mutation is present, so unique down @@ -51,18 +51,18 @@ late() { // if so, we have m2/m3 stacked mutations to remove if (m3muts.length() > 0) { - genomes = sim.subpopulations.genomes; - counts = genomes.countOfMutationsOfType(m3); - hasStacked = genomes[counts > 0]; + haplosomes = sim.subpopulations.haplosomes; + counts = haplosomes.countOfMutationsOfType(m3); + hasStacked = haplosomes[counts > 0]; - for (genome in hasStacked) + for (haplosome in hasStacked) { - stacked_m3 = genome.mutationsOfType(m3); + stacked_m3 = haplosome.mutationsOfType(m3); stackPositions = stacked_m3.position; - all_m2 = genome.mutationsOfType(m2); + all_m2 = haplosome.mutationsOfType(m2); s = (match(all_m2.position, stackPositions) >= 0); stacked_m2 = all_m2[s]; - genome.removeMutations(c(stacked_m3, stacked_m2)); + haplosome.removeMutations(c(stacked_m3, stacked_m2)); } } } diff --git a/QtSLiM/recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt b/QtSLiM/recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt index ce7b702fe..d1852a5d5 100644 --- a/QtSLiM/recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt +++ b/QtSLiM/recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt @@ -38,15 +38,15 @@ initialize() { if (parts[0] != "positions:") stop("Missing positions."); positions = asFloat(parts[1:(size(parts)-1)]); - // create all mutations in a genome in a dummy subpopulation + // create all mutations in a haplosome in a dummy subpopulation sim.addSubpop("p2", 1); - g = p2.genomes[0]; - L = sim.chromosome.lastPosition; + g = p2.haplosomes[0]; + L = sim.chromosomes.lastPosition; intPositions = asInteger(round(positions * L)); muts = g.addNewMutation(m1, 0.0, intPositions); - // add the appropriate mutations to each genome - for (g in p1.genomes) + // add the appropriate mutations to each haplosome + for (g in p1.haplosomes) { f = asLogical(asInteger(strsplit(lines[index], ""))); index = index + 1; diff --git a/QtSLiM/recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt b/QtSLiM/recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt index 91ec540e2..a63474a02 100644 --- a/QtSLiM/recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt +++ b/QtSLiM/recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt @@ -21,8 +21,8 @@ initialize() { 1 late() { sim.addSubpop("p1", N); - // give some genomes an inversion - inverted = sample(p1.genomes, 100); + // give some haplosomes an inversion + inverted = sample(p1.haplosomes, 100); inverted.addNewDrawnMutation(m2, INV_START); inverted.addNewDrawnMutation(m3, INV_END); } @@ -41,8 +41,8 @@ mutationEffect(m2) { } recombination() { - gm1 = genome1.containsMarkerMutation(m2, INV_START); - gm2 = genome2.containsMarkerMutation(m2, INV_START); + gm1 = haplosome1.containsMarkerMutation(m2, INV_START); + gm2 = haplosome2.containsMarkerMutation(m2, INV_START); if (!(gm1 | gm2)) { // homozygote non-inverted return F; @@ -61,7 +61,7 @@ recombination() { } else { // heterozygote inverted: resample to get an even number of breakpoints // this is *recursive*: it calls this recombination callback again! - breakpoints = sim.chromosome.drawBreakpoints(individual); + breakpoints = sim.chromosomes.drawBreakpoints(individual); } return T; } diff --git a/QtSLiM/recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt b/QtSLiM/recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt index f115ac350..f7cd2ade8 100644 --- a/QtSLiM/recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt +++ b/QtSLiM/recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt @@ -25,15 +25,15 @@ initialize() // initialize the pop, with a Y marker for each male sim.addSubpop("p1", 1000); i = p1.individuals; - i[i.sex == "M"].genome2.addNewMutation(m3, 0.0, 5999999); + i[i.sex == "M"].haplosomesFromParent2.addNewMutation(m3, 0.0, 5999999); } modifyChild() { // females should not have a Y, males should have a Y if (child.sex == "F") - return !child.genome2.containsMarkerMutation(m3, 5999999); + return !child.haplosomesFromParent2.containsMarkerMutation(m3, 5999999); else - return child.genome2.containsMarkerMutation(m3, 5999999); + return child.haplosomesFromParent2.containsMarkerMutation(m3, 5999999); } 1:10000 late() { @@ -46,7 +46,7 @@ modifyChild() { // look at the mutations in a single Y chromosome // to find mutations that are fixed in all Y's firstMale = p1.individuals[p1.individuals.sex == "M"][0]; - fMG = firstMale.genomes; + fMG = firstMale.haplosomes; if (fMG[0].containsMarkerMutation(m3, 5999999)) { firstY = fMG[0]; @@ -70,7 +70,7 @@ modifyChild() { cat(removeX.size() + "/" + removeY.size() + " on X/Y\n"); removes = c(removeY, removeX); - sim.subpopulations.genomes.removeMutations(removes, T); + sim.subpopulations.haplosomes.removeMutations(removes, T); } } diff --git a/QtSLiM/recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt b/QtSLiM/recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt index f7117ae64..169595234 100644 --- a/QtSLiM/recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt +++ b/QtSLiM/recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt @@ -30,11 +30,11 @@ initialize() { muttype in c(m1,m2,m3), symbol in c("M1","M2","M3")) { - genomes = subpop.genomes; - muts = genomes.addNewDrawnMutation(muttype, positions); + haplosomes = subpop.haplosomes; + muts = haplosomes.addNewDrawnMutation(muttype, positions); defineConstant(symbol, muts); - mut = genomes.addNewDrawnMutation(m4, integerDiv(Z, 2)); + mut = haplosomes.addNewDrawnMutation(m4, integerDiv(Z, 2)); catn("Beneficial mutation: s == " + mut.selectionCoeff); } diff --git a/QtSLiM/recipes/Recipe 14.9 - Modeling haploid organisms.txt b/QtSLiM/recipes/Recipe 14.9 - Modeling haploid organisms.txt index a29f44e5c..faff72216 100644 --- a/QtSLiM/recipes/Recipe 14.9 - Modeling haploid organisms.txt +++ b/QtSLiM/recipes/Recipe 14.9 - Modeling haploid organisms.txt @@ -12,14 +12,14 @@ initialize() { p1.setCloningRate(1.0); } late() { - // remove any new mutations added to the disabled diploid genomes - sim.subpopulations.individuals.genome2.removeMutations(); + // remove any new mutations added to the disabled diploid haplosomes + sim.subpopulations.individuals.haplosomesFromParent2.removeMutations(); - // remove mutations in the haploid genomes that have fixed + // remove mutations in the haploid haplosomes that have fixed muts = sim.mutationsOfType(m1); freqs = sim.mutationFrequencies(NULL, muts); if (any(freqs == 0.5)) - sim.subpopulations.genomes.removeMutations(muts[freqs == 0.5], T); + sim.subpopulations.haplosomes.removeMutations(muts[freqs == 0.5], T); } 200000 late() { sim.outputFixedMutations(); diff --git a/QtSLiM/recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt b/QtSLiM/recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt index 488f598b4..3568a6cb2 100644 --- a/QtSLiM/recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt +++ b/QtSLiM/recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt @@ -11,7 +11,7 @@ initialize() { initializeRecombinationRate(1e-8); } reproduction() { - subpop.addRecombinant(individual.genome1, NULL, NULL, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, NULL, NULL, NULL); } 1 early() { sim.addSubpop("p1", 500, haploid=T); diff --git a/QtSLiM/recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt b/QtSLiM/recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt index 00df94d7d..9f2c6c859 100644 --- a/QtSLiM/recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt +++ b/QtSLiM/recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt @@ -16,7 +16,7 @@ reproduction() { if (runif(1) < H) { // horizontal gene transfer from a randomly chosen individual - HGTsource = p1.sampleIndividuals(1, exclude=individual).genome1; + HGTsource = p1.sampleIndividuals(1, exclude=individual).haplosomesFromParent1; // draw two distinct locations; redraw if we get a duplicate do breaks = rdunif(2, max=L-1); @@ -26,12 +26,12 @@ reproduction() { if (breaks[0] > breaks[1]) breaks = c(0, breaks[1], breaks[0]); - subpop.addRecombinant(individual.genome1, HGTsource, breaks, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, HGTsource, breaks, NULL, NULL, NULL); } else { // no horizontal gene transfer; clonal replication - subpop.addRecombinant(individual.genome1, NULL, NULL, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, NULL, NULL, NULL); } } 1 early() { @@ -39,7 +39,7 @@ reproduction() { sim.addSubpop("p1", 2, haploid=T); // add beneficial mutations to each bacterium, but at different loci - g = p1.individuals.genome1; + g = p1.individuals.haplosomesFromParent1; g[0].addNewDrawnMutation(m2, asInteger(L * 0.25)); g[1].addNewDrawnMutation(m2, asInteger(L * 0.75)); } diff --git a/QtSLiM/recipes/Recipe 15.14 - Alternation of generations.txt b/QtSLiM/recipes/Recipe 15.14 - Alternation of generations.txt index 1b677fb11..9f28ad51b 100644 --- a/QtSLiM/recipes/Recipe 15.14 - Alternation of generations.txt +++ b/QtSLiM/recipes/Recipe 15.14 - Alternation of generations.txt @@ -23,24 +23,24 @@ initialize() } reproduction(p1) { - g_1 = individual.genome1; - g_2 = individual.genome2; + g_1 = individual.haplosomesFromParent1; + g_2 = individual.haplosomesFromParent2; for (meiosisCount in 1:5) { if (individual.sex == "M") { - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); s_1 = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "M"); s_2 = p2.addRecombinant(g_2, g_1, breaks, NULL, NULL, NULL, "M"); - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); s_3 = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "M"); s_4 = p2.addRecombinant(g_2, g_1, breaks, NULL, NULL, NULL, "M"); } else if (individual.sex == "F") { - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); e = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "F", randomizeStrands=T); } @@ -51,8 +51,8 @@ reproduction(p2, "F") mate = p2.sampleIndividuals(1, sex="M", tagL0=F); mate.tagL0 = T; - child = p1.addRecombinant(individual.genome1, NULL, NULL, - mate.genome1, NULL, NULL); + child = p1.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, + mate.haplosomesFromParent1, NULL, NULL); } early() { @@ -60,13 +60,13 @@ early() { p1.fitnessScaling = 0.0; p2.individuals.tagL0 = F; - sim.chromosome.setMutationRate(0.0); + sim.chromosomes.setMutationRate(0.0); } else { p2.fitnessScaling = 0.0; p1.fitnessScaling = K / p1.individualCount; - sim.chromosome.setMutationRate(MU); + sim.chromosomes.setMutationRate(MU); } } 10000 late() diff --git a/QtSLiM/recipes/Recipe 15.15 - Meiotic drive.txt b/QtSLiM/recipes/Recipe 15.15 - Meiotic drive.txt index 0b133755c..90b28c351 100644 --- a/QtSLiM/recipes/Recipe 15.15 - Meiotic drive.txt +++ b/QtSLiM/recipes/Recipe 15.15 - Meiotic drive.txt @@ -1,11 +1,11 @@ // Keywords: nonWF, non-Wright-Fisher, meiotic drive, segregation distortion, intragenomic conflict -function (i)driveBreakpoints(o$ gen1, o$ gen2) +function (i)driveBreakpoints(o$ gen1, o$ gen2) { // start with default breakpoints generated by the chromosome - breaks = sim.chromosome.drawBreakpoints(); + breaks = sim.chromosomes.drawBreakpoints(); - // if both genomes have the drive, or neither, then just return + // if both haplosomes have the drive, or neither, then just return gen1has = gen1.containsMarkerMutation(m2, D_pos); gen2has = gen2.containsMarkerMutation(m2, D_pos); if (gen1has == gen2has) @@ -42,9 +42,9 @@ initialize() { } reproduction() { m = subpop.sampleIndividuals(1); - b1 = driveBreakpoints(individual.genome1, individual.genome2); - b2 = driveBreakpoints(m.genome1, m.genome2); - subpop.addRecombinant(individual.genome1, individual.genome2, b1, m.genome1, m.genome2, b2); + b1 = driveBreakpoints(individual.haplosomesFromParent1, individual.haplosomesFromParent2); + b2 = driveBreakpoints(m.haplosomesFromParent1, m.haplosomesFromParent2); + subpop.addRecombinant(individual.haplosomesFromParent1, individual.haplosomesFromParent2, b1, m.haplosomesFromParent1, m.haplosomesFromParent2, b2); } 1 early() { sim.addSubpop("p1", 10); @@ -53,7 +53,7 @@ early() { p1.fitnessScaling = K / p1.individualCount; } 100 early() { - target = sample(p1.genomes, 10); + target = sample(p1.haplosomes, 10); target.addNewDrawnMutation(m2, D_pos); } 100:1000 late() { diff --git a/QtSLiM/recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt b/QtSLiM/recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt index 10a784b85..194a9c859 100644 --- a/QtSLiM/recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt +++ b/QtSLiM/recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt @@ -14,26 +14,26 @@ initialize() { initializeSex("A"); } reproduction(NULL, "F") { - gen1 = individual.genome1; - gen2 = individual.genome2; - breaks = sim.chromosome.drawBreakpoints(individual); + gen1 = individual.haplosomesFromParent1; + gen2 = individual.haplosomesFromParent2; + breaks = sim.chromosomes.drawBreakpoints(individual); // decide whether we're generating a haploid male or a diploid female if (rbinom(1, 1, P_OFFSPRING_MALE)) { // didn't find a mate; make a haploid male from an unfertilized egg: - // - one genome comes from recombination of the female's genomes - // - the other genome is a null genome (a placeholder) + // - one haplosome comes from recombination of the female's haplosomes + // - the other haplosome is a null haplosome (a placeholder) subpop.addRecombinant(gen1, gen2, breaks, NULL, NULL, NULL, "M", randomizeStrands=T); } else { // found a mate; make a diploid female from a fertilized egg: - // - one genome comes from recombination of the female's genomes - // - the other genome comes from the mate (a haploid male) + // - one haplosome comes from recombination of the female's haplosomes + // - the other haplosome comes from the mate (a haploid male) mate = subpop.sampleIndividuals(1, sex="M"); - subpop.addRecombinant(gen1, gen2, breaks, mate.genome1, NULL, NULL, "F", + subpop.addRecombinant(gen1, gen2, breaks, mate.haplosomesFromParent1, NULL, NULL, "F", randomizeStrands=T); } } diff --git a/QtSLiM/recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt b/QtSLiM/recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt index 35bf5f83e..c9ba9f74d 100644 --- a/QtSLiM/recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt +++ b/QtSLiM/recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt @@ -21,7 +21,7 @@ reproduction() { sim.addSubpop("p1", 10); } 100 early() { - mutant = sample(p1.individuals.genomes, 10); + mutant = sample(p1.individuals.haplosomes, 10); mutant.addNewDrawnMutation(m2, 10000); } early() { diff --git a/QtSLiM/recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt b/QtSLiM/recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt index 2a3208754..8b55068a1 100644 --- a/QtSLiM/recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt +++ b/QtSLiM/recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 1e5); } 100 late() { - sample(p1.genomes, 1).addNewDrawnMutation(m2, 5e5); + sample(p1.haplosomes, 1).addNewDrawnMutation(m2, 5e5); } 100:10000 late() { mut = sim.mutationsOfType(m2); diff --git a/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt b/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt index d274adcaa..dd06e056d 100644 --- a/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt +++ b/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt @@ -14,7 +14,7 @@ initialize() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m3, 10000); defineConstant("PATH", tempdir() + "slim_" + simID + ".trees"); sim.outputFull(PATH); diff --git a/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt b/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt index a5107673f..2813e6f93 100644 --- a/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt +++ b/QtSLiM/recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt @@ -23,7 +23,7 @@ initialize() { // record tag values and pedigree IDs in metadata metadataDict = Dictionary("tags", tags, "ids", inds.pedigreeID); - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m3, 10000); defineConstant("PATH", tempdir() + "slim_" + simID + ".trees"); sim.treeSeqOutput(PATH, metadata=metadataDict); diff --git a/QtSLiM/recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt b/QtSLiM/recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt index b78423641..94ba44755 100644 --- a/QtSLiM/recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt +++ b/QtSLiM/recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt @@ -14,8 +14,8 @@ initialize() { sim.addSubpop("p2", 500); sim.treeSeqRememberIndividuals(sim.subpopulations.individuals); - p1.genomes.addNewDrawnMutation(m1, asInteger(L * 0.2)); - p2.genomes.addNewDrawnMutation(m1, asInteger(L * 0.8)); + p1.haplosomes.addNewDrawnMutation(m1, asInteger(L * 0.2)); + p2.haplosomes.addNewDrawnMutation(m1, asInteger(L * 0.8)); sim.addSubpop("p3", 1000); p3.setMigrationRates(c(p1, p2), c(0.5, 0.5)); diff --git a/QtSLiM/recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt b/QtSLiM/recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt index d35988776..9e3533fde 100644 --- a/QtSLiM/recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt +++ b/QtSLiM/recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt @@ -14,7 +14,7 @@ initialize() { } 1 late() { sim.readFromPopulationFile("coalasex.trees"); - target = sample(sim.subpopulations.genomes, 1); + target = sample(sim.subpopulations.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1: late() { diff --git a/QtSLiM/recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt b/QtSLiM/recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt index 4c60bf89e..97d34d8c5 100644 --- a/QtSLiM/recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt +++ b/QtSLiM/recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt @@ -18,6 +18,6 @@ initialize() { 1:500001 early() { if (sim.cycle % 1000 == 1) { cat(sim.cycle + ": "); - print(nucleotideFrequencies(sim.chromosome.ancestralNucleotides())); + print(nucleotideFrequencies(sim.chromosomes.ancestralNucleotides())); } } diff --git a/QtSLiM/recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt b/QtSLiM/recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt index 7b9547f9c..4ae6ee7d6 100644 --- a/QtSLiM/recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt +++ b/QtSLiM/recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt @@ -14,7 +14,7 @@ initialize() { } 1 late() { sim.addSubpop("p1", 99); - p1.genomes.readFromVCF("chr22_filtered.recode.vcf", m1); + p1.haplosomes.readFromVCF("chr22_filtered.recode.vcf", m1); p1.setSubpopulationSize(1000); } 5 late() { diff --git a/QtSLiM/recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt b/QtSLiM/recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt index 5591e40f6..ea2f7c1b0 100644 --- a/QtSLiM/recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt +++ b/QtSLiM/recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt @@ -25,18 +25,18 @@ late() { for (mut in new_muts) { pos = mut.position; - if (mut.nucleotide == sim.chromosome.ancestralNucleotides(pos, pos)) + if (mut.nucleotide == sim.chromosomes.ancestralNucleotides(pos, pos)) back_muts = c(back_muts, mut); } if (size(back_muts)) - sim.subpopulations.genomes.removeMutations(back_muts); + sim.subpopulations.haplosomes.removeMutations(back_muts); } 1000 late() { for (pos in 0:99) { muts = sim.subsetMutations(position=pos); nucs = muts.nucleotide; - ancestral = sim.chromosome.ancestralNucleotides(pos, pos); + ancestral = sim.chromosomes.ancestralNucleotides(pos, pos); cat(pos + " : " + paste(nucs)); if (size(nucs) != size(unique(nucs))) cat(" DUPLICATES!"); diff --git a/QtSLiM/recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt b/QtSLiM/recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt index 2efc9654d..5a31b6ce6 100644 --- a/QtSLiM/recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt +++ b/QtSLiM/recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt @@ -10,7 +10,7 @@ initialize() { initializeRecombinationRate(1e-8); } 1 early() { - c = sim.chromosome; + c = sim.chromosomes; catn("Ancestral: " + c.ancestralNucleotides()); catn("Ancestral: " + paste(c.ancestralNucleotides(format="char"))); catn("Ancestral: " + paste(c.ancestralNucleotides(format="integer"))); @@ -25,14 +25,14 @@ initialize() { catn("positions: " + paste(sim.substitutions.position)); catn(); - c = sim.chromosome; + c = sim.chromosomes; catn("Ancestral: " + c.ancestralNucleotides()); catn("Ancestral: " + paste(c.ancestralNucleotides(format="char"))); catn("Ancestral: " + paste(c.ancestralNucleotides(format="integer"))); catn("positions: " + paste(0:(L-1))); catn(); - g = p1.genomes[0]; + g = p1.haplosomes[0]; catn("SNPs: " + paste(g.mutations.nucleotide)); catn("SNPs: " + paste(g.mutations.nucleotideValue)); diff --git a/QtSLiM/recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt b/QtSLiM/recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt index 67b7aef5e..c10085da0 100644 --- a/QtSLiM/recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt +++ b/QtSLiM/recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 500); } 5000 late() { - g = p1.sampleIndividuals(5).genomes; + g = p1.sampleIndividuals(5).haplosomes; g.outputVCF(simplifyNucleotides=F); g.outputVCF(simplifyNucleotides=T); } diff --git a/QtSLiM/recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt b/QtSLiM/recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt index c9c84d0a1..ad59d357c 100644 --- a/QtSLiM/recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt +++ b/QtSLiM/recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt @@ -26,6 +26,6 @@ initialize() { 1:10000000 early() { if (sim.cycle % 10000 == 1) { cat(sim.cycle + ": "); - print(nucleotideFrequencies(sim.chromosome.ancestralNucleotides())); + print(nucleotideFrequencies(sim.chromosomes.ancestralNucleotides())); } } diff --git a/QtSLiM/recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt b/QtSLiM/recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt index 5891977d6..79a80ef33 100644 --- a/QtSLiM/recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt +++ b/QtSLiM/recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt @@ -15,7 +15,7 @@ initialize() { } 1 late() { sim.addSubpop("p1", 500); - sample(p1.genomes, 10).addNewDrawnMutation(m2, 20000); + sample(p1.haplosomes, 10).addNewDrawnMutation(m2, 20000); } 2000 late() { print(sim.mutationsOfType(m2)); diff --git a/QtSLiM/recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt b/QtSLiM/recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt index 8d0435bdf..63f5c3178 100644 --- a/QtSLiM/recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt +++ b/QtSLiM/recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt @@ -21,8 +21,8 @@ late() { s1.active = 0; } s1 fitnessEffect() { - nuc1 = individual.genome1.nucleotides(100, 100, format="integer"); - nuc2 = individual.genome2.nucleotides(100, 100, format="integer"); + nuc1 = individual.haplosomesFromParent1.nucleotides(100, 100, format="integer"); + nuc2 = individual.haplosomesFromParent2.nucleotides(100, 100, format="integer"); return EFF[nuc1] * EFF[nuc2]; } 10000 late() { diff --git a/QtSLiM/recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt b/QtSLiM/recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt index e158f8641..a2446caa5 100644 --- a/QtSLiM/recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt +++ b/QtSLiM/recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt @@ -28,7 +28,7 @@ initialize() { sim.addSubpop("p1", 500); } fitnessEffect() { - for (g in individual.genomes) + for (g in individual.haplosomes) { seq = g.nucleotides(253, 670) + g.nucleotides(871, 1034); codons = nucleotidesToCodons(seq); @@ -41,8 +41,8 @@ fitnessEffect() { 100000 late() { catn(sim.substitutions.size() + " fixed mutations."); - as1 = sim.chromosome.ancestralNucleotides(253, 670, "integer"); - as2 = sim.chromosome.ancestralNucleotides(871, 1034, "integer"); + as1 = sim.chromosomes.ancestralNucleotides(253, 670, "integer"); + as2 = sim.chromosomes.ancestralNucleotides(871, 1034, "integer"); as = c(as1, as2); codons = nucleotidesToCodons(as); catn("Final AA sequence: " + codonsToAminoAcids(codons)); diff --git a/QtSLiM/recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt b/QtSLiM/recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt index 3f77b3f7c..45861183f 100644 --- a/QtSLiM/recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt +++ b/QtSLiM/recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt @@ -27,7 +27,7 @@ species parasite initialize() { } function (float$)nucleotideFreq(o$ species, s$ nuc) { - nucs = species.subpopulations.individuals.genomes.nucleotides(); + nucs = species.subpopulations.individuals.haplosomes.nucleotides(); return mean(nucs == nuc); } @@ -55,7 +55,7 @@ ticks all late() { for (p in parasites, h in chosen_hosts) { // infection depends upon a match (diploid matching-allele model) - all_nucleotides = c(p.genomes.nucleotides(), h.genomes.nucleotides()); + all_nucleotides = c(p.haplosomes.nucleotides(), h.haplosomes.nucleotides()); if (size(unique(all_nucleotides, preserveOrder=F)) == 1) { diff --git a/QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt b/QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt similarity index 93% rename from QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt rename to QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt index 0a54862db..72f1edbb7 100644 --- a/QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt +++ b/QtSLiM/recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt @@ -18,5 +18,5 @@ initialize() { allIndividuals = sim.subpopulations.individuals; w = asFloat(allIndividuals.countOfMutationsOfType(m2) + 1); sampledIndividuals = sample(allIndividuals, 10, weights=w); - sampledIndividuals.genomes.output(); + sampledIndividuals.haplosomes.output(); } diff --git a/QtSLiM/recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt b/QtSLiM/recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt index b68038630..9da5273c7 100644 --- a/QtSLiM/recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt +++ b/QtSLiM/recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt @@ -14,6 +14,6 @@ initialize() { p2.setMigrationRates(p1, 0.001); log = community.createLogFile("sim_log.txt", logInterval=10); log.addCycle(); - log.addCustomColumn("FST", "calcFST(p1.genomes, p2.genomes);"); + log.addCustomColumn("FST", "calcFST(p1.haplosomes, p2.haplosomes);"); } 20000 late() { } diff --git a/QtSLiM/recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt b/QtSLiM/recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt index 2cb99a3fd..bb9e6afcf 100644 --- a/QtSLiM/recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt +++ b/QtSLiM/recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt @@ -14,8 +14,8 @@ initialize() { // custom MS-style output from a multi-subpop sample 2000 late() { - // obtain a random sample of genomes from the whole population - g = sample(sim.subpopulations.genomes, 10, T); + // obtain a random sample of haplosomes from the whole population + h = sample(sim.subpopulations.haplosomes, 10, T); // get the unique mutations in the sample, sorted by position m = sortBy(unique(g.mutations), "position"); @@ -24,13 +24,13 @@ initialize() { cat("\n\nsegsites: " + size(m) + "\n"); // print the positions - positions = format("%.6f", m.position / sim.chromosome.lastPosition); + positions = format("%.6f", m.position / sim.chromosomes.lastPosition); cat("positions: " + paste(positions, sep=" ") + "\n"); - // print the sampled genomes - for (genome in g) + // print the sampled haplosomes + for (haplosome in h) { - hasMuts = (match(m, genome.mutations) >= 0); + hasMuts = (match(m, haplosome.mutations) >= 0); cat(paste(asInteger(hasMuts), sep="") + "\n"); } } diff --git a/QtSLiM/recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt b/QtSLiM/recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt index 23913ec76..6c01133a2 100644 --- a/QtSLiM/recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt +++ b/QtSLiM/recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt @@ -39,6 +39,6 @@ initialize() { // introduce a beneficial mutation target_subpop = sample(sim.subpopulations, 1); - sample(target_subpop.genomes, 10).addNewDrawnMutation(m2, 20000); + sample(target_subpop.haplosomes, 10).addNewDrawnMutation(m2, 20000); } 10000 late() { sim.outputFixedMutations(); } diff --git a/QtSLiM/recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt b/QtSLiM/recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt index 44a2b547e..19f222911 100644 --- a/QtSLiM/recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt +++ b/QtSLiM/recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt @@ -59,7 +59,7 @@ initialize() { initializeRecombinationRate(1e-8); } 1 early() { - sim.chromosome.colorSubstitution = ""; + sim.chromosomes.colorSubstitution = ""; sim.addSubpop("p1", 5000); } 10000 early() { sim.simulationFinished(); } diff --git a/QtSLiM/recipes/Recipe 9.1 - Introducing adaptive mutations.txt b/QtSLiM/recipes/Recipe 9.1 - Introducing adaptive mutations.txt index 992eb4e61..f3a952b01 100644 --- a/QtSLiM/recipes/Recipe 9.1 - Introducing adaptive mutations.txt +++ b/QtSLiM/recipes/Recipe 9.1 - Introducing adaptive mutations.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:100000 late() { diff --git a/QtSLiM/recipes/Recipe 9.10 - Tracking the fate of background mutations.txt b/QtSLiM/recipes/Recipe 9.10 - Tracking the fate of background mutations.txt index 0ecfdadaa..32eda7b8a 100644 --- a/QtSLiM/recipes/Recipe 9.10 - Tracking the fate of background mutations.txt +++ b/QtSLiM/recipes/Recipe 9.10 - Tracking the fate of background mutations.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); defineConstant("BACKGROUND", target.mutations); mut = target.addNewDrawnMutation(m2, asInteger(L/2)); defineConstant("SWEEP", mut); diff --git a/QtSLiM/recipes/Recipe 9.11 - Effective population size versus census population size.txt b/QtSLiM/recipes/Recipe 9.11 - Effective population size versus census population size.txt index 2308b719c..a29b0d99a 100644 --- a/QtSLiM/recipes/Recipe 9.11 - Effective population size versus census population size.txt +++ b/QtSLiM/recipes/Recipe 9.11 - Effective population size versus census population size.txt @@ -32,7 +32,7 @@ initialize() { p1.setValue("previous_N", p1.individualCount); } 10000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, integerDiv(L, 2)); } 20000 late() { @@ -49,7 +49,7 @@ function (float)mutTypeFrequency(o$ mutType) function (float)estimateNe_Heterozygosity(o$ subpop) { - pi = calcHeterozygosity(p1.genomes); + pi = calcHeterozygosity(p1.haplosomes); return pi / (4 * MU); } diff --git a/QtSLiM/recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt b/QtSLiM/recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt index bf7859af5..0dbb0f2f8 100644 --- a/QtSLiM/recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt +++ b/QtSLiM/recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:100000 late() { @@ -43,7 +43,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/QtSLiM/recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt b/QtSLiM/recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt index b149a22c6..df1086fe7 100644 --- a/QtSLiM/recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt +++ b/QtSLiM/recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000: late() { @@ -44,7 +44,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/QtSLiM/recipes/Recipe 9.4 - Partial sweeps.txt b/QtSLiM/recipes/Recipe 9.4 - Partial sweeps.txt index f192d43e3..c625551e1 100644 --- a/QtSLiM/recipes/Recipe 9.4 - Partial sweeps.txt +++ b/QtSLiM/recipes/Recipe 9.4 - Partial sweeps.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:10000 late() { diff --git a/QtSLiM/recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt b/QtSLiM/recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt index d5ca891e3..f98614b2a 100644 --- a/QtSLiM/recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt +++ b/QtSLiM/recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 100000); } 1:10000 early() { - counts = p1.genomes.countOfMutationsOfType(m1); + counts = p1.haplosomes.countOfMutationsOfType(m1); freq = mean(counts > 0); if (freq == 1.0) @@ -22,7 +22,7 @@ initialize() { for (mut in sortBy(sim.mutations, "originTick")) { - mutFreq = mean(p1.genomes.containsMutations(mut)); + mutFreq = mean(p1.haplosomes.containsMutations(mut)); cat("Origin " + mut.originTick + ": " + mutFreq + "\n"); } diff --git a/QtSLiM/recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt b/QtSLiM/recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt index f7692ae87..791d93928 100644 --- a/QtSLiM/recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt +++ b/QtSLiM/recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt @@ -15,7 +15,7 @@ initialize() { 1000:1100 late() { if (sim.cycle % 10 == 0) { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); if (target.countOfMutationsOfType(m2) == 0) target.addNewDrawnMutation(m2, 10000); } @@ -36,7 +36,7 @@ initialize() { } } } - if (all(p1.genomes.countOfMutationsOfType(m2) > 0)) { + if (all(p1.haplosomes.countOfMutationsOfType(m2) > 0)) { cat("Soft sweep ended in cycle " + sim.cycle + "\n"); cat("Frequencies:\n"); print(sim.mutationFrequencies(p1, sim.mutationsOfType(m2))); diff --git a/QtSLiM/recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt b/QtSLiM/recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt index e2e94b0b3..8ed98b152 100644 --- a/QtSLiM/recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt +++ b/QtSLiM/recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt @@ -21,7 +21,7 @@ initialize() { community.deregisterScriptBlock(s1); } s1 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); mut = sim.mutationsOfType(m2); if (mut.size() > 0) target.addMutations(mut); diff --git a/QtSLiM/recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt b/QtSLiM/recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt index d966f98e7..b23841f9c 100644 --- a/QtSLiM/recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt +++ b/QtSLiM/recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000: late() { @@ -45,7 +45,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/QtSLiM/recipes/Recipe 9.7 - Adaptive introgression.txt b/QtSLiM/recipes/Recipe 9.7 - Adaptive introgression.txt index 76f6f3d95..bdb9ffa52 100644 --- a/QtSLiM/recipes/Recipe 9.7 - Adaptive introgression.txt +++ b/QtSLiM/recipes/Recipe 9.7 - Adaptive introgression.txt @@ -18,7 +18,7 @@ initialize() { sim.subpopulations[i-1].setMigrationRates(i+1, 0.2); } 100 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 100:100000 late() { diff --git a/QtSLiM/recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt b/QtSLiM/recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt index b6694b10c..2494f90d6 100644 --- a/QtSLiM/recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt +++ b/QtSLiM/recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); mut = target.addNewDrawnMutation(m2, 10000); defineConstant("SWEEP", mut); } diff --git a/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt b/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt index a550fb5ad..b1891e502 100644 --- a/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt +++ b/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis I.txt @@ -18,9 +18,9 @@ initialize() { 1 early() { sim.addSubpop("p1", 500); } 10000 early() { sim.simulationFinished(); } mutationEffect(m3) { - if (individual.genome1.countOfMutationsOfType(m2)) + if (individual.haplosomesFromParent1.countOfMutationsOfType(m2)) return 0.5; - else if (individual.genome2.countOfMutationsOfType(m2)) + else if (individual.haplosomesFromParent2.countOfMutationsOfType(m2)) return 0.5; else return effect; diff --git a/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt b/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt index 02b7cb2c6..80aa8c287 100644 --- a/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt +++ b/SLiMgui/Recipes/Recipe 10.3.1 - Fitness as a function of genomic background, Epistasis II.txt @@ -20,9 +20,9 @@ initialize() { 1 early() { sim.addSubpop("p1", 500); } 10000 early() { sim.simulationFinished(); } mutationEffect(m3) { - if (individual.genome1.countOfMutationsOfType(m2)) + if (individual.haplosomesFromParent1.countOfMutationsOfType(m2)) return 0.5; - else if (individual.genome2.countOfMutationsOfType(m2)) + else if (individual.haplosomesFromParent2.countOfMutationsOfType(m2)) return 0.5; else return effect; diff --git a/SLiMgui/Recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt b/SLiMgui/Recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt index 95288da4e..408bef7b7 100644 --- a/SLiMgui/Recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt +++ b/SLiMgui/Recipes/Recipe 10.4.3 - Fitness as a function of population composition, Kin selection and the green-beard effect.txt @@ -12,7 +12,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1 late() { - target = sample(p1.genomes, 100); + target = sample(p1.haplosomes, 100); target.addNewDrawnMutation(m2, 10000); } 1: late() { diff --git a/SLiMgui/Recipes/Recipe 11.1 - Assortative mating.txt b/SLiMgui/Recipes/Recipe 11.1 - Assortative mating.txt index 261c148ef..92e6667c0 100644 --- a/SLiMgui/Recipes/Recipe 11.1 - Assortative mating.txt +++ b/SLiMgui/Recipes/Recipe 11.1 - Assortative mating.txt @@ -16,7 +16,7 @@ initialize() { p2.setMigrationRates(p1, 0.1); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } mutationEffect(m2, p2) { return 0.2; } @@ -40,7 +40,7 @@ mutationEffect(m2, p2) { return 0.2; } return weights * sourceSubpop.getValue("weights2"); } 10000: late() { - FST = calcFST(p1.genomes, p2.genomes); + FST = calcFST(p1.haplosomes, p2.haplosomes); sim.setValue("FST", sim.getValue("FST") + FST); } 19999 late() { diff --git a/SLiMgui/Recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt b/SLiMgui/Recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt index 2124b011c..aa3959d95 100644 --- a/SLiMgui/Recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt +++ b/SLiMgui/Recipes/Recipe 11.3 - Gametophytic self-incompatibility.txt @@ -17,9 +17,9 @@ initialize() { cat("m2 mutation count: " + sim.countOfMutationsOfType(m2) + "\n"); } modifyChild(p1) { - pollenSMuts = child.genome2.mutationsOfType(m2); - styleSMuts1 = parent1.genome1.mutationsOfType(m2); - styleSMuts2 = parent1.genome2.mutationsOfType(m2); + pollenSMuts = child.haplosomesFromParent2.mutationsOfType(m2); + styleSMuts1 = parent1.haplosomesFromParent1.mutationsOfType(m2); + styleSMuts2 = parent1.haplosomesFromParent2.mutationsOfType(m2); if (identical(pollenSMuts, styleSMuts1)) if (runif(1) < 0.99) return F; diff --git a/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis I.txt b/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis I.txt index 976f34aa3..87d209e30 100644 --- a/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis I.txt +++ b/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis I.txt @@ -15,12 +15,12 @@ initialize() { sim.addSubpop("p1", 500); } 1 late() { - sample(p1.genomes, 20).addNewDrawnMutation(m2, 10000); // add A - sample(p1.genomes, 20).addNewDrawnMutation(m3, 20000); // add B + sample(p1.haplosomes, 20).addNewDrawnMutation(m2, 10000); // add A + sample(p1.haplosomes, 20).addNewDrawnMutation(m3, 20000); // add B } modifyChild() { - hasMutA = any(child.genomes.countOfMutationsOfType(m2) > 0); - hasMutB = any(child.genomes.countOfMutationsOfType(m3) > 0); + hasMutA = any(child.haplosomes.countOfMutationsOfType(m2) > 0); + hasMutB = any(child.haplosomes.countOfMutationsOfType(m3) > 0); if (hasMutA & hasMutB) return F; return T; diff --git a/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis II.txt b/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis II.txt index d1e62e19f..5be4323f3 100644 --- a/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis II.txt +++ b/SLiMgui/Recipes/Recipe 12.2 - Lethal epistasis II.txt @@ -15,12 +15,12 @@ initialize() { sim.addSubpop("p1", 500); } 1 late() { - sample(p1.genomes, 20).addNewDrawnMutation(m2, 10000); // add A - sample(p1.genomes, 20).addNewDrawnMutation(m3, 20000); // add B + sample(p1.haplosomes, 20).addNewDrawnMutation(m2, 10000); // add A + sample(p1.haplosomes, 20).addNewDrawnMutation(m3, 20000); // add B } modifyChild() { - mutACount = sum(child.genomes.countOfMutationsOfType(m2)); - mutBCount = sum(child.genomes.countOfMutationsOfType(m3)); + mutACount = sum(child.haplosomes.countOfMutationsOfType(m2)); + mutBCount = sum(child.haplosomes.countOfMutationsOfType(m3)); if ((mutACount == 2) & (mutBCount == 2)) return F; return T; diff --git a/SLiMgui/Recipes/Recipe 12.3 - Simulating gene drive.txt b/SLiMgui/Recipes/Recipe 12.3 - Simulating gene drive.txt index 3a28ccc88..9ae33724d 100644 --- a/SLiMgui/Recipes/Recipe 12.3 - Simulating gene drive.txt +++ b/SLiMgui/Recipes/Recipe 12.3 - Simulating gene drive.txt @@ -17,7 +17,7 @@ initialize() { sim.subpopulations[i].setMigrationRates(i+1, 0.1); } 100 late() { - p0.genomes[0:49].addNewDrawnMutation(m2, 10000); + p0.haplosomes[0:49].addNewDrawnMutation(m2, 10000); } 100:10000 late() { if (sim.countOfMutationsOfType(m2) == 0) @@ -34,12 +34,12 @@ mutationEffect(m2) { mut = sim.mutationsOfType(m2); if (size(mut) == 1) { - hasMutOnChromosome1 = child.genome1.containsMutations(mut); - hasMutOnChromosome2 = child.genome2.containsMutations(mut); + hasMutOnChromosome1 = child.haplosomesFromParent1.containsMutations(mut); + hasMutOnChromosome2 = child.haplosomesFromParent2.containsMutations(mut); if (hasMutOnChromosome1 & !hasMutOnChromosome2) - child.genome2.addMutations(mut); + child.haplosomesFromParent2.addMutations(mut); else if (hasMutOnChromosome2 & !hasMutOnChromosome1) - child.genome1.addMutations(mut); + child.haplosomesFromParent1.addMutations(mut); } return T; } diff --git a/SLiMgui/Recipes/Recipe 13.1 - Polygenic selection.txt b/SLiMgui/Recipes/Recipe 13.1 - Polygenic selection.txt index e1b55e7a3..0af39c7fd 100644 --- a/SLiMgui/Recipes/Recipe 13.1 - Polygenic selection.txt +++ b/SLiMgui/Recipes/Recipe 13.1 - Polygenic selection.txt @@ -15,7 +15,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } fitnessEffect() { - phenotype = sum(individual.genomes.countOfMutationsOfType(m2)); + phenotype = sum(individual.haplosomes.countOfMutationsOfType(m2)); return 1.5 - (phenotype - 10.0)^2 * 0.005; } 5000 late() { diff --git a/SLiMgui/Recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt b/SLiMgui/Recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt index 396bbc8f8..5360e7d4d 100644 --- a/SLiMgui/Recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt +++ b/SLiMgui/Recipes/Recipe 13.3 - A model of discrete QTL effects with a structured chromosome.txt @@ -52,7 +52,7 @@ initialize() { community.registerEarlyEvent("s2", s1.source, 2, 2); // optional: give m2 mutations to everyone, as standing variation - g = sim.subpopulations.genomes; + g = sim.subpopulations.haplosomes; for (q in Q) { diff --git a/SLiMgui/Recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt b/SLiMgui/Recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt index 091d92edd..a34cce59b 100644 --- a/SLiMgui/Recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt +++ b/SLiMgui/Recipes/Recipe 13.5 - A QTL-based model with two quantitative phenotypic traits and pleiotropy.txt @@ -71,7 +71,7 @@ late() { for (ind in sim.subpopulations.individuals) { // construct phenotypes from additive effects of QTL mutations - muts = ind.genomes.mutationsOfType(m2); + muts = ind.haplosomes.mutationsOfType(m2); phenotype0 = size(muts) ? sum(muts.getValue("e0")) else 0.0; phenotype1 = size(muts) ? sum(muts.getValue("e1")) else 0.0; ind.setValue("phenotype0", phenotype0); diff --git a/SLiMgui/Recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt b/SLiMgui/Recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt index 1db7945df..ac3d744e7 100644 --- a/SLiMgui/Recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt +++ b/SLiMgui/Recipes/Recipe 14.1 - Relatedness, inbreeding, and heterozygosity.txt @@ -17,6 +17,6 @@ mateChoice() { } 1000 late() { // Print mean heterozygosity across the population - heterozygosity = calcHeterozygosity(p1.genomes); + heterozygosity = calcHeterozygosity(p1.haplosomes); cat("Mean heterozygosity = " + heterozygosity + "\n"); } diff --git a/SLiMgui/Recipes/Recipe 14.11 - Modeling microsatellites.txt b/SLiMgui/Recipes/Recipe 14.11 - Modeling microsatellites.txt index 540782324..099dc3dab 100644 --- a/SLiMgui/Recipes/Recipe 14.11 - Modeling microsatellites.txt +++ b/SLiMgui/Recipes/Recipe 14.11 - Modeling microsatellites.txt @@ -21,14 +21,14 @@ initialize() { sim.addSubpop("p1", 500); // create some microsatellites at random positions - genomes = sim.subpopulations.genomes; + haplosomes = sim.subpopulations.haplosomes; positions = rdunif(msatCount, 0, L-1); repeats = rpois(msatCount, 20) + 5; for (msatIndex in 0:(msatCount-1)) { pos = positions[msatIndex]; - mut = genomes.addNewDrawnMutation(m2, pos); + mut = haplosomes.addNewDrawnMutation(m2, pos); mut.tag = repeats[msatIndex]; } @@ -37,14 +37,14 @@ initialize() { } modifyChild() { // mutate microsatellites with rate msatMu - for (genome in child.genomes) + for (haplosome in child.haplosomes) { mutCount = rpois(1, msatMu * msatCount); if (mutCount) { mutSites = sample(msatPositions, mutCount); - msats = genome.mutationsOfType(m2); + msats = haplosome.mutationsOfType(m2); for (mutSite in mutSites) { @@ -66,15 +66,15 @@ modifyChild() { if (matchingMut.size() == 1) { - genome.removeMutations(msat); - genome.addMutations(matchingMut); + haplosome.removeMutations(msat); + haplosome.addMutations(matchingMut); next; } } // make a new mutation with the new repeat count - genome.removeMutations(msat); - msat = genome.addNewDrawnMutation(m2, mutSite); + haplosome.removeMutations(msat); + msat = haplosome.addNewDrawnMutation(m2, mutSite); msat.tag = repeats; } } diff --git a/SLiMgui/Recipes/Recipe 14.12 - Modeling transposable elements.txt b/SLiMgui/Recipes/Recipe 14.12 - Modeling transposable elements.txt index f74d7c32f..1f7ceb770 100644 --- a/SLiMgui/Recipes/Recipe 14.12 - Modeling transposable elements.txt +++ b/SLiMgui/Recipes/Recipe 14.12 - Modeling transposable elements.txt @@ -28,22 +28,22 @@ initialize() { sim.tag = 0; // the next unique tag value to use for TEs // create some transposons at random positions - genomes = sim.subpopulations.genomes; + haplosomes = sim.subpopulations.haplosomes; positions = rdunif(teInitialCount, 0, L-1); for (teIndex in 0:(teInitialCount-1)) { pos = positions[teIndex]; - mut = genomes.addNewDrawnMutation(m2, pos); + mut = haplosomes.addNewDrawnMutation(m2, pos); mut.tag = sim.tag; sim.tag = sim.tag + 1; } } modifyChild() { // disable transposons with rate teDisableP - for (genome in child.genomes) + for (haplosome in child.haplosomes) { - tes = genome.mutationsOfType(m2); + tes = haplosome.mutationsOfType(m2); teCount = tes.size(); mutatedCount = teCount ? rpois(1, teCount * teDisableP) else 0; @@ -59,14 +59,14 @@ modifyChild() { if (size(disabledTE)) { // use the existing disabled TE mutation - genome.removeMutations(te); - genome.addMutations(disabledTE); + haplosome.removeMutations(te); + haplosome.addMutations(disabledTE); next; } // make a new disabled TE mutation with the right tag - genome.removeMutations(te); - disabledTE = genome.addNewDrawnMutation(m3, te.position); + haplosome.removeMutations(te); + disabledTE = haplosome.addNewDrawnMutation(m3, te.position); disabledTE.tag = te.tag; } } @@ -78,9 +78,9 @@ late() { // make active transposons copy themselves with rate teJumpP for (individual in sim.subpopulations.individuals) { - for (genome in individual.genomes) + for (haplosome in individual.haplosomes) { - tes = genome.mutationsOfType(m2); + tes = haplosome.mutationsOfType(m2); teCount = tes.size(); jumpCount = teCount ? rpois(1, teCount * teJumpP) else 0; @@ -92,7 +92,7 @@ late() { { // make a new TE mutation pos = rdunif(1, 0, L-1); - jumpTE = genome.addNewDrawnMutation(m2, pos); + jumpTE = haplosome.addNewDrawnMutation(m2, pos); jumpTE.tag = sim.tag; sim.tag = sim.tag + 1; } @@ -104,7 +104,7 @@ late() { // print information on each TE, including the fraction of it disabled all_tes = sortBy(sim.mutationsOfType(m2), "position"); all_disabledTEs = sortBy(sim.mutationsOfType(m3), "position"); - genomeCount = size(sim.subpopulations.genomes); + haplosomeCount = size(sim.subpopulations.haplosomes); catn("Active TEs:"); for (te in all_tes) @@ -126,7 +126,7 @@ late() { total = active + disabled; - cat("frequency " + format("%0.3f", total / genomeCount) + ", "); + cat("frequency " + format("%0.3f", total / haplosomeCount) + ", "); catn(round(active / total * 100) + "% active"); } diff --git a/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt b/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt index f4e2981d2..5815360a9 100644 --- a/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt +++ b/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback I.txt @@ -24,7 +24,7 @@ initialize() { sim.addSubpop("p1", 100); // create the canonical mutation objects - target = p1.genomes[0]; + target = p1.haplosomes[0]; target.addNewDrawnMutation(m2, 0:99); defineConstant("MUT2", target.mutations); target.removeMutations(); @@ -33,7 +33,7 @@ initialize() { target.removeMutations(); // start homozygous "aa" at every position - p1.genomes.addMutations(MUT3); + p1.haplosomes.addMutations(MUT3); // log results log = community.createLogFile("freq.csv", logInterval=10); diff --git a/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt b/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt index 0eaff07e7..51e63457e 100644 --- a/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt +++ b/SLiMgui/Recipes/Recipe 14.15 - Modeling biallelic loci with a mutation() callback II.txt @@ -22,7 +22,7 @@ initialize() { sim.addSubpop("p1", 100); // create the permanent m2 mutation objects we will use - target = p1.genomes[0]; + target = p1.haplosomes[0]; target.addNewDrawnMutation(m2, 0:99); defineConstant("MUT", target.mutations); @@ -37,7 +37,7 @@ initialize() { mutation(m3) { // if we already have an m2 mutation at the site, allow // the new m3 mutation; we will remove the stack below - if (genome.containsMarkerMutation(m2, mut.position)) + if (haplosome.containsMarkerMutation(m2, mut.position)) return T; // no m2 mutation is present, so unique down @@ -51,18 +51,18 @@ late() { // if so, we have m2/m3 stacked mutations to remove if (m3muts.length() > 0) { - genomes = sim.subpopulations.genomes; - counts = genomes.countOfMutationsOfType(m3); - hasStacked = genomes[counts > 0]; + haplosomes = sim.subpopulations.haplosomes; + counts = haplosomes.countOfMutationsOfType(m3); + hasStacked = haplosomes[counts > 0]; - for (genome in hasStacked) + for (haplosome in hasStacked) { - stacked_m3 = genome.mutationsOfType(m3); + stacked_m3 = haplosome.mutationsOfType(m3); stackPositions = stacked_m3.position; - all_m2 = genome.mutationsOfType(m2); + all_m2 = haplosome.mutationsOfType(m2); s = (match(all_m2.position, stackPositions) >= 0); stacked_m2 = all_m2[s]; - genome.removeMutations(c(stacked_m3, stacked_m2)); + haplosome.removeMutations(c(stacked_m3, stacked_m2)); } } } diff --git a/SLiMgui/Recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt b/SLiMgui/Recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt index ce7b702fe..d1852a5d5 100644 --- a/SLiMgui/Recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt +++ b/SLiMgui/Recipes/Recipe 14.3 - Reading initial simulation state from an MS output file II.txt @@ -38,15 +38,15 @@ initialize() { if (parts[0] != "positions:") stop("Missing positions."); positions = asFloat(parts[1:(size(parts)-1)]); - // create all mutations in a genome in a dummy subpopulation + // create all mutations in a haplosome in a dummy subpopulation sim.addSubpop("p2", 1); - g = p2.genomes[0]; - L = sim.chromosome.lastPosition; + g = p2.haplosomes[0]; + L = sim.chromosomes.lastPosition; intPositions = asInteger(round(positions * L)); muts = g.addNewMutation(m1, 0.0, intPositions); - // add the appropriate mutations to each genome - for (g in p1.genomes) + // add the appropriate mutations to each haplosome + for (g in p1.haplosomes) { f = asLogical(asInteger(strsplit(lines[index], ""))); index = index + 1; diff --git a/SLiMgui/Recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt b/SLiMgui/Recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt index 91ec540e2..a63474a02 100644 --- a/SLiMgui/Recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt +++ b/SLiMgui/Recipes/Recipe 14.4 - Modeling chromosomal inversions with a recombination() callback.txt @@ -21,8 +21,8 @@ initialize() { 1 late() { sim.addSubpop("p1", N); - // give some genomes an inversion - inverted = sample(p1.genomes, 100); + // give some haplosomes an inversion + inverted = sample(p1.haplosomes, 100); inverted.addNewDrawnMutation(m2, INV_START); inverted.addNewDrawnMutation(m3, INV_END); } @@ -41,8 +41,8 @@ mutationEffect(m2) { } recombination() { - gm1 = genome1.containsMarkerMutation(m2, INV_START); - gm2 = genome2.containsMarkerMutation(m2, INV_START); + gm1 = haplosome1.containsMarkerMutation(m2, INV_START); + gm2 = haplosome2.containsMarkerMutation(m2, INV_START); if (!(gm1 | gm2)) { // homozygote non-inverted return F; @@ -61,7 +61,7 @@ recombination() { } else { // heterozygote inverted: resample to get an even number of breakpoints // this is *recursive*: it calls this recombination callback again! - breakpoints = sim.chromosome.drawBreakpoints(individual); + breakpoints = sim.chromosomes.drawBreakpoints(individual); } return T; } diff --git a/SLiMgui/Recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt b/SLiMgui/Recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt index f115ac350..f7cd2ade8 100644 --- a/SLiMgui/Recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt +++ b/SLiMgui/Recipes/Recipe 14.5 - Modeling both X and Y Chromosomes with a Pseudo-Autosomal Region (PAR).txt @@ -25,15 +25,15 @@ initialize() // initialize the pop, with a Y marker for each male sim.addSubpop("p1", 1000); i = p1.individuals; - i[i.sex == "M"].genome2.addNewMutation(m3, 0.0, 5999999); + i[i.sex == "M"].haplosomesFromParent2.addNewMutation(m3, 0.0, 5999999); } modifyChild() { // females should not have a Y, males should have a Y if (child.sex == "F") - return !child.genome2.containsMarkerMutation(m3, 5999999); + return !child.haplosomesFromParent2.containsMarkerMutation(m3, 5999999); else - return child.genome2.containsMarkerMutation(m3, 5999999); + return child.haplosomesFromParent2.containsMarkerMutation(m3, 5999999); } 1:10000 late() { @@ -46,7 +46,7 @@ modifyChild() { // look at the mutations in a single Y chromosome // to find mutations that are fixed in all Y's firstMale = p1.individuals[p1.individuals.sex == "M"][0]; - fMG = firstMale.genomes; + fMG = firstMale.haplosomes; if (fMG[0].containsMarkerMutation(m3, 5999999)) { firstY = fMG[0]; @@ -70,7 +70,7 @@ modifyChild() { cat(removeX.size() + "/" + removeY.size() + " on X/Y\n"); removes = c(removeY, removeX); - sim.subpopulations.genomes.removeMutations(removes, T); + sim.subpopulations.haplosomes.removeMutations(removes, T); } } diff --git a/SLiMgui/Recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt b/SLiMgui/Recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt index f7117ae64..169595234 100644 --- a/SLiMgui/Recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt +++ b/SLiMgui/Recipes/Recipe 14.7 - Tracking local ancestry along the chromosome.txt @@ -30,11 +30,11 @@ initialize() { muttype in c(m1,m2,m3), symbol in c("M1","M2","M3")) { - genomes = subpop.genomes; - muts = genomes.addNewDrawnMutation(muttype, positions); + haplosomes = subpop.haplosomes; + muts = haplosomes.addNewDrawnMutation(muttype, positions); defineConstant(symbol, muts); - mut = genomes.addNewDrawnMutation(m4, integerDiv(Z, 2)); + mut = haplosomes.addNewDrawnMutation(m4, integerDiv(Z, 2)); catn("Beneficial mutation: s == " + mut.selectionCoeff); } diff --git a/SLiMgui/Recipes/Recipe 14.9 - Modeling haploid organisms.txt b/SLiMgui/Recipes/Recipe 14.9 - Modeling haploid organisms.txt index a29f44e5c..faff72216 100644 --- a/SLiMgui/Recipes/Recipe 14.9 - Modeling haploid organisms.txt +++ b/SLiMgui/Recipes/Recipe 14.9 - Modeling haploid organisms.txt @@ -12,14 +12,14 @@ initialize() { p1.setCloningRate(1.0); } late() { - // remove any new mutations added to the disabled diploid genomes - sim.subpopulations.individuals.genome2.removeMutations(); + // remove any new mutations added to the disabled diploid haplosomes + sim.subpopulations.individuals.haplosomesFromParent2.removeMutations(); - // remove mutations in the haploid genomes that have fixed + // remove mutations in the haploid haplosomes that have fixed muts = sim.mutationsOfType(m1); freqs = sim.mutationFrequencies(NULL, muts); if (any(freqs == 0.5)) - sim.subpopulations.genomes.removeMutations(muts[freqs == 0.5], T); + sim.subpopulations.haplosomes.removeMutations(muts[freqs == 0.5], T); } 200000 late() { sim.outputFixedMutations(); diff --git a/SLiMgui/Recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt b/SLiMgui/Recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt index 488f598b4..3568a6cb2 100644 --- a/SLiMgui/Recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt +++ b/SLiMgui/Recipes/Recipe 15.11 - Modeling clonal haploids in a nonWF model with addRecombinant().txt @@ -11,7 +11,7 @@ initialize() { initializeRecombinationRate(1e-8); } reproduction() { - subpop.addRecombinant(individual.genome1, NULL, NULL, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, NULL, NULL, NULL); } 1 early() { sim.addSubpop("p1", 500, haploid=T); diff --git a/SLiMgui/Recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt b/SLiMgui/Recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt index 00df94d7d..9f2c6c859 100644 --- a/SLiMgui/Recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt +++ b/SLiMgui/Recipes/Recipe 15.12 - Modeling clonal haploid bacteria with horizontal gene transfer.txt @@ -16,7 +16,7 @@ reproduction() { if (runif(1) < H) { // horizontal gene transfer from a randomly chosen individual - HGTsource = p1.sampleIndividuals(1, exclude=individual).genome1; + HGTsource = p1.sampleIndividuals(1, exclude=individual).haplosomesFromParent1; // draw two distinct locations; redraw if we get a duplicate do breaks = rdunif(2, max=L-1); @@ -26,12 +26,12 @@ reproduction() { if (breaks[0] > breaks[1]) breaks = c(0, breaks[1], breaks[0]); - subpop.addRecombinant(individual.genome1, HGTsource, breaks, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, HGTsource, breaks, NULL, NULL, NULL); } else { // no horizontal gene transfer; clonal replication - subpop.addRecombinant(individual.genome1, NULL, NULL, NULL, NULL, NULL); + subpop.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, NULL, NULL, NULL); } } 1 early() { @@ -39,7 +39,7 @@ reproduction() { sim.addSubpop("p1", 2, haploid=T); // add beneficial mutations to each bacterium, but at different loci - g = p1.individuals.genome1; + g = p1.individuals.haplosomesFromParent1; g[0].addNewDrawnMutation(m2, asInteger(L * 0.25)); g[1].addNewDrawnMutation(m2, asInteger(L * 0.75)); } diff --git a/SLiMgui/Recipes/Recipe 15.14 - Alternation of generations.txt b/SLiMgui/Recipes/Recipe 15.14 - Alternation of generations.txt index 1b677fb11..9f28ad51b 100644 --- a/SLiMgui/Recipes/Recipe 15.14 - Alternation of generations.txt +++ b/SLiMgui/Recipes/Recipe 15.14 - Alternation of generations.txt @@ -23,24 +23,24 @@ initialize() } reproduction(p1) { - g_1 = individual.genome1; - g_2 = individual.genome2; + g_1 = individual.haplosomesFromParent1; + g_2 = individual.haplosomesFromParent2; for (meiosisCount in 1:5) { if (individual.sex == "M") { - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); s_1 = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "M"); s_2 = p2.addRecombinant(g_2, g_1, breaks, NULL, NULL, NULL, "M"); - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); s_3 = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "M"); s_4 = p2.addRecombinant(g_2, g_1, breaks, NULL, NULL, NULL, "M"); } else if (individual.sex == "F") { - breaks = sim.chromosome.drawBreakpoints(individual); + breaks = sim.chromosomes.drawBreakpoints(individual); e = p2.addRecombinant(g_1, g_2, breaks, NULL, NULL, NULL, "F", randomizeStrands=T); } @@ -51,8 +51,8 @@ reproduction(p2, "F") mate = p2.sampleIndividuals(1, sex="M", tagL0=F); mate.tagL0 = T; - child = p1.addRecombinant(individual.genome1, NULL, NULL, - mate.genome1, NULL, NULL); + child = p1.addRecombinant(individual.haplosomesFromParent1, NULL, NULL, + mate.haplosomesFromParent1, NULL, NULL); } early() { @@ -60,13 +60,13 @@ early() { p1.fitnessScaling = 0.0; p2.individuals.tagL0 = F; - sim.chromosome.setMutationRate(0.0); + sim.chromosomes.setMutationRate(0.0); } else { p2.fitnessScaling = 0.0; p1.fitnessScaling = K / p1.individualCount; - sim.chromosome.setMutationRate(MU); + sim.chromosomes.setMutationRate(MU); } } 10000 late() diff --git a/SLiMgui/Recipes/Recipe 15.15 - Meiotic drive.txt b/SLiMgui/Recipes/Recipe 15.15 - Meiotic drive.txt index 0b133755c..90b28c351 100644 --- a/SLiMgui/Recipes/Recipe 15.15 - Meiotic drive.txt +++ b/SLiMgui/Recipes/Recipe 15.15 - Meiotic drive.txt @@ -1,11 +1,11 @@ // Keywords: nonWF, non-Wright-Fisher, meiotic drive, segregation distortion, intragenomic conflict -function (i)driveBreakpoints(o$ gen1, o$ gen2) +function (i)driveBreakpoints(o$ gen1, o$ gen2) { // start with default breakpoints generated by the chromosome - breaks = sim.chromosome.drawBreakpoints(); + breaks = sim.chromosomes.drawBreakpoints(); - // if both genomes have the drive, or neither, then just return + // if both haplosomes have the drive, or neither, then just return gen1has = gen1.containsMarkerMutation(m2, D_pos); gen2has = gen2.containsMarkerMutation(m2, D_pos); if (gen1has == gen2has) @@ -42,9 +42,9 @@ initialize() { } reproduction() { m = subpop.sampleIndividuals(1); - b1 = driveBreakpoints(individual.genome1, individual.genome2); - b2 = driveBreakpoints(m.genome1, m.genome2); - subpop.addRecombinant(individual.genome1, individual.genome2, b1, m.genome1, m.genome2, b2); + b1 = driveBreakpoints(individual.haplosomesFromParent1, individual.haplosomesFromParent2); + b2 = driveBreakpoints(m.haplosomesFromParent1, m.haplosomesFromParent2); + subpop.addRecombinant(individual.haplosomesFromParent1, individual.haplosomesFromParent2, b1, m.haplosomesFromParent1, m.haplosomesFromParent2, b2); } 1 early() { sim.addSubpop("p1", 10); @@ -53,7 +53,7 @@ early() { p1.fitnessScaling = K / p1.individualCount; } 100 early() { - target = sample(p1.genomes, 10); + target = sample(p1.haplosomes, 10); target.addNewDrawnMutation(m2, D_pos); } 100:1000 late() { diff --git a/SLiMgui/Recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt b/SLiMgui/Recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt index 10a784b85..194a9c859 100644 --- a/SLiMgui/Recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt +++ b/SLiMgui/Recipes/Recipe 15.21 - Modeling haplodiploidy with addRecombinant().txt @@ -14,26 +14,26 @@ initialize() { initializeSex("A"); } reproduction(NULL, "F") { - gen1 = individual.genome1; - gen2 = individual.genome2; - breaks = sim.chromosome.drawBreakpoints(individual); + gen1 = individual.haplosomesFromParent1; + gen2 = individual.haplosomesFromParent2; + breaks = sim.chromosomes.drawBreakpoints(individual); // decide whether we're generating a haploid male or a diploid female if (rbinom(1, 1, P_OFFSPRING_MALE)) { // didn't find a mate; make a haploid male from an unfertilized egg: - // - one genome comes from recombination of the female's genomes - // - the other genome is a null genome (a placeholder) + // - one haplosome comes from recombination of the female's haplosomes + // - the other haplosome is a null haplosome (a placeholder) subpop.addRecombinant(gen1, gen2, breaks, NULL, NULL, NULL, "M", randomizeStrands=T); } else { // found a mate; make a diploid female from a fertilized egg: - // - one genome comes from recombination of the female's genomes - // - the other genome comes from the mate (a haploid male) + // - one haplosome comes from recombination of the female's haplosomes + // - the other haplosome comes from the mate (a haploid male) mate = subpop.sampleIndividuals(1, sex="M"); - subpop.addRecombinant(gen1, gen2, breaks, mate.genome1, NULL, NULL, "F", + subpop.addRecombinant(gen1, gen2, breaks, mate.haplosomesFromParent1, NULL, NULL, "F", randomizeStrands=T); } } diff --git a/SLiMgui/Recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt b/SLiMgui/Recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt index 35bf5f83e..c9ba9f74d 100644 --- a/SLiMgui/Recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt +++ b/SLiMgui/Recipes/Recipe 15.4 - Beneficial mutations and absolute fitness.txt @@ -21,7 +21,7 @@ reproduction() { sim.addSubpop("p1", 10); } 100 early() { - mutant = sample(p1.individuals.genomes, 10); + mutant = sample(p1.individuals.haplosomes, 10); mutant.addNewDrawnMutation(m2, 10000); } early() { diff --git a/SLiMgui/Recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt b/SLiMgui/Recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt index 2a3208754..8b55068a1 100644 --- a/SLiMgui/Recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt +++ b/SLiMgui/Recipes/Recipe 17.10 - Adding a neutral burn-in after simulation with recapitation I.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 1e5); } 100 late() { - sample(p1.genomes, 1).addNewDrawnMutation(m2, 5e5); + sample(p1.haplosomes, 1).addNewDrawnMutation(m2, 5e5); } 100:10000 late() { mut = sim.mutationsOfType(m2); diff --git a/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt b/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt index d274adcaa..dd06e056d 100644 --- a/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt +++ b/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry I.txt @@ -14,7 +14,7 @@ initialize() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m3, 10000); defineConstant("PATH", tempdir() + "slim_" + simID + ".trees"); sim.outputFull(PATH); diff --git a/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt b/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt index a5107673f..2813e6f93 100644 --- a/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt +++ b/SLiMgui/Recipes/Recipe 17.3 - Simulation conditional upon fixation of a sweep, preserving ancestry II.txt @@ -23,7 +23,7 @@ initialize() { // record tag values and pedigree IDs in metadata metadataDict = Dictionary("tags", tags, "ids", inds.pedigreeID); - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m3, 10000); defineConstant("PATH", tempdir() + "slim_" + simID + ".trees"); sim.treeSeqOutput(PATH, metadata=metadataDict); diff --git a/SLiMgui/Recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt b/SLiMgui/Recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt index b78423641..94ba44755 100644 --- a/SLiMgui/Recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt +++ b/SLiMgui/Recipes/Recipe 17.5 - Mapping admixture (analyzing ancestry in Python) I.txt @@ -14,8 +14,8 @@ initialize() { sim.addSubpop("p2", 500); sim.treeSeqRememberIndividuals(sim.subpopulations.individuals); - p1.genomes.addNewDrawnMutation(m1, asInteger(L * 0.2)); - p2.genomes.addNewDrawnMutation(m1, asInteger(L * 0.8)); + p1.haplosomes.addNewDrawnMutation(m1, asInteger(L * 0.2)); + p2.haplosomes.addNewDrawnMutation(m1, asInteger(L * 0.8)); sim.addSubpop("p3", 1000); p3.setMigrationRates(c(p1, p2), c(0.5, 0.5)); diff --git a/SLiMgui/Recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt b/SLiMgui/Recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt index d35988776..9e3533fde 100644 --- a/SLiMgui/Recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt +++ b/SLiMgui/Recipes/Recipe 17.8 - Starting a hermaphroditic WF model with a coalescent history II.txt @@ -14,7 +14,7 @@ initialize() { } 1 late() { sim.readFromPopulationFile("coalasex.trees"); - target = sample(sim.subpopulations.genomes, 1); + target = sample(sim.subpopulations.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1: late() { diff --git a/SLiMgui/Recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt b/SLiMgui/Recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt index 4c60bf89e..97d34d8c5 100644 --- a/SLiMgui/Recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt +++ b/SLiMgui/Recipes/Recipe 18.11 - Modeling GC-biased gene conversion (gBGC).txt @@ -18,6 +18,6 @@ initialize() { 1:500001 early() { if (sim.cycle % 1000 == 1) { cat(sim.cycle + ": "); - print(nucleotideFrequencies(sim.chromosome.ancestralNucleotides())); + print(nucleotideFrequencies(sim.chromosomes.ancestralNucleotides())); } } diff --git a/SLiMgui/Recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt b/SLiMgui/Recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt index 7b9547f9c..4ae6ee7d6 100644 --- a/SLiMgui/Recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt +++ b/SLiMgui/Recipes/Recipe 18.12 - Reading VCF files to create nucleotide-based SNPs.txt @@ -14,7 +14,7 @@ initialize() { } 1 late() { sim.addSubpop("p1", 99); - p1.genomes.readFromVCF("chr22_filtered.recode.vcf", m1); + p1.haplosomes.readFromVCF("chr22_filtered.recode.vcf", m1); p1.setSubpopulationSize(1000); } 5 late() { diff --git a/SLiMgui/Recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt b/SLiMgui/Recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt index 5591e40f6..ea2f7c1b0 100644 --- a/SLiMgui/Recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt +++ b/SLiMgui/Recipes/Recipe 18.15 - Modeling identity by state (IBS) (uniquing back-mutations to the ancestral state).txt @@ -25,18 +25,18 @@ late() { for (mut in new_muts) { pos = mut.position; - if (mut.nucleotide == sim.chromosome.ancestralNucleotides(pos, pos)) + if (mut.nucleotide == sim.chromosomes.ancestralNucleotides(pos, pos)) back_muts = c(back_muts, mut); } if (size(back_muts)) - sim.subpopulations.genomes.removeMutations(back_muts); + sim.subpopulations.haplosomes.removeMutations(back_muts); } 1000 late() { for (pos in 0:99) { muts = sim.subsetMutations(position=pos); nucs = muts.nucleotide; - ancestral = sim.chromosome.ancestralNucleotides(pos, pos); + ancestral = sim.chromosomes.ancestralNucleotides(pos, pos); cat(pos + " : " + paste(nucs)); if (size(nucs) != size(unique(nucs))) cat(" DUPLICATES!"); diff --git a/SLiMgui/Recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt b/SLiMgui/Recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt index 2efc9654d..5a31b6ce6 100644 --- a/SLiMgui/Recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt +++ b/SLiMgui/Recipes/Recipe 18.3 - Sequence output from nucleotide-based models.txt @@ -10,7 +10,7 @@ initialize() { initializeRecombinationRate(1e-8); } 1 early() { - c = sim.chromosome; + c = sim.chromosomes; catn("Ancestral: " + c.ancestralNucleotides()); catn("Ancestral: " + paste(c.ancestralNucleotides(format="char"))); catn("Ancestral: " + paste(c.ancestralNucleotides(format="integer"))); @@ -25,14 +25,14 @@ initialize() { catn("positions: " + paste(sim.substitutions.position)); catn(); - c = sim.chromosome; + c = sim.chromosomes; catn("Ancestral: " + c.ancestralNucleotides()); catn("Ancestral: " + paste(c.ancestralNucleotides(format="char"))); catn("Ancestral: " + paste(c.ancestralNucleotides(format="integer"))); catn("positions: " + paste(0:(L-1))); catn(); - g = p1.genomes[0]; + g = p1.haplosomes[0]; catn("SNPs: " + paste(g.mutations.nucleotide)); catn("SNPs: " + paste(g.mutations.nucleotideValue)); diff --git a/SLiMgui/Recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt b/SLiMgui/Recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt index 67b7aef5e..c10085da0 100644 --- a/SLiMgui/Recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt +++ b/SLiMgui/Recipes/Recipe 18.4 - Back-mutations, independent mutational lineages, and VCF output.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 500); } 5000 late() { - g = p1.sampleIndividuals(5).genomes; + g = p1.sampleIndividuals(5).haplosomes; g.outputVCF(simplifyNucleotides=F); g.outputVCF(simplifyNucleotides=T); } diff --git a/SLiMgui/Recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt b/SLiMgui/Recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt index c9c84d0a1..ad59d357c 100644 --- a/SLiMgui/Recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt +++ b/SLiMgui/Recipes/Recipe 18.5 - Modeling elevated CpG mutation rates and equilibrium nucleotide frequencies.txt @@ -26,6 +26,6 @@ initialize() { 1:10000000 early() { if (sim.cycle % 10000 == 1) { cat(sim.cycle + ": "); - print(nucleotideFrequencies(sim.chromosome.ancestralNucleotides())); + print(nucleotideFrequencies(sim.chromosomes.ancestralNucleotides())); } } diff --git a/SLiMgui/Recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt b/SLiMgui/Recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt index 5891977d6..79a80ef33 100644 --- a/SLiMgui/Recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt +++ b/SLiMgui/Recipes/Recipe 18.6 - A nucleotide-based model with introduced non-nucleotide-based mutations.txt @@ -15,7 +15,7 @@ initialize() { } 1 late() { sim.addSubpop("p1", 500); - sample(p1.genomes, 10).addNewDrawnMutation(m2, 20000); + sample(p1.haplosomes, 10).addNewDrawnMutation(m2, 20000); } 2000 late() { print(sim.mutationsOfType(m2)); diff --git a/SLiMgui/Recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt b/SLiMgui/Recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt index 8d0435bdf..63f5c3178 100644 --- a/SLiMgui/Recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt +++ b/SLiMgui/Recipes/Recipe 18.8 - Defining sequence-based fitness effects at the nucleotide level.txt @@ -21,8 +21,8 @@ late() { s1.active = 0; } s1 fitnessEffect() { - nuc1 = individual.genome1.nucleotides(100, 100, format="integer"); - nuc2 = individual.genome2.nucleotides(100, 100, format="integer"); + nuc1 = individual.haplosomesFromParent1.nucleotides(100, 100, format="integer"); + nuc2 = individual.haplosomesFromParent2.nucleotides(100, 100, format="integer"); return EFF[nuc1] * EFF[nuc2]; } 10000 late() { diff --git a/SLiMgui/Recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt b/SLiMgui/Recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt index e158f8641..a2446caa5 100644 --- a/SLiMgui/Recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt +++ b/SLiMgui/Recipes/Recipe 18.9 - Defining sequence-based fitness effects at the amino acid level.txt @@ -28,7 +28,7 @@ initialize() { sim.addSubpop("p1", 500); } fitnessEffect() { - for (g in individual.genomes) + for (g in individual.haplosomes) { seq = g.nucleotides(253, 670) + g.nucleotides(871, 1034); codons = nucleotidesToCodons(seq); @@ -41,8 +41,8 @@ fitnessEffect() { 100000 late() { catn(sim.substitutions.size() + " fixed mutations."); - as1 = sim.chromosome.ancestralNucleotides(253, 670, "integer"); - as2 = sim.chromosome.ancestralNucleotides(871, 1034, "integer"); + as1 = sim.chromosomes.ancestralNucleotides(253, 670, "integer"); + as2 = sim.chromosomes.ancestralNucleotides(871, 1034, "integer"); as = c(as1, as2); codons = nucleotidesToCodons(as); catn("Final AA sequence: " + codonsToAminoAcids(codons)); diff --git a/SLiMgui/Recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt b/SLiMgui/Recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt index 3f77b3f7c..45861183f 100644 --- a/SLiMgui/Recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt +++ b/SLiMgui/Recipes/Recipe 19.7 - A coevolutionary host-parasite matching-allele model.txt @@ -27,7 +27,7 @@ species parasite initialize() { } function (float$)nucleotideFreq(o$ species, s$ nuc) { - nucs = species.subpopulations.individuals.genomes.nucleotides(); + nucs = species.subpopulations.individuals.haplosomes.nucleotides(); return mean(nucs == nuc); } @@ -55,7 +55,7 @@ ticks all late() { for (p in parasites, h in chosen_hosts) { // infection depends upon a match (diploid matching-allele model) - all_nucleotides = c(p.genomes.nucleotides(), h.genomes.nucleotides()); + all_nucleotides = c(p.haplosomes.nucleotides(), h.haplosomes.nucleotides()); if (size(unique(all_nucleotides, preserveOrder=F)) == 1) { diff --git a/SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt b/SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt similarity index 93% rename from SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt rename to SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt index 0a54862db..72f1edbb7 100644 --- a/SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than genomes.txt +++ b/SLiMgui/Recipes/Recipe 4.2.3 - Basic output, Sampling individuals rather than haplosomes.txt @@ -18,5 +18,5 @@ initialize() { allIndividuals = sim.subpopulations.individuals; w = asFloat(allIndividuals.countOfMutationsOfType(m2) + 1); sampledIndividuals = sample(allIndividuals, 10, weights=w); - sampledIndividuals.genomes.output(); + sampledIndividuals.haplosomes.output(); } diff --git a/SLiMgui/Recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt b/SLiMgui/Recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt index b68038630..9da5273c7 100644 --- a/SLiMgui/Recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt +++ b/SLiMgui/Recipes/Recipe 4.2.5 - Basic output, Automatic logging with LogFile.txt @@ -14,6 +14,6 @@ initialize() { p2.setMigrationRates(p1, 0.001); log = community.createLogFile("sim_log.txt", logInterval=10); log.addCycle(); - log.addCustomColumn("FST", "calcFST(p1.genomes, p2.genomes);"); + log.addCustomColumn("FST", "calcFST(p1.haplosomes, p2.haplosomes);"); } 20000 late() { } diff --git a/SLiMgui/Recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt b/SLiMgui/Recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt index 2cb99a3fd..bb9e6afcf 100644 --- a/SLiMgui/Recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt +++ b/SLiMgui/Recipes/Recipe 4.2.6 - Basic output, Custom output with Eidos.txt @@ -14,8 +14,8 @@ initialize() { // custom MS-style output from a multi-subpop sample 2000 late() { - // obtain a random sample of genomes from the whole population - g = sample(sim.subpopulations.genomes, 10, T); + // obtain a random sample of haplosomes from the whole population + h = sample(sim.subpopulations.haplosomes, 10, T); // get the unique mutations in the sample, sorted by position m = sortBy(unique(g.mutations), "position"); @@ -24,13 +24,13 @@ initialize() { cat("\n\nsegsites: " + size(m) + "\n"); // print the positions - positions = format("%.6f", m.position / sim.chromosome.lastPosition); + positions = format("%.6f", m.position / sim.chromosomes.lastPosition); cat("positions: " + paste(positions, sep=" ") + "\n"); - // print the sampled genomes - for (genome in g) + // print the sampled haplosomes + for (haplosome in h) { - hasMuts = (match(m, genome.mutations) >= 0); + hasMuts = (match(m, haplosome.mutations) >= 0); cat(paste(asInteger(hasMuts), sep="") + "\n"); } } diff --git a/SLiMgui/Recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt b/SLiMgui/Recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt index 23913ec76..6c01133a2 100644 --- a/SLiMgui/Recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt +++ b/SLiMgui/Recipes/Recipe 5.3.4 - Migration and admixture, A random, sparse spatial metapopulation.txt @@ -39,6 +39,6 @@ initialize() { // introduce a beneficial mutation target_subpop = sample(sim.subpopulations, 1); - sample(target_subpop.genomes, 10).addNewDrawnMutation(m2, 20000); + sample(target_subpop.haplosomes, 10).addNewDrawnMutation(m2, 20000); } 10000 late() { sim.outputFixedMutations(); } diff --git a/SLiMgui/Recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt b/SLiMgui/Recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt index 44a2b547e..19f222911 100644 --- a/SLiMgui/Recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt +++ b/SLiMgui/Recipes/Recipe 7.4 - Genomic structure, Part IV (Custom display colors in SLiMgui).txt @@ -59,7 +59,7 @@ initialize() { initializeRecombinationRate(1e-8); } 1 early() { - sim.chromosome.colorSubstitution = ""; + sim.chromosomes.colorSubstitution = ""; sim.addSubpop("p1", 5000); } 10000 early() { sim.simulationFinished(); } diff --git a/SLiMgui/Recipes/Recipe 9.1 - Introducing adaptive mutations.txt b/SLiMgui/Recipes/Recipe 9.1 - Introducing adaptive mutations.txt index 992eb4e61..f3a952b01 100644 --- a/SLiMgui/Recipes/Recipe 9.1 - Introducing adaptive mutations.txt +++ b/SLiMgui/Recipes/Recipe 9.1 - Introducing adaptive mutations.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:100000 late() { diff --git a/SLiMgui/Recipes/Recipe 9.10 - Tracking the fate of background mutations.txt b/SLiMgui/Recipes/Recipe 9.10 - Tracking the fate of background mutations.txt index 0ecfdadaa..32eda7b8a 100644 --- a/SLiMgui/Recipes/Recipe 9.10 - Tracking the fate of background mutations.txt +++ b/SLiMgui/Recipes/Recipe 9.10 - Tracking the fate of background mutations.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); defineConstant("BACKGROUND", target.mutations); mut = target.addNewDrawnMutation(m2, asInteger(L/2)); defineConstant("SWEEP", mut); diff --git a/SLiMgui/Recipes/Recipe 9.11 - Effective population size versus census population size.txt b/SLiMgui/Recipes/Recipe 9.11 - Effective population size versus census population size.txt index 2308b719c..a29b0d99a 100644 --- a/SLiMgui/Recipes/Recipe 9.11 - Effective population size versus census population size.txt +++ b/SLiMgui/Recipes/Recipe 9.11 - Effective population size versus census population size.txt @@ -32,7 +32,7 @@ initialize() { p1.setValue("previous_N", p1.individualCount); } 10000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, integerDiv(L, 2)); } 20000 late() { @@ -49,7 +49,7 @@ function (float)mutTypeFrequency(o$ mutType) function (float)estimateNe_Heterozygosity(o$ subpop) { - pi = calcHeterozygosity(p1.genomes); + pi = calcHeterozygosity(p1.haplosomes); return pi / (4 * MU); } diff --git a/SLiMgui/Recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt b/SLiMgui/Recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt index bf7859af5..0dbb0f2f8 100644 --- a/SLiMgui/Recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt +++ b/SLiMgui/Recipes/Recipe 9.2 - Making sweeps conditional on fixation.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:100000 late() { @@ -43,7 +43,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/SLiMgui/Recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt b/SLiMgui/Recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt index b149a22c6..df1086fe7 100644 --- a/SLiMgui/Recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt +++ b/SLiMgui/Recipes/Recipe 9.3 - Making sweeps conditional on establishment.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000: late() { @@ -44,7 +44,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/SLiMgui/Recipes/Recipe 9.4 - Partial sweeps.txt b/SLiMgui/Recipes/Recipe 9.4 - Partial sweeps.txt index f192d43e3..c625551e1 100644 --- a/SLiMgui/Recipes/Recipe 9.4 - Partial sweeps.txt +++ b/SLiMgui/Recipes/Recipe 9.4 - Partial sweeps.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000:10000 late() { diff --git a/SLiMgui/Recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt b/SLiMgui/Recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt index d5ca891e3..f98614b2a 100644 --- a/SLiMgui/Recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt +++ b/SLiMgui/Recipes/Recipe 9.5.1 - A soft sweep from recurrent de novo mutations in a large population.txt @@ -13,7 +13,7 @@ initialize() { sim.addSubpop("p1", 100000); } 1:10000 early() { - counts = p1.genomes.countOfMutationsOfType(m1); + counts = p1.haplosomes.countOfMutationsOfType(m1); freq = mean(counts > 0); if (freq == 1.0) @@ -22,7 +22,7 @@ initialize() { for (mut in sortBy(sim.mutations, "originTick")) { - mutFreq = mean(p1.genomes.containsMutations(mut)); + mutFreq = mean(p1.haplosomes.containsMutations(mut)); cat("Origin " + mut.originTick + ": " + mutFreq + "\n"); } diff --git a/SLiMgui/Recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt b/SLiMgui/Recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt index f7692ae87..791d93928 100644 --- a/SLiMgui/Recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt +++ b/SLiMgui/Recipes/Recipe 9.5.2 - A soft sweep with a fixed de novo mutation schedule.txt @@ -15,7 +15,7 @@ initialize() { 1000:1100 late() { if (sim.cycle % 10 == 0) { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); if (target.countOfMutationsOfType(m2) == 0) target.addNewDrawnMutation(m2, 10000); } @@ -36,7 +36,7 @@ initialize() { } } } - if (all(p1.genomes.countOfMutationsOfType(m2) > 0)) { + if (all(p1.haplosomes.countOfMutationsOfType(m2) > 0)) { cat("Soft sweep ended in cycle " + sim.cycle + "\n"); cat("Frequencies:\n"); print(sim.mutationFrequencies(p1, sim.mutationsOfType(m2))); diff --git a/SLiMgui/Recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt b/SLiMgui/Recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt index e2e94b0b3..8ed98b152 100644 --- a/SLiMgui/Recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt +++ b/SLiMgui/Recipes/Recipe 9.5.3 - A soft sweep with a random de novo mutation schedule.txt @@ -21,7 +21,7 @@ initialize() { community.deregisterScriptBlock(s1); } s1 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); mut = sim.mutationsOfType(m2); if (mut.size() > 0) target.addMutations(mut); diff --git a/SLiMgui/Recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt b/SLiMgui/Recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt index d966f98e7..b23841f9c 100644 --- a/SLiMgui/Recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt +++ b/SLiMgui/Recipes/Recipe 9.6.2 - A sweep from standing variation at a predetermined locus.txt @@ -19,7 +19,7 @@ initialize() { sim.outputFull(tempdir() + "slim_" + simID + ".txt"); // introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 1000: late() { @@ -45,7 +45,7 @@ initialize() { setSeed(rdunif(1, 0, asInteger(2^62) - 1)); // re-introduce the sweep mutation - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } } diff --git a/SLiMgui/Recipes/Recipe 9.7 - Adaptive introgression.txt b/SLiMgui/Recipes/Recipe 9.7 - Adaptive introgression.txt index 76f6f3d95..bdb9ffa52 100644 --- a/SLiMgui/Recipes/Recipe 9.7 - Adaptive introgression.txt +++ b/SLiMgui/Recipes/Recipe 9.7 - Adaptive introgression.txt @@ -18,7 +18,7 @@ initialize() { sim.subpopulations[i-1].setMigrationRates(i+1, 0.2); } 100 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); target.addNewDrawnMutation(m2, 10000); } 100:100000 late() { diff --git a/SLiMgui/Recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt b/SLiMgui/Recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt index b6694b10c..2494f90d6 100644 --- a/SLiMgui/Recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt +++ b/SLiMgui/Recipes/Recipe 9.9 - Keeping a reference to a sweep mutation.txt @@ -10,7 +10,7 @@ initialize() { } 1 early() { sim.addSubpop("p1", 500); } 1000 late() { - target = sample(p1.genomes, 1); + target = sample(p1.haplosomes, 1); mut = target.addNewDrawnMutation(m2, 10000); defineConstant("SWEEP", mut); } diff --git a/VERSIONS b/VERSIONS index 1f36817b6..64910016e 100644 --- a/VERSIONS +++ b/VERSIONS @@ -50,12 +50,15 @@ development head (in the master branch): method: (object)chromosomesWithSymbols(string symbols) Individual class: method: (object)haplosomesForChromosomes([Niso chromosomes = NULL], [Ni index = NULL], [logical$ includeNulls = T]) - Mutation class: - property: chromosome => (object$) + x Mutation class: + x property: chromosome => (object$) Subpopulation class: method: (object)haplosomesForChromosomes([Niso chromosomes = NULL], [Ni index = NULL], [logical$ includeNulls = T]) method: (object)addMultiRecombinant(object$ pattern, [Nfs$ sex = NULL], [No$ parent1 = NULL], [No$ parent2 = NULL], [logical$ randomizeStrands = F], [integer$ count = 1], [logical$ defer = F]) + add autofixes in SLiMgui for the above API changes + revise recipes for new terminology (but they will require more revision downstream) + fix calc...() functions for new terminology (but they will require more revision downstream) version 4.3 (Eidos version 3.3): diff --git a/core/slim_functions.cpp b/core/slim_functions.cpp index a9270ae04..535ab831f 100644 --- a/core/slim_functions.cpp +++ b/core/slim_functions.cpp @@ -186,7 +186,7 @@ R"V0G0N({ muts1 = haplosome1.mutations; muts2 = haplosome2.mutations; - length = species.chromosome.lastPosition + 1; + length = species.chromosomes.lastPosition + 1; // handle windowing if (!isNULL(start) & !isNULL(end)) @@ -231,7 +231,7 @@ R"V0G0N({ species = community.allSpecies; } - length = species.chromosome.lastPosition + 1; + length = species.chromosomes.lastPosition + 1; // handle windowing if (!isNULL(start) & !isNULL(end)) @@ -274,7 +274,7 @@ R"V0G0N({ species = community.allSpecies; } - length = species.chromosome.lastPosition + 1; + length = species.chromosomes.lastPosition + 1; if (isNULL(muts)) muts = species.mutations; @@ -375,7 +375,7 @@ R"V0G0N({ species = community.allSpecies; } - length = species.chromosome.lastPosition + 1; + length = species.chromosomes.lastPosition + 1; if (isNULL(muts)) muts = species.mutations; @@ -432,7 +432,7 @@ R"V0G0N({ species = community.allSpecies; } - length = species.chromosome.lastPosition + 1; + length = species.chromosomes.lastPosition + 1; if (isNULL(muts)) muts = species.mutations;