]> git.donarmstrong.com Git - mothur.git/blobdiff - bootstrapsharedcommand.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / bootstrapsharedcommand.cpp
index f63f2f496d05ac403cc7584db343067771e5ebb7..de9657420aabb0f8dd817a7bfe1fb4339bc3144e 100644 (file)
@@ -113,8 +113,13 @@ BootSharedCommand::BootSharedCommand(string option) {
                        }
                        
                        sharedfile = validParameter.validFile(parameters, "shared", true);
-                       if (sharedfile == "not found") { m->mothurOut("shared is a required parameter.");  m->mothurOutEndLine(); sharedfile = ""; abort = true; }
+                       if (sharedfile == "not found") { 
+                               sharedfile = m->getSharedFile(); 
+                               if (sharedfile != "") { m->mothurOut("Using " + sharedfile + " as input file for the shared parameter."); m->mothurOutEndLine(); }
+                               else {  m->mothurOut("You have no current shared file 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"){  
@@ -135,7 +140,7 @@ BootSharedCommand::BootSharedCommand(string option) {
                        if (groups == "not found") { groups = ""; }
                        else { 
                                m->splitAtDash(groups, Groups);
-                               m->Groups = Groups;
+                               m->setGroups(Groups);
                        }
                                
                        calc = validParameter.validFile(parameters, "calc", false);                     
@@ -152,7 +157,7 @@ BootSharedCommand::BootSharedCommand(string option) {
 
                        string temp;
                        temp = validParameter.validFile(parameters, "iters", false);  if (temp == "not found") { temp = "1000"; }
-                       convert(temp, iters); 
+                       m->mothurConvert(temp, iters); 
                                
                        if (abort == false) {
                        
@@ -251,13 +256,13 @@ int BootSharedCommand::execute(){
                globaldata->gTreemap = tmap;
                        
                while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
-                       if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input;delete util; return 0;      } 
+                       if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input;delete util; return 0;     } 
        
                        if(allLines == 1 || labels.count(order->getLabel()) == 1){                      
                                
                                m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                int error = process(order);
-                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input;delete util; return 0;      } 
+                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input;delete util; return 0;     } 
                                
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
@@ -271,7 +276,7 @@ int BootSharedCommand::execute(){
                                order = input->getSharedOrderVector(lastLabel);                                                                                                 
                                m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                int error = process(order);
-                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input;delete util; return 0;      } 
+                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input;delete util; return 0;     } 
 
                                processedLabels.insert(order->getLabel());
                                userLabels.erase(order->getLabel());
@@ -289,7 +294,7 @@ int BootSharedCommand::execute(){
                }
                
                
-               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input; delete util;  return 0;    } 
+               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input; delete util;  return 0;   } 
 
                //output error messages about any remaining user labels
                set<string>::iterator it;
@@ -304,7 +309,7 @@ int BootSharedCommand::execute(){
                        }
                }
                
-               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input; delete util; return 0;     } 
+               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input; delete util; return 0;    } 
 
                //run last line if you need to
                if (needToRun == true)  {
@@ -312,13 +317,13 @@ int BootSharedCommand::execute(){
                                order = input->getSharedOrderVector(lastLabel);                                                                                                 
                                m->mothurOut(order->getLabel()); m->mothurOutEndLine();
                                int error = process(order);
-                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear(); delete input; delete util; return 0;     } 
+                               if (error == 1) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear(); delete input; delete util; return 0;    } 
                                
                                delete order;
 
                }
                
-               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       remove(outputNames[i].c_str());  } globaldata->Groups.clear();delete input; delete util; return 0;      } 
+               if (m->control_pressed) {  for (int i = 0; i < outputNames.size(); i++) {       m->mothurRemove(outputNames[i]);  } globaldata->Groups.clear();delete input; delete util; return 0;     } 
 
                //reset groups parameter
                globaldata->Groups.clear();