From: westcott Date: Mon, 11 Apr 2011 17:38:56 +0000 (+0000) Subject: 1.18.0 X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=9d6f36294dcaef3ac65a0e69fd8140077c3209e0 1.18.0 --- diff --git a/mothur.cpp b/mothur.cpp index 3e2a439..45be11d 100644 --- a/mothur.cpp +++ b/mothur.cpp @@ -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"); diff --git a/sensspeccommand.cpp b/sensspeccommand.cpp index c7f67b4..3eb422e 100644 --- a/sensspeccommand.cpp +++ b/sensspeccommand.cpp @@ -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) { diff --git a/setdircommand.cpp b/setdircommand.cpp index fc411ae..3135b81 100644 --- a/setdircommand.cpp +++ b/setdircommand.cpp @@ -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); } diff --git a/setlogfilecommand.h b/setlogfilecommand.h index 0c0347b..ed08180 100644 --- a/setlogfilecommand.h +++ b/setlogfilecommand.h @@ -19,7 +19,7 @@ class SetLogFileCommand : public Command { public: SetLogFileCommand(string); - SetLogFileCommand() { abort = true; calledHelp = true; } + SetLogFileCommand() { setParameters(); abort = true; calledHelp = true; } ~SetLogFileCommand(){} vector setParameters(); diff --git a/systemcommand.cpp b/systemcommand.cpp index 6b0a6d0..6a1e355 100644 --- a/systemcommand.cpp +++ b/systemcommand.cpp @@ -9,7 +9,20 @@ #include "systemcommand.h" - +//********************************************************************************************************************** +vector SystemCommand::setParameters(){ + try { + CommandParameter pcommand("command", "String", "", "", "", "", "",false,false); parameters.push_back(pcommand); + + vector 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 myArray = setParameters(); + + OptionParser parser(option); + map parameters = parser.getParameters(); + map::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(','); diff --git a/systemcommand.h b/systemcommand.h index 892ac96..8c959cf 100644 --- a/systemcommand.h +++ b/systemcommand.h @@ -18,10 +18,10 @@ class SystemCommand : public Command { public: SystemCommand(string); - SystemCommand() { abort = true; calledHelp = true; } + SystemCommand() { setParameters(); abort = true; calledHelp = true; } ~SystemCommand(){} - vector setParameters() { return outputNames; } //dummy does not do anything + vector setParameters(); string getCommandName() { return "system"; } string getCommandCategory() { return "General"; } string getHelpString();