[Avida-SVN] r2594 - development/source/analyze
kaben at myxo.css.msu.edu
kaben at myxo.css.msu.edu
Sun May 25 17:57:10 PDT 2008
Author: kaben
Date: 2008-05-25 20:57:09 -0400 (Sun, 25 May 2008)
New Revision: 2594
Modified:
development/source/analyze/cAnalyze.cc
development/source/analyze/cAnalyze.h
development/source/analyze/cAnalyzeTreeStats_Gamma.cc
development/source/analyze/cAnalyzeTreeStats_Gamma.h
Log:
Removed obsolete version of cAnalyzeTreeStats_Gamma.
Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc 2008-05-23 13:39:33 UTC (rev 2593)
+++ development/source/analyze/cAnalyze.cc 2008-05-26 00:57:09 UTC (rev 2594)
@@ -3281,29 +3281,6 @@
}
-// Calculate Pybus-Harvey gamma statistic for trees in population.
-void cAnalyze::Original_CommandPrintGamma(cString cur_string)
-{
- if (m_world->GetVerbosity() >= VERBOSE_ON) cout << "Printing Pybus-Harvey gamma statistic for batch "
- << cur_batch << endl;
- else cout << "Printing Pybus-Harvey gamma statistic..." << endl;
-
- // Load in the variables...
- cString filename("gamma.dat");
- if (cur_string.GetSize() != 0) filename = cur_string.PopWord();
-
- ofstream& fp = m_world->GetDataFileOFStream(filename);
-
- fp << "# Legend:" << endl;
- fp << "# 1: Pybus-Harvey gamma statistic" << endl;
- fp << endl;
-
- cAnalyzeTreeStats_Orig_Gamma agts(m_world);
- agts.AnalyzeBatch(batch[cur_batch].List());
-
- fp << agts.Gamma();
- fp << endl;
-}
// Calculate Pybus-Harvey gamma statistic for trees in population.
void cAnalyze::CommandPrintGamma(cString cur_string)
@@ -5426,6 +5403,9 @@
} else { // if (file_type == FILE_TYPE_HTML) {
filename.Set("%smut_map.%s.html", static_cast<const char*>(directory), static_cast<const char*>(genotype->GetName()));
}
+ if (m_world->GetVerbosity() >= VERBOSE_ON) {
+ cout << " Using filename \"" << filename << "\"" << endl;
+ }
ofstream& fp = m_world->GetDataFileOFStream(filename);
// Calculate the stats for the genotype we're working with...
@@ -9273,7 +9253,6 @@
AddLibraryDef("PRINT_DIVERSITY", &cAnalyze::CommandPrintDiversity);
AddLibraryDef("PRINT_TREE_STATS", &cAnalyze::CommandPrintTreeStats);
AddLibraryDef("PRINT_CUMULATIVE_STEMMINESS", &cAnalyze::CommandPrintCumulativeStemminess);
- AddLibraryDef("ORIGINAL_PRINT_GAMMA", &cAnalyze::Original_CommandPrintGamma);
AddLibraryDef("PRINT_GAMMA", &cAnalyze::CommandPrintGamma);
AddLibraryDef("COMMUNITY_COMPLEXITY", &cAnalyze::AnalyzeCommunityComplexity);
AddLibraryDef("PRINT_RESOURCE_FITNESS_MAP", &cAnalyze::CommandPrintResourceFitnessMap);
Modified: development/source/analyze/cAnalyze.h
===================================================================
--- development/source/analyze/cAnalyze.h 2008-05-23 13:39:33 UTC (rev 2593)
+++ development/source/analyze/cAnalyze.h 2008-05-26 00:57:09 UTC (rev 2594)
@@ -258,7 +258,6 @@
void CommandPrintDiversity(cString cur_string);
void CommandPrintTreeStats(cString cur_string);
void CommandPrintCumulativeStemminess(cString cur_string);
- void Original_CommandPrintGamma(cString cur_string);
void CommandPrintGamma(cString cur_string);
void PhyloCommunityComplexity(cString cur_string);
void AnalyzeCommunityComplexity(cString cur_string);
Modified: development/source/analyze/cAnalyzeTreeStats_Gamma.cc
===================================================================
--- development/source/analyze/cAnalyzeTreeStats_Gamma.cc 2008-05-23 13:39:33 UTC (rev 2593)
+++ development/source/analyze/cAnalyzeTreeStats_Gamma.cc 2008-05-26 00:57:09 UTC (rev 2594)
@@ -34,97 +34,7 @@
using namespace std;
-cAnalyzeTreeStats_Orig_Gamma::cAnalyzeTreeStats_Orig_Gamma(cWorld* world)
-: m_world(world)
-, m_gen_array(0)
-, m_g(0)
-, m_gamma(0.)
-{}
-void cAnalyzeTreeStats_Orig_Gamma::LoadGenotypes(tList<cAnalyzeGenotype> &genotype_list){
- cAnalyzeGenotype * genotype = NULL;
- tListIterator<cAnalyzeGenotype> batch_it(genotype_list);
-
- m_gen_array.Resize(genotype_list.GetSize());
- int array_pos = 0;
- batch_it.Reset();
- while ((genotype = batch_it.Next()) != NULL) {
- m_gen_array[array_pos] = genotype;
- array_pos++;
- }
-}
-void cAnalyzeTreeStats_Orig_Gamma::QSortGenotypes(void){
- QSortAGPhyloDepth(m_gen_array);
-}
-void cAnalyzeTreeStats_Orig_Gamma::CalculateInternodeDistances(void){
- m_g.Resize(1 + m_gen_array.GetSize());
- m_g[0] = 0;
- m_g[1] = m_gen_array[0]->GetDepth() - 0;
- for(int i = 1; i < m_gen_array.GetSize(); i++) {
- m_g[i+1] = m_gen_array[i]->GetDepth() - m_gen_array[i-1]->GetDepth();
- }
-}
-void cAnalyzeTreeStats_Orig_Gamma::FixupInternodeDistances(void){
- bool in_redundant_subsequence = false;
- int saved_g = -1;
- for(int i = 1; i < m_gen_array.GetSize(); i++) {
- /* if we are entering a redundant subsequence, save and then clear first redundant g. */
- if((m_gen_array[i]->GetDepth() == m_gen_array[i-1]->GetDepth()) && (!in_redundant_subsequence)) {
- saved_g = m_g[i];
- m_g[i] = 0;
- in_redundant_subsequence = true;
- }
-
- /* if we are exiting a redundant subsequence, restore the saved redundant g. */
- if((m_gen_array[i]->GetDepth() == m_gen_array[i-1]->GetDepth()) && (in_redundant_subsequence)) {
- m_g[i+1] = saved_g;
- saved_g = -1;
- in_redundant_subsequence = false;
- }
- }
- /* if we fell off the end of a redundant subsequence, restore the saved redundant g. */
- if(in_redundant_subsequence) {
- m_g[m_gen_array.GetSize()] = saved_g;
- }
-}
-void cAnalyzeTreeStats_Orig_Gamma::CalculateGamma(void){
- // n: number of leaves, constant for a given tree.
- int n = m_gen_array.GetSize();
-
- if(n <= 2){
- if(m_world->GetVerbosity() >= VERBOSE_ON) {
- cerr << "Error: not enough genotypes in batch to calculate gamma - " << endl;
- }
- return;
- }
-
- unsigned long long T = 0;
- for(int j = 2; j <= n; j++) { T += j*m_g[j]; }
-
- // so: exterior summation
- unsigned long long so = 0;
- for(int i = 2; i <= n-1; i++) {
- // si: interior summation
- unsigned long long si = 1;
- for(int k = 2; k <= i; k++) { si += k*m_g[k]; }
- so += si;
- }
-
- m_gamma = ( ( (1./(n-2.)) * so ) - (T/2.) ) / ( T*sqrt( 1. / (12.*(n-2.)) ) );
-}
-double cAnalyzeTreeStats_Orig_Gamma::Gamma(void){
- return m_gamma;
-}
-
-void cAnalyzeTreeStats_Orig_Gamma::AnalyzeBatch(tList<cAnalyzeGenotype> &genotype_list){
- LoadGenotypes(genotype_list);
- QSortGenotypes();
- CalculateInternodeDistances();
- CalculateGamma();
-}
-
-
-
// Comparison functions for qsort.
int CompareAGPhyloDepth(const void * _a, const void * _b){
cAnalyzeGenotype a(**((cAnalyzeGenotype**)_a));
Modified: development/source/analyze/cAnalyzeTreeStats_Gamma.h
===================================================================
--- development/source/analyze/cAnalyzeTreeStats_Gamma.h 2008-05-23 13:39:33 UTC (rev 2593)
+++ development/source/analyze/cAnalyzeTreeStats_Gamma.h 2008-05-26 00:57:09 UTC (rev 2594)
@@ -21,8 +21,8 @@
*
*/
-#ifndef cAnalyzeTreeStats_Orig_Gamma_h
-#define cAnalyzeTreeStats_Orig_Gamma_h
+#ifndef cAnalyzeTreeStats_Gamma_h
+#define cAnalyzeTreeStats_Gamma_h
#ifndef tArray_h
#include "tArray.h"
@@ -37,27 +37,6 @@
class cAnalyzeGenotype;
class cWorld;
-class cAnalyzeTreeStats_Orig_Gamma {
-public:
- cWorld* m_world;
- tArray<cAnalyzeGenotype *> m_gen_array;
- tArray<int> m_g;
- double m_gamma;
-public:
- cAnalyzeTreeStats_Orig_Gamma(cWorld* world);
-
- void LoadGenotypes(tList<cAnalyzeGenotype> &genotype_list);
- void QSortGenotypes(void);
- void CalculateInternodeDistances(void);
- void FixupInternodeDistances(void);
- void CalculateGamma(void);
-
- double Gamma(void);
-
- // Commands.
- void AnalyzeBatch(tList<cAnalyzeGenotype> &genotype_list);
-};
-
// Comparison functions for qsort.
int CompareAGPhyloDepth(const void * _a, const void * _b);
int CompareAGUpdateBorn(const void * _a, const void * _b);
More information about the Avida-cvs
mailing list