From: westcott Date: Mon, 25 Oct 2010 14:54:52 +0000 (+0000) Subject: added remove file option to pipeline command in user mode X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=fc9bc621a09de13eb76ca4f5cee930b03de43dcd added remove file option to pipeline command in user mode --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 2ef7f2b..4a328a3 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -1112,7 +1112,14 @@ }; buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "Mothur" */; compatibilityVersion = "Xcode 3.0"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 08FB7794FE84155DC02AAC07 /* mothur */; projectDirPath = ""; projectRoot = ""; diff --git a/mothur b/mothur index a29d1c9..1255e3a 100755 Binary files a/mothur and b/mothur differ diff --git a/pipelinepdscommand.cpp b/pipelinepdscommand.cpp index 2bbf223..d928122 100644 --- a/pipelinepdscommand.cpp +++ b/pipelinepdscommand.cpp @@ -356,6 +356,8 @@ bool PipelineCommand::parseCommand(string nextCommand, string& name, string& opt bool PipelineCommand::checkForValidAndRequiredParameters(string name, string options, map >& mothurMadeFiles){ try { + if (name == "system") { return false; } + //get shell of the command so we can check to make sure its valid without running it Command* command = cFactory->getCommand(name); @@ -528,7 +530,7 @@ int PipelineCommand::runUsersPipeline(){ } } //********************************************************************************************************************** -bool PipelineCommand::fillInMothurMade(string& options, map > mothurMadeFiles){ +bool PipelineCommand::fillInMothurMade(string& options, map >& mothurMadeFiles){ try { OptionParser parser(options); map parameters = parser.getParameters(); @@ -540,8 +542,9 @@ bool PipelineCommand::fillInMothurMade(string& options, mapfirst; + string tempOption = it->second; - if (it->second == "mothurmade") { + if (tempOption == "mothurmade") { if (it->first == "candidate") { paraType = "fasta"; } @@ -559,6 +562,7 @@ bool PipelineCommand::fillInMothurMade(string& options, mapmothurOut(toString(i) + " - " + temp[i]); m->mothurOutEndLine(); } + m->mothurOut("Please select the number of the file you would like to use: "); int num = 0; cin >> num; @@ -566,23 +570,43 @@ bool PipelineCommand::fillInMothurMade(string& options, map (temp.size()-1))) { m->mothurOut("Not a valid response, quitting."); m->mothurOutEndLine(); return true; } else { - parameters[paraType] = temp[num]; + tempOption = temp[num]; } //clears buffer so next command doesn't have error string s; getline(cin, s); + vector newTemp; + for (int i = 0; i < temp.size(); i++) { + if (i == num) { newTemp.push_back(temp[i]); } + else { + m->mothurOut("Would you like to remove " + temp[i] + " as an option for " + paraType + ", (y/n): "); m->mothurOutEndLine(); + string response; + cin >> response; + m->mothurOutJustToLog(response); m->mothurOutEndLine(); + + if (response == "n") { newTemp.push_back(temp[i]); } + + //clears buffer so next command doesn't have error + string s; + getline(cin, s); + } + } + + mothurMadeFiles[paraType] = newTemp; + + }else if (temp.size() == 0){ m->mothurOut("Sorry, we seem to think you created a " + paraType + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine(); return true; }else{ - parameters[paraType] = temp[0]; + tempOption = temp[0]; } } } - options += it->first + "=" + parameters[paraType] + ", "; + options += it->first + "=" + tempOption + ", "; } //rip off extra comma diff --git a/pipelinepdscommand.h b/pipelinepdscommand.h index 8a8a195..a506159 100644 --- a/pipelinepdscommand.h +++ b/pipelinepdscommand.h @@ -43,7 +43,7 @@ private: void createPatsPipeline(); bool parseCommand(string, string&, string&); bool checkForValidAndRequiredParameters(string, string, map >&); - bool fillInMothurMade(string&, map >); + bool fillInMothurMade(string&, map >&); }; /****************************************************/