]> git.donarmstrong.com Git - mothur.git/blobdiff - matrixoutputcommand.cpp
rewrote metastats command in c++, added mothurRemove function to handle ~ error....
[mothur.git] / matrixoutputcommand.cpp
index 9c7a83681bb8208d1317a629947a3078084a351e..35a45532dc64d8d11ab415e777b3afe67ae94057 100644 (file)
@@ -157,6 +157,7 @@ MatrixOutputCommand::MatrixOutputCommand(string option)  {
                                if (sharedfile != "") { m->mothurOut("Using " + sharedfile + " as input file for the shared parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current sharedfile and the shared parameter is required."); m->mothurOutEndLine(); abort = true; }
                        }else if (sharedfile == "not open") { sharedfile = ""; abort = true; }
+                       else { m->setSharedFile(sharedfile); }
                        
                        //if the user changes the output directory command factory will send this info to us in the output parameter 
                        outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
@@ -327,7 +328,6 @@ int MatrixOutputCommand::execute(){
                for (int i = 0; i < processors; i++) {
                        lines[i].start = int (sqrt(float(i)/float(processors)) * numGroups);
                        lines[i].end = int (sqrt(float(i+1)/float(processors)) * numGroups);
-                       cout << i << '\t' << lines[i].start << '\t' << lines[i].end << endl;
                }       
                
                if (m->control_pressed) { delete input; for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } m->Groups.clear(); return 0;  }
@@ -335,7 +335,7 @@ int MatrixOutputCommand::execute(){
                //as long as you are not at the end of the file or done wih the lines you want
                while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                
-                       if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } for (int i = 0; i < outputNames.size(); i++) {     remove(outputNames[i].c_str()); } m->Groups.clear(); return 0;  }
+                       if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } for (int i = 0; i < outputNames.size(); i++) {     m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0;  }
                
                        if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
                                m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
@@ -368,7 +368,7 @@ int MatrixOutputCommand::execute(){
                        lookup = input->getSharedRAbundVectors();
                }
                
-               if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) {     remove(outputNames[i].c_str()); } m->Groups.clear(); return 0;  }
+               if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) {     m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0;  }
 
                //output error messages about any remaining user labels
                set<string>::iterator it;
@@ -383,7 +383,7 @@ int MatrixOutputCommand::execute(){
                        }
                }
                
-               if (m->control_pressed) { outputTypes.clear(); delete input;  for (int i = 0; i < outputNames.size(); i++) {    remove(outputNames[i].c_str()); } m->Groups.clear(); return 0;  }
+               if (m->control_pressed) { outputTypes.clear(); delete input;  for (int i = 0; i < outputNames.size(); i++) {    m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0;  }
 
                //run last label if you need to
                if (needToRun == true)  {
@@ -395,7 +395,7 @@ int MatrixOutputCommand::execute(){
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                }
                
-               if (m->control_pressed) { outputTypes.clear();  delete input;  for (int i = 0; i < outputNames.size(); i++) {   remove(outputNames[i].c_str()); } m->Groups.clear(); return 0;  }
+               if (m->control_pressed) { outputTypes.clear();  delete input;  for (int i = 0; i < outputNames.size(); i++) {   m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0;  }
                
                //reset groups parameter
                m->Groups.clear();  
@@ -527,7 +527,7 @@ int MatrixOutputCommand::process(vector<SharedRAbundVector*> thisLookup){
                                        }
                                }
                                intemp.close();
-                               remove(tempdistFileName.c_str());
+                               m->mothurRemove(tempdistFileName);
                        }
                        
                }
@@ -598,7 +598,7 @@ int MatrixOutputCommand::driver(vector<SharedRAbundVector*> thisLookup, int star
                                                
                                                if (m->control_pressed) { return 1; }
                                                
-                                               seqDist temp(l, k, (1.0 - tempdata[0]));
+                                               seqDist temp(l, k, tempdata[0]);
                                                calcDists[i].push_back(temp);
                                        }
                                }