@@ -6779,7 +6779,7 @@ void Population::UniqueMutationRuns(void)
67796779 std::clock_t end = std::clock ();
67806780 double time_spent = static_cast <double >(end - begin) / CLOCKS_PER_SEC;
67816781
6782- std::cout << " UniqueMutationRuns(): \n " << total_mutruns << " run pointers analyzed\n " << total_preexisting << " runs pre-existing\n " << total_uniqued_away << " duplicate runs discovered and uniqued away\n " << (total_mutruns - total_identical) << " final uniqued mutation runs\n " << total_hash_collisions << " hash collisions\n " << time_spent << " seconds elapsed" << std::endl;
6782+ std::cout << " UniqueMutationRuns(), tick " << community_. Tick () << " : \n " << total_mutruns << " run pointers analyzed\n " << total_preexisting << " runs pre-existing\n " << total_uniqued_away << " duplicate runs discovered and uniqued away\n " << (total_mutruns - total_identical) << " final uniqued mutation runs\n " << total_hash_collisions << " hash collisions\n " << time_spent << " seconds elapsed" << std::endl;
67836783#else
67846784 // get rid of unused variable warnings
67856785 (void )total_hash_collisions;
@@ -7240,74 +7240,88 @@ void Population::AssessMutationRuns(void)
72407240
72417241 if (tick % 1000 == 0 )
72427242 {
7243- // First, unique our runs; this is just for debugging the uniquing, and should be removed. FIXME
7244- int haplosome_count_per_individual = species_.HaplosomeCountPerIndividual ();
7245- slim_refcount_t total_haplosome_count = 0 , total_mutrun_count = 0 , total_shared_mutrun_count = 0 ;
7246- int mutrun_count = 0 , use_count_total = 0 ;
7247- slim_position_t mutrun_length = 0 ;
7248- int64_t mutation_total = 0 ;
7249-
7250- int64_t operation_id = MutationRun::GetNextOperationID ();
7243+ std::cout << " ***** AssessMutationRuns(), tick " << tick << " :" << std::endl;
7244+ std::cout << " Mutation count: " << mutation_registry_.size () << std::endl;
72517245
7252- for (const std::pair< const slim_objectid_t ,Subpopulation*> &subpop_pair : subpops_ )
7246+ for (Chromosome *chromosome : species_. Chromosomes () )
72537247 {
7254- Subpopulation *subpop = subpop_pair.second ;
7248+ slim_chromosome_index_t chromosome_index = chromosome->Index ();
7249+ int registry_size = 0 , registry_count_in_chromosome = 0 ;
7250+ Mutation *mut_block_ptr = gSLiM_Mutation_Block ;
7251+ const MutationIndex *registry = MutationRegistry (®istry_size);
72557252
7256- for (Individual *ind : subpop-> parent_individuals_ )
7253+ for (int registry_index = 0 ; registry_index < registry_size; ++registry_index )
72577254 {
7258- Haplosome **haplosomes = ind-> haplosomes_ ;
7255+ Mutation *mut = mut_block_ptr + registry[registry_index] ;
72597256
7260- for (int haplosome_index = 0 ; haplosome_index < haplosome_count_per_individual; haplosome_index++)
7257+ if (mut->chromosome_index_ == chromosome_index)
7258+ registry_count_in_chromosome++;
7259+ }
7260+
7261+ int first_haplosome_index = species_.FirstHaplosomeIndices ()[chromosome_index];
7262+ int last_haplosome_index = species_.LastHaplosomeIndices ()[chromosome_index];
7263+ int haplosome_count_per_individual = species_.HaplosomeCountPerIndividual ();
7264+ slim_refcount_t total_haplosome_count = 0 , total_mutrun_count = 0 , total_shared_mutrun_count = 0 ;
7265+ int mutrun_count = 0 , use_count_total = 0 ;
7266+ slim_position_t mutrun_length = 0 ;
7267+ int64_t mutation_total = 0 ;
7268+
7269+ int64_t operation_id = MutationRun::GetNextOperationID ();
7270+
7271+ for (const std::pair<const slim_objectid_t ,Subpopulation*> &subpop_pair : subpops_)
7272+ {
7273+ Subpopulation *subpop = subpop_pair.second ;
7274+
7275+ for (Individual *ind : subpop->parent_individuals_ )
72617276 {
7262- Haplosome *haplosome = haplosomes[haplosome_index] ;
7277+ Haplosome **haplosomes = ind-> haplosomes_ ;
72637278
7264- if (!haplosome-> IsNull () )
7279+ for ( int haplosome_index = first_haplosome_index; haplosome_index <= last_haplosome_index; haplosome_index++ )
72657280 {
7266- // FIXME MULTICHROM These values are different for different chromosomes,
7267- // but get reported below as if they're all the same. This code doesn't
7268- // really make much sense. Probably it needs to be restructured to report
7269- // on one chromosome at a time.
7270- mutrun_count = haplosome->mutrun_count_ ;
7271- mutrun_length = haplosome->mutrun_length_ ;
7281+ Haplosome *haplosome = haplosomes[haplosome_index];
72727282
7273- for ( int run_index = 0 ; run_index < mutrun_count; ++run_index )
7283+ if (!haplosome-> IsNull () )
72747284 {
7275- const MutationRun *mutrun = haplosome->mutruns_ [run_index];
7276- int mutrun_size = mutrun->size ();
7277-
7278- total_mutrun_count++;
7279- mutation_total += mutrun_size;
7285+ mutrun_count = haplosome->mutrun_count_ ;
7286+ mutrun_length = haplosome->mutrun_length_ ;
72807287
7281- if (mutrun-> operation_id_ != operation_id )
7288+ for ( int run_index = 0 ; run_index < mutrun_count; ++run_index )
72827289 {
7283- slim_refcount_t use_count = (slim_refcount_t )mutrun->use_count ();
7290+ const MutationRun *mutrun = haplosome->mutruns_ [run_index];
7291+ int mutrun_size = mutrun->size ();
72847292
7285- total_shared_mutrun_count ++;
7286- use_count_total += use_count ;
7293+ total_mutrun_count ++;
7294+ mutation_total += mutrun_size ;
72877295
7288- mutrun->operation_id_ = operation_id;
7296+ if (mutrun->operation_id_ != operation_id)
7297+ {
7298+ slim_refcount_t use_count = (slim_refcount_t )mutrun->use_count ();
7299+
7300+ total_shared_mutrun_count++;
7301+ use_count_total += use_count;
7302+
7303+ mutrun->operation_id_ = operation_id;
7304+ }
72897305 }
7306+
7307+ total_haplosome_count++;
72907308 }
7291-
7292- total_haplosome_count++;
72937309 }
72947310 }
72957311 }
7312+
7313+ std::cout << " ========== Chromosome index " << (int )(chromosome->Index ()) << " , id " << chromosome->ID () << " , symbol " << chromosome->Symbol () << " (length " << (chromosome->last_position_ + 1 ) << " )" << std::endl;
7314+ std::cout << " Mutation count in chromosome: " << registry_count_in_chromosome << std::endl;
7315+ std::cout << " Haplosome count: " << total_haplosome_count << " (divided into " << mutrun_count << " mutation runs of length " << mutrun_length << " )" << std::endl;
7316+
7317+ std::cout << " Mutation run unshared: " << total_mutrun_count;
7318+ if (total_mutrun_count) std::cout << " (containing " << (mutation_total / (double )total_mutrun_count) << " mutations on average)" ;
7319+ std::cout << std::endl;
7320+
7321+ std::cout << " Mutation run actual: " << total_shared_mutrun_count;
7322+ if (total_shared_mutrun_count) std::cout << " (mean use count " << (use_count_total / (double )total_shared_mutrun_count) << " )" ;
7323+ std::cout << std::endl;
72967324 }
7297-
7298- std::cout << " ***** Tick " << tick << " :" << std::endl;
7299- std::cout << " Mutation count: " << mutation_registry_.size () << std::endl;
7300- std::cout << " Haplosome count: " << total_haplosome_count << " (divided into " << mutrun_count << " mutation runs of length " << mutrun_length << " )" << std::endl;
7301-
7302- std::cout << " Mutation run unshared: " << total_mutrun_count;
7303- if (total_mutrun_count) std::cout << " (containing " << (mutation_total / (double )total_mutrun_count) << " mutations on average)" ;
7304- std::cout << std::endl;
7305-
7306- std::cout << " Mutation run actual: " << total_shared_mutrun_count;
7307- if (total_shared_mutrun_count) std::cout << " (mean use count " << (use_count_total / (double )total_shared_mutrun_count) << " )" ;
7308- std::cout << std::endl;
7309-
7310- std::cout << " *****" << std::endl;
73117325 }
73127326}
73137327
0 commit comments