Print generation number on each line. (Need to update unit tests.)
authorDariusz Murakowski <murakdar@mit.edu>
Thu, 6 Mar 2014 20:41:08 +0000 (15:41 -0500)
committerDariusz Murakowski <murakdar@mit.edu>
Thu, 6 Mar 2014 20:41:08 +0000 (15:41 -0500)
population.cpp
wf.cpp

index 560ff56..ec7415d 100644 (file)
@@ -177,11 +177,22 @@ void Population::write_population(FILE *output, unsigned int generation) {
     
        for (virus_map::iterator iter=pop.begin(); iter!=pop.end(); ++iter) {
                
-        fprintf(output,"%d\t%.6e",iter->second,iter->first.energy);
+        //fprintf(output,"%d\t%.6e",iter->second,iter->first.energy);
+        fprintf(output,"%d\t%d\t%.6e",generation,iter->second,iter->first.energy);
         
         ms = iter->first.mutated_sites;
         
                for (std::set<unsigned int>::iterator ms_iter=ms.begin(); ms_iter!=ms.end(); ++ms_iter) fprintf(output,"\t%d",*ms_iter);
+        /*
+        fprintf(output,"\t");
+        std::set<unsigned int>::iterator ms_iter=ms.begin();
+        if (ms_iter != ms.end())
+            fprintf(output,"%d",*ms_iter);
+        ++ms_iter;
+               for (; ms_iter!=ms.end(); ++ms_iter)
+            fprintf(output,",%d",*ms_iter);
+        */
+
         fprintf(output,"\n");
         
        }
diff --git a/wf.cpp b/wf.cpp
index 16ee39e..30a9364 100644 (file)
--- a/wf.cpp
+++ b/wf.cpp
@@ -105,6 +105,7 @@ void run(RunParameters &r, unsigned seed) {
                 Population P(H, r.n, r.mu, r.initPop, r.initFrac);
 
                 // print epitopes
+                /*
                 std::cout << "-----------\n";
                 for (unsigned ep=0; ep<H.penalty.size(); ++ep) {
                     for (unsigned i=0; i<H.epitopeWT[ep].size(); ++i) {
@@ -117,6 +118,7 @@ void run(RunParameters &r, unsigned seed) {
                     std::cout << "\n";
                 }
                 fflush(stdout);
+                */
                 
                 unsigned int i;
                 for (i=0; i<r.g; ++i) {
@@ -231,7 +233,7 @@ void importState(RunParameters &r) {
 
 void importEpitope(RunParameters &r) {
 
-    std::ifstream input(r.epitopeInfile.c_str());   // <infile>.st
+    std::ifstream input(r.epitopeInfile.c_str());   // <infile>.ep
     if (!input) { perror((std::string("ERROR in importEpitope: ") + r.epitopeInfile).c_str()); exit(1); }
 
     std::string readStr;
@@ -248,7 +250,7 @@ void importEpitope(RunParameters &r) {
 
         std::stringstream readStrStrm(std::string(readStr,pos0,posBar-pos0));
         while (readStrStrm >> word) {
-            std::cout << word << " ";
+            std::cout << word << " "; // XXX
             std::istringstream i(word);
             if (i >> site)
                 tmpEp.push_back(site);
@@ -260,11 +262,11 @@ void importEpitope(RunParameters &r) {
         tmpEp.clear();  // reset temp epitope
         readStrStrm.str("");  readStrStrm.clear();  // reset stream
 
-        std::cout << "| ";
+        std::cout << "| "; // XXX
 
         readStrStrm.str(std::string(readStr,posBar+1,posEnd/*-posBar-1*/));
         while (readStrStrm >> word) {
-            std::cout << word << " ";
+            std::cout << word << " "; // XXX
             std::istringstream i(word);
             if (i >> site)
                 tmpEp.push_back(site);
@@ -275,7 +277,7 @@ void importEpitope(RunParameters &r) {
 
         r.numEpitopes++;
 
-        std::cout << "\n";
+        std::cout << "\n"; // XXX
 
     }