]> git.donarmstrong.com Git - mothur.git/commitdiff
1.18.0
authorwestcott <westcott>
Mon, 11 Apr 2011 17:38:56 +0000 (17:38 +0000)
committerwestcott <westcott>
Mon, 11 Apr 2011 17:38:56 +0000 (17:38 +0000)
mothur.cpp
sensspeccommand.cpp
setdircommand.cpp
setlogfilecommand.h
systemcommand.cpp
systemcommand.h

index 3e2a4397dd155f6969af09406d7f34d2999efebd..45be11d8adbb0a74fa5412298e803991f1877fd9 100644 (file)
@@ -168,7 +168,7 @@ int main(int argc, char *argv[]){
  
                if(argc>1){
                        input = argv[1];
-                       //m->mothurOut("input = " + input); m->mothurOutEndLine();
+                       m->mothurOut("input = " + input); m->mothurOutEndLine();
 
                        if (input[0] == '#') {
                                m->mothurOutJustToLog("Script Mode");
index c7f67b40b0e10ae14741600f9b8b3b8d7e0adaa2..3eb422e54c1943b71c59e719ce840cbf9675448a 100644 (file)
@@ -189,7 +189,7 @@ SensSpecCommand::SensSpecCommand(string option)  {
                        
                        lineLabel = validParameter.validFile(parameters, "label", false);       if (lineLabel == "not found") { lineLabel = ""; }
                        
-                       sensSpecFileName = listFile.substr(0,listFile.find_last_of('.')) + ".sensspec";
+                       sensSpecFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + ".sensspec";
                }
        }
        catch(exception& e) {
index fc411ae61120ae90c4efb396de928b028432965f..3135b8133c851e5fe58a13ee32e29da05da90216 100644 (file)
@@ -100,13 +100,15 @@ int SetDirectoryCommand::execute(){
                
                commandFactory = CommandFactory::getInstance();
                
+               m->mothurOut("Mothur's directories:"); m->mothurOutEndLine();
+               
                //redirect output
                if ((output == "clear") || (output == "")) {  output = "";  commandFactory->setOutputDirectory(output);  }
                else if (output == "default") { 
                        string exepath = m->argv;
                        output = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
+                       m->mothurOut("outputDir=" + output); m->mothurOutEndLine();  
                        commandFactory->setOutputDirectory(output);
                }else {
                        //add / to name if needed
@@ -127,7 +129,7 @@ int SetDirectoryCommand::execute(){
                        }else{
                                out.close();
                                remove(outTemp.c_str());
-                               m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
+                               m->mothurOut("outputDir=" + output); m->mothurOutEndLine();  
                                commandFactory->setOutputDirectory(output);
                        }
                }
@@ -138,7 +140,7 @@ int SetDirectoryCommand::execute(){
                        string exepath = m->argv;
                        input = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
+                       m->mothurOut("inputDir=" + input); m->mothurOutEndLine();  
                        commandFactory->setInputDirectory(input);
                }else {
                        //add / to name if needed
@@ -159,7 +161,7 @@ int SetDirectoryCommand::execute(){
                        }else{
                                in.close();
                                remove(inTemp.c_str());
-                               m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
+                               m->mothurOut("inputDir=" + input); m->mothurOutEndLine();  
                                commandFactory->setInputDirectory(input); 
                        }
                }
@@ -168,7 +170,7 @@ int SetDirectoryCommand::execute(){
                if (tempdefault == "clear") {  
                        #ifdef MOTHUR_FILES
                                string temp = MOTHUR_FILES; 
-                               m->mothurOut("Resetting default directory to " + temp); m->mothurOutEndLine();  
+                               m->mothurOut("tempDefault=" + temp); m->mothurOutEndLine();  
                                m->setDefaultPath(temp);
                        #else
                                string temp = ""; 
@@ -180,7 +182,7 @@ int SetDirectoryCommand::execute(){
                        string exepath = m->argv;
                        tempdefault = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine();  
+                       m->mothurOut("tempDefault=" + tempdefault); m->mothurOutEndLine();  
                        m->setDefaultPath(tempdefault);
                }else {
                        //add / to name if needed
@@ -191,7 +193,7 @@ int SetDirectoryCommand::execute(){
                                if (lastChar != "\\") { tempdefault += "\\"; }  
                        #endif
                        
-                       m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine();  
+                       m->mothurOut("tempDefault=" + tempdefault); m->mothurOutEndLine();  
                        m->setDefaultPath(tempdefault);
                }
 
index 0c0347b61ac7620e925c59717ee03085917a2688..ed08180c7a4429a5a484f143e84e42271e12be36 100644 (file)
@@ -19,7 +19,7 @@ class SetLogFileCommand : public Command {
        
 public:
        SetLogFileCommand(string);
-       SetLogFileCommand() { abort = true; calledHelp = true; }
+       SetLogFileCommand() { setParameters(); abort = true; calledHelp = true; }
        ~SetLogFileCommand(){}
        
        vector<string> setParameters();
index 6b0a6d06474809f16fae1a0c17338ef1f7458dc7..6a1e3555f80ffd3f6f5a1565296faf4072995629 100644 (file)
@@ -9,7 +9,20 @@
 
 #include "systemcommand.h"
 
-
+//**********************************************************************************************************************
+vector<string> SystemCommand::setParameters(){ 
+       try {
+               CommandParameter pcommand("command", "String", "", "", "", "", "",false,false); parameters.push_back(pcommand);
+                               
+               vector<string> myArray;
+               for (int i = 0; i < parameters.size(); i++) {   myArray.push_back(parameters[i].name);          }
+               return myArray;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SystemCommand", "setParameters");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 SystemCommand::SystemCommand(string option)  {
        try {
@@ -19,8 +32,22 @@ SystemCommand::SystemCommand(string option)  {
                if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
-                       if (option == "") { m->mothurOut("You must enter a command to run."); m->mothurOutEndLine(); abort = true; }
-                       else { 
+                       vector<string> myArray = setParameters();
+                       
+                       OptionParser parser(option);
+                       map<string, string> parameters = parser.getParameters();
+                       map<string, string>::iterator it;
+                       
+                       ValidParameters validParameter;
+                       
+                       //check for optional parameter and set defaults
+                       // ...at some point should added some additional type checking...
+                       string commandOption = validParameter.validFile(parameters, "command", false);                  
+                       if (commandOption == "not found") { commandOption = ""; }
+                       else { command = commandOption; }
+                       
+                       if ((option == "") && (commandOption == "")) { m->mothurOut("You must enter a command to run."); m->mothurOutEndLine(); abort = true; }
+                       else if (commandOption == "") { 
                                //check for outputdir and inputdir parameters
                                int commaPos = option.find_first_of(',');
                                
index 892ac96268baeb2557c51cc67dd0fc571ea4dbfa..8c959cfb52302df67651a4196ea533751ad596a1 100644 (file)
@@ -18,10 +18,10 @@ class SystemCommand : public Command {
        public:
        
                SystemCommand(string);  
-               SystemCommand() { abort = true; calledHelp = true; }
+               SystemCommand() { setParameters(); abort = true; calledHelp = true; }
                ~SystemCommand(){}
        
-               vector<string> setParameters() { return outputNames; } //dummy does not do anything
+               vector<string> setParameters();
                string getCommandName()                 { return "system";              }
                string getCommandCategory()             { return "General";             }
                string getHelpString();