]> git.donarmstrong.com Git - mothur.git/blobdiff - matrixoutputcommand.cpp
added sequence name to error string in fastq.info. Changed np_shannon to npshannon.
[mothur.git] / matrixoutputcommand.cpp
index 9c7a83681bb8208d1317a629947a3078084a351e..d1cf54ba03216996b3335e030e6db7d80efd7222 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"){  
@@ -180,12 +181,12 @@ MatrixOutputCommand::MatrixOutputCommand(string option)  {
                        if (groups == "not found") { groups = ""; }
                        else { 
                                m->splitAtDash(groups, Groups);
-                               m->Groups = Groups;
+                               m->setGroups(Groups);
                        }
                        
                        string temp = validParameter.validFile(parameters, "processors", false);        if (temp == "not found"){       temp = m->getProcessors();      }
                        m->setProcessors(temp);
-                       convert(temp, processors); 
+                       m->mothurConvert(temp, processors); 
                                
                        calc = validParameter.validFile(parameters, "calc", false);                     
                        if (calc == "not found") { calc = "jclass-thetayc";  }
@@ -327,15 +328,14 @@ 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;  }
+               if (m->control_pressed) { delete input; for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } m->clearGroups(); return 0;  }
                                
                //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->clearGroups(); 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->clearGroups(); 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->clearGroups(); return 0;  }
 
                //run last label if you need to
                if (needToRun == true)  {
@@ -395,10 +395,10 @@ 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->clearGroups(); return 0;  }
                
                //reset groups parameter
-               m->Groups.clear();  
+               m->clearGroups();  
                
                //set phylip file as new current phylipfile
                string current = "";
@@ -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);
                                        }
                                }