]> git.donarmstrong.com Git - mothur.git/blobdiff - phylotypecommand.cpp
added checks for ^C to quit command instead of program
[mothur.git] / phylotypecommand.cpp
index e3b47d863f3803b4d6d1ae7355a863b540f776c5..410ada9e4ec921fd8f0ba3ddb5aa362fd0390995 100644 (file)
@@ -121,6 +121,8 @@ int PhylotypeCommand::execute(){
                //make it as long as the longest taxonomy in the file 
                TaxEqualizer* taxEqual = new TaxEqualizer(taxonomyFileName, cutoff);
                
+               if (m->control_pressed) { delete taxEqual; return 0; }
+               
                string equalizedTaxFile = taxEqual->getEqualizedTaxFile();
                
                delete taxEqual;
@@ -135,6 +137,8 @@ int PhylotypeCommand::execute(){
                bool done = false;
                if (tree->get(leaves[0]).parent == -1) {  m->mothurOut("Empty Tree"); m->mothurOutEndLine();    done = true;    }
                
+               if (m->control_pressed) { delete tree; return 0; }
+               
                string fileroot = outputDir + getRootName(getSimpleName(taxonomyFileName));
                
                ofstream outList;
@@ -158,6 +162,12 @@ int PhylotypeCommand::execute(){
                        string level = toString(count); 
                        count++;
                        
+                       if (m->control_pressed) { 
+                               outRabund.close(); outSabund.close(); outList.close();
+                               for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
+                               delete tree; return 0; 
+                       }
+                       
                        //is this a level the user want output for
                        if(allLines == 1 || labels.count(level) == 1){  
                                
@@ -216,6 +226,11 @@ int PhylotypeCommand::execute(){
                
                delete tree;
                
+               if (m->control_pressed) { 
+                       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
+                       return 0; 
+               }
+               
                m->mothurOutEndLine();
                m->mothurOut("Output File Names: "); m->mothurOutEndLine();
                for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }