[Avida-SVN] r2927 - in branches/matt/PairwiseEpistasis: Avida.xcodeproj source/analyze

ruppmatt at myxo.css.msu.edu ruppmatt at myxo.css.msu.edu
Fri Nov 7 12:04:59 PST 2008


Author: ruppmatt
Date: 2008-11-07 15:04:59 -0500 (Fri, 07 Nov 2008)
New Revision: 2927

Modified:
   branches/matt/PairwiseEpistasis/Avida.xcodeproj/project.pbxproj
   branches/matt/PairwiseEpistasis/source/analyze/cAnalyze.cc
Log:
Added additional column printing support for phenotypic entropy, site, and character.

Modified: branches/matt/PairwiseEpistasis/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/matt/PairwiseEpistasis/Avida.xcodeproj/project.pbxproj	2008-11-07 19:40:25 UTC (rev 2926)
+++ branches/matt/PairwiseEpistasis/Avida.xcodeproj/project.pbxproj	2008-11-07 20:04:59 UTC (rev 2927)
@@ -739,7 +739,7 @@
 		DCC315CE076253A5008F7A48 /* environment.rotate */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = environment.rotate; sourceTree = "<group>"; };
 		DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
 		DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
-		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */

Modified: branches/matt/PairwiseEpistasis/source/analyze/cAnalyze.cc
===================================================================
--- branches/matt/PairwiseEpistasis/source/analyze/cAnalyze.cc	2008-11-07 19:40:25 UTC (rev 2926)
+++ branches/matt/PairwiseEpistasis/source/analyze/cAnalyze.cc	2008-11-07 20:04:59 UTC (rev 2927)
@@ -7003,12 +7003,15 @@
  * perform 1-NN lanscaping around each genotype, keeping the last mutation
  * to occur fixed.  Output will be one file per genotype that lists 
  * the fitnesses of each genotype.
- * Updated 7 November 2008:  Adding nan place-holders for comparison of neighborhoods
- *                           between parent and child genotypes.
+ * Updated 7 November 2008
+ *          Adding nan place-holders for comparison of neighborhoods
+ *              between parent and child genotypes.
+ *          Adding instruction-set redundancy field                 
  * Arguments
  *    suffix = "1.NN"  The prefix of each file
  *    num_trials [= 1] default number of trials for plasticity
- * ===================================================================================*/
+ *     
+* ===================================================================================*/
 void cAnalyze::LandscapeBackground(cString cur_string)
 {
   cString file_suffix;
@@ -7016,9 +7019,10 @@
   double  zero = 0.0;
   double  xnan = 0.0/zero;  //Generate a nan
   
-  file_suffix  = (cur_string.GetSize() == 0) ? "-1.NN" : cur_string.PopWord();
-  num_trials   = (cur_string.GetSize() == 0) ? 1      : cur_string.PopWord().AsInt();
+  file_suffix  = (cur_string.GetSize()  == 0) ? "-1.NN" : cur_string.PopWord();
+  num_trials   = (cur_string.GetSize()  == 0) ? 1       : cur_string.PopWord().AsInt();
   
+  
   //Right now, only perform this on actual lineages
   if (!batch[cur_batch].IsLineage())
     m_world->GetDriver().RaiseFatalException(2, "LandscapeBackground: Current batch must be a lineage.");
@@ -7067,8 +7071,18 @@
     if (!df.Good())
       m_world->GetDriver().RaiseFatalException(2, "LandscapeBackground: Unable to open requested file for output.");
     
+    //Write our header
+    df.WriteAnonymous("# Nearest Neighbor\n");
+    df.WriteAnonymous("# Site\n");
+    df.WriteAnonymous("# Character\n");
+    df.WriteAnonymous("# Average Fitness\n");
+    df.WriteAnonymous("# Phenotypic Entorpy\n");
+    
     //Write our initial fitness to the top line
-    df.WriteAnonymous(genotype_A->GetFitness());
+    cPhenPlastGenotype pA(genotype_A->GetGenome(), num_trials, m_world, m_ctx);
+    cString Line;
+    Line.Set("# %d %c %g %g\n", -1, '-', pA.GetAverageFitness(), pA.GetPhenotypicEntropy());
+    df.WriteAnonymous(Line);
     df.Endl();
     
     
@@ -7088,15 +7102,18 @@
         // then supply a nan.
         if (mut_site || cInstruction(c).GetSymbol() == old_genotype[k])
         {
-          df.WriteAnonymous(xnan);
+          Line.Set("%d %c %g %g", k, cInstruction(c).GetSymbol(), xnan, xnan);
+          df.WriteAnonymous(Line);
           df.Endl();
           continue;
         }
         new_genotype = old_genotype;
         new_genotype[k] = cInstruction(c).GetSymbol();
         cPhenPlastGenotype pp(new_genotype, num_trials, m_world, m_ctx);
-        df.WriteAnonymous(pp.GetAverageFitness());
+        Line.Set("%d %c %g %g", k, cInstruction(c).GetSymbol(), pp.GetAverageFitness(), pp.GetPhenotypicEntropy());
+        df.WriteAnonymous(Line);
         df.Endl();
+        
       }//End genotype mutation loop
     } //End child landscape loop
     




More information about the Avida-cvs mailing list