]> git.donarmstrong.com Git - mothur.git/blobdiff - getlabelcommand.cpp
bug fix to seq.error
[mothur.git] / getlabelcommand.cpp
index d306250f5b82b48cd6b353c4af0619907e2b9086..3191d5dda80670b8490203032e35170cf7642044 100644 (file)
@@ -9,15 +9,50 @@
 
 #include "getlabelcommand.h"
 
+//**********************************************************************************************************************
+vector<string> GetlabelCommand::getValidParameters(){  
+       try {
+               string Array[] =  {"outputdir","inputdir"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "GetlabelCommand", "getValidParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> GetlabelCommand::getRequiredParameters(){       
+       try {
+               vector<string> myArray;
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "GetlabelCommand", "getRequiredParameters");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
+vector<string> GetlabelCommand::getRequiredFiles(){    
+       try {
+               string Array[] =  {"list","rabund","sabund", "or"};
+               vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "GetlabelCommand", "getRequiredFiles");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 
 GetlabelCommand::GetlabelCommand(string option)  {
        try {
                globaldata = GlobalData::getInstance();
-               abort = false;
+               abort = false; calledHelp = false;   
                
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "")) { m->mothurOut("You must read a list, sabund or rabund before you can use the get.label command."); m->mothurOutEndLine(); abort = true; }                         
@@ -55,15 +90,18 @@ GetlabelCommand::~GetlabelCommand(){
 int GetlabelCommand::execute(){
        try {
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                filename = globaldata->inputFileName;
                ifstream in;
-               openInputFile(filename, in);
+               m->openInputFile(filename, in);
                string label;
                int numBins = 0;
                int count = -1;
                while(in.good()) {
+                       
+                       if (m->control_pressed) { in.close();  return 0; }
+                       
                        if(count > numBins)
                                count = 0;
                        if(count == 0) {