[Avida-SVN] r2298 - in development: source/main tests/demes_germline/config

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Mon Feb 4 12:19:49 PST 2008


Author: dknoester
Date: 2008-02-04 15:19:49 -0500 (Mon, 04 Feb 2008)
New Revision: 2298

Modified:
   development/source/main/cAvidaConfig.h
   development/source/main/cPopulation.cc
   development/tests/demes_germline/config/avida.cfg
Log:
Added germline insertion and deletion mutations.

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2008-02-03 22:08:27 UTC (rev 2297)
+++ development/source/main/cAvidaConfig.h	2008-02-04 20:19:49 UTC (rev 2298)
@@ -303,6 +303,8 @@
   CONFIG_ADD_VAR(DEMES_MAX_AGE, int, 500, "The maximum age of a deme (in updates) to be\nused for age-based replication (default=500).");
   CONFIG_ADD_VAR(DEMES_MAX_BIRTHS, int, 100, "The maximum number of births that can occur\nwithin a deme; used with birth-count\nreplication (default=100).");
   CONFIG_ADD_VAR(GERMLINE_COPY_MUT, double, 0.0075, "Prob. of copy mutations occuring during\ngermline replication (default=0.0075).");
+  CONFIG_ADD_VAR(GERMLINE_INS_MUT, double, 0.05, "Prob. of an insertion mutation occuring\nduring germline replication (default=0.05).");
+  CONFIG_ADD_VAR(GERMLINE_DEL_MUT, double, 0.05, "Prob. of a deletion mutation occuring\nduring germline replication (default=0.05).");
   
   CONFIG_ADD_GROUP(REPRODUCTION_GROUP, "Birth and Death");
   CONFIG_ADD_VAR(BIRTH_METHOD, int, 0, "Which organism should be replaced on birth?\n0 = Random organism in neighborhood\n1 = Oldest in neighborhood\n2 = Largest Age/Merit in neighborhood\n3 = None (use only empty cells in neighborhood)\n4 = Random from population (Mass Action)\n5 = Oldest in entire population\n6 = Random within deme\n7 = Organism faced by parent\n8 = Next grid cell (id+1)\n9 = Largest energy used in entire population\n10 = Largest energy used in neighborhood");

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2008-02-03 22:08:27 UTC (rev 2297)
+++ development/source/main/cPopulation.cc	2008-02-04 20:19:49 UTC (rev 2298)
@@ -1152,10 +1152,11 @@
   // Are we using germlines?  If so, we need to mutate the germline to get the
   // genome that we're going to seed the target with.
   if(m_world->GetConfig().DEMES_USE_GERMLINE.Get()) {
-    cGenome next_germ(source_deme.GetGermline().GetLatest());
+    cCPUMemory next_germ(source_deme.GetGermline().GetLatest());
+    const cInstSet& instset = m_world->GetHardwareManager().GetInstSet();
+    cAvidaContext ctx(m_world->GetRandom());
+    
     if(m_world->GetConfig().GERMLINE_COPY_MUT.Get() > 0.0) {
-      const cInstSet& instset = m_world->GetHardwareManager().GetInstSet();
-      cAvidaContext ctx(m_world->GetRandom());
       for(int i=0; i<next_germ.GetSize(); ++i) {
         if(m_world->GetRandom().P(m_world->GetConfig().GERMLINE_COPY_MUT.Get())) {
           next_germ[i] = instset.GetRandomInst(ctx);
@@ -1163,6 +1164,18 @@
       }
     }
     
+    if((m_world->GetConfig().GERMLINE_INS_MUT.Get() > 0.0)
+       && m_world->GetRandom().P(m_world->GetConfig().DIVIDE_INS_PROB.Get())) {
+      const unsigned int mut_line = ctx.GetRandom().GetUInt(next_germ.GetSize() + 1);
+      next_germ.Insert(mut_line, instset.GetRandomInst(ctx));
+    }
+    
+    if((m_world->GetConfig().GERMLINE_DEL_MUT.Get() > 0.0)
+       && m_world->GetRandom().P(m_world->GetConfig().DIVIDE_DEL_PROB.Get())) {
+      const unsigned int mut_line = ctx.GetRandom().GetUInt(next_germ.GetSize());
+      next_germ.Remove(mut_line);
+    }
+    
     // Replace the target deme's germline with the source deme's, and add the newly-
     // mutated germ to ONLY the target's germline.  The source remains unchanged.
     target_deme.ReplaceGermline(source_deme.GetGermline());

Modified: development/tests/demes_germline/config/avida.cfg
===================================================================
--- development/tests/demes_germline/config/avida.cfg	2008-02-03 22:08:27 UTC (rev 2297)
+++ development/tests/demes_germline/config/avida.cfg	2008-02-04 20:19:49 UTC (rev 2298)
@@ -59,6 +59,10 @@
                             # within a deme; used with birth-count replication.
 GERMLINE_COPY_MUT 0.0075    # Prob. of copy mutations occuring during
                             # germline replication.
+GERMLINE_INS_MUT 0.0        # Prob. of an insertion mutation occuring
+                            # during germline replication (default=0.05).
+GERMLINE_DEL_MUT 0.0        # Prob. of a deletion mutation occuring
+                            # during germline replication (default=0.05).
 
 ### REPRODUCTION_GROUP ###
 # Birth and Death




More information about the Avida-cvs mailing list