diff --git a/core/chromosome.cpp b/core/chromosome.cpp index 4cc7c716..ee8b0136 100644 --- a/core/chromosome.cpp +++ b/core/chromosome.cpp @@ -59,13 +59,14 @@ inline __attribute__((always_inline)) GESubrange::GESubrange(GenomicElement *p_g #pragma mark Chromosome #pragma mark - -Chromosome::Chromosome(Species &p_species, ChromosomeType p_type, int64_t p_id, std::string p_symbol, slim_chromosome_index_t p_index) : +Chromosome::Chromosome(Species &p_species, ChromosomeType p_type, int64_t p_id, std::string p_symbol, slim_chromosome_index_t p_index, int p_preferred_mutcount) : id_(p_id), symbol_(p_symbol), name_(), index_(p_index), type_(p_type), - + preferred_mutrun_count_(p_preferred_mutcount), + exp_neg_overall_mutation_rate_H_(0.0), exp_neg_overall_mutation_rate_M_(0.0), exp_neg_overall_mutation_rate_F_(0.0), exp_neg_overall_recombination_rate_H_(0.0), exp_neg_overall_recombination_rate_M_(0.0), exp_neg_overall_recombination_rate_F_(0.0), diff --git a/core/chromosome.h b/core/chromosome.h index 20f29573..4dd93fc9 100644 --- a/core/chromosome.h +++ b/core/chromosome.h @@ -244,13 +244,15 @@ class Chromosome : public EidosDictionaryRetained Chromosome& operator=(const Chromosome&) = delete; // no copying Chromosome(void) = delete; // no null constructor - explicit Chromosome(Species &p_species, ChromosomeType p_type, int64_t p_id, std::string p_symbol, slim_chromosome_index_t p_index); + explicit Chromosome(Species &p_species, ChromosomeType p_type, int64_t p_id, std::string p_symbol, slim_chromosome_index_t p_index, int p_preferred_mutcount); ~Chromosome(void); inline __attribute__((always_inline)) int64_t ID(void) { return id_; } inline __attribute__((always_inline)) const std::string &Symbol(void) { return symbol_; } inline __attribute__((always_inline)) slim_chromosome_index_t Index(void) { return index_; } inline __attribute__((always_inline)) ChromosomeType Type(void) { return type_; } + inline __attribute__((always_inline)) const std::string &Name(void) { return name_; } + inline __attribute__((always_inline)) void SetName(const std::string &p_name) { name_ = p_name; } inline __attribute__((always_inline)) std::vector &GenomicElements(void) { return genomic_elements_; } inline __attribute__((always_inline)) NucleotideArray *AncestralSequence(void) { return ancestral_seq_buffer_; } diff --git a/core/population.cpp b/core/population.cpp index 4b67ffa9..20321089 100644 --- a/core/population.cpp +++ b/core/population.cpp @@ -2597,7 +2597,7 @@ void Population::DoCrossoverMutation(Subpopulation *p_source_subpop, Haplosome & { // If we're modeling autosomes, we can disregard p_child_sex entirely; we don't care whether we're modeling sexual or hermaphrodite individuals #if DEBUG - if (species_.has_genetics_) + if (species_.HasGenetics()) { if (child_haplosome_null) EIDOS_TERMINATION << "ERROR (Population::DoCrossoverMutation): A null child haplosome was requested in the autosomal case." << EidosTerminate(); diff --git a/core/species.cpp b/core/species.cpp index 64559bb2..797908e3 100644 --- a/core/species.cpp +++ b/core/species.cpp @@ -156,7 +156,7 @@ void Species::MakeImplicitChromosome(ChromosomeType p_type) EIDOS_TERMINATION << "ERROR (Species::MakeImplicitChromosome): (internal error) explicit chromosome already exists." << EidosTerminate(); // Create an implicit Chromosome object with a retain on it from EidosDictionaryRetained::EidosDictionaryRetained() - Chromosome *chromosome = new Chromosome(*this, p_type, 1, "1", 0); + Chromosome *chromosome = new Chromosome(*this, p_type, 1, "1", /* p_index */ 0, /* p_preferred_mutcount */ 0); int64_t id = chromosome->ID(); std::string symbol = chromosome->Symbol(); @@ -1875,7 +1875,7 @@ void Species::RunInitializeCallbacks(void) has_genetics_ = false; // Make a dummy chromosome of length zero, id 0, symbol "0" - Chromosome *dummy_chromosome = new Chromosome(*this, ChromosomeType::kA_DiploidAutosome, 0, "0", 0); + Chromosome *dummy_chromosome = new Chromosome(*this, ChromosomeType::kA_DiploidAutosome, 0, "0", /* p_index */ 0, /* p_preferred_mutcount */ 0); int64_t id = dummy_chromosome->ID(); std::string symbol = dummy_chromosome->Symbol(); diff --git a/core/species_eidos.cpp b/core/species_eidos.cpp index d869f42b..6adc5c97 100644 --- a/core/species_eidos.cpp +++ b/core/species_eidos.cpp @@ -296,15 +296,13 @@ EidosValue_SP Species::ExecuteContextFunction_initializeChromosome(const std::st } // Set up the new chromosome object - Chromosome *chromosome = new Chromosome(*this, chromosome_type, id, symbol, 0); + Chromosome *chromosome = new Chromosome(*this, chromosome_type, id, symbol, /* p_index */ 0, (int)mutrun_count); + chromosome->SetName(name); chromosomes_.push_back(chromosome); chromosome_from_id_.emplace(id, chromosome); chromosome_from_symbol_.emplace(symbol, chromosome); - chromosome->name_ = name; - chromosome->preferred_mutrun_count_ = (int)mutrun_count; - num_chromosome_inits_++; has_currently_initializing_chromosome_ = true;