]> git.donarmstrong.com Git - mothur.git/blobdiff - raredisplay.cpp
fixed xp user bug with rarefact commands and cluster error checking
[mothur.git] / raredisplay.cpp
index e2c75e9d0d78e11de49ad96e72d0455dc4f90a5c..3d50b2612f9c9cc8df9de5b48e5e55e260806fc6 100644 (file)
@@ -3,7 +3,7 @@
  *  Dotur
  *
  *  Created by Sarah Westcott on 11/18/08.
- *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *  Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
@@ -15,6 +15,7 @@ void RareDisplay::init(string label){
        try {
                this->label = label;
                if(nIters != 1){
+                       tempInFile.clear();
                        openOutputFile(tempOutName, tempOutFile);
                        openInputFile(tempInName, tempInFile);
                }
@@ -68,9 +69,9 @@ void RareDisplay::update(SAbundVector* rank){
 };
 
 /***********************************************************************/
-void RareDisplay::update(SharedRAbundVector* shared1, SharedRAbundVector* shared2, int numSeqs, int numGroupComb) {
+void RareDisplay::update(vector<SharedRAbundVector*> shared, int numSeqs, int numGroupComb) {
        try {
-               vector<double> data = estimate->getValues(shared1, shared2); 
+               vector<double> data = estimate->getValues(shared); 
                double newNSeqs = data[0];
                
                if(nIters != 1){
@@ -115,7 +116,10 @@ void RareDisplay::reset(){
                nIters++;
        
                remove(tempInName.c_str());
-               rename(tempOutName.c_str(), tempInName.c_str());        
+               renameOk = rename(tempOutName.c_str(), tempInName.c_str());     
+               
+               //checks to make sure user was able to rename and remove successfully
+               if (renameOk != 0) { cout << "Unable to rename the necessary temp files." << endl; }
        }
        catch(exception& e) {
                cout << "Standard Error: " << e.what() << " has occurred in the RareDisplay class Function reset. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
@@ -131,6 +135,7 @@ void RareDisplay::reset(){
 
 void RareDisplay::close(){
        try {
+               
                output->initFile(label);
        
                openInputFile(tempInName, tempInFile);
@@ -157,7 +162,7 @@ void RareDisplay::close(){
        
                remove(tempInName.c_str());
                remove(tempOutName.c_str());
-       
+               
                nIters = 1;
                output->resetFile();
        }