bool PipelineCommand::checkForValidAndRequiredParameters(string name, string options, map<string, vector<string> >& 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);
itMade = mothurMadeFiles.find(it->first);
if (itMade == mothurMadeFiles.end()) {
- m->mothurOut("You have the " + it->first + " listed as a mothurmade file for the " + name + " command, but it seems mothur will not make that file in your current pipeline, please correct."); m->mothurOutEndLine();
- return true;
+ if ((name == "align.seqs") && (it->first == "candidate")) {} //do nothing about candidate
+ else {
+ m->mothurOut("You have the " + it->first + " listed as a mothurmade file for the " + name + " command, but it seems mothur will not make that file in your current pipeline, please correct."); m->mothurOutEndLine();
+ return true;
+ }
}
}
}
}
}
//**********************************************************************************************************************
-bool PipelineCommand::fillInMothurMade(string& options, map<string, vector<string> > mothurMadeFiles){
+bool PipelineCommand::fillInMothurMade(string& options, map<string, vector<string> >& mothurMadeFiles){
try {
OptionParser parser(options);
map<string, string> parameters = parser.getParameters();
//fill in mothurmade filenames
for (it = parameters.begin(); it != parameters.end(); it++) {
- if (it->second == "mothurmade") {
- itMade = mothurMadeFiles.find(it->first);
+ string paraType = it->first;
+ string tempOption = it->second;
+
+ if (tempOption == "mothurmade") {
+
+ if (it->first == "candidate") { paraType = "fasta"; }
+
+ itMade = mothurMadeFiles.find(paraType);
if (itMade == mothurMadeFiles.end()) {
- m->mothurOut("Looking for a mothurmade " + it->first + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine();
+ m->mothurOut("Looking for a mothurmade " + paraType + " file, but it seems mothur has not made that file type in your current pipeline, please correct."); m->mothurOutEndLine();
return true;
}else{
vector<string> temp = itMade->second;
if (temp.size() > 1) {
//ask user which file to use
- m->mothurOut("More than one file has been created for the " + it->first + " parameter. "); m->mothurOutEndLine();
+ m->mothurOut("More than one file has been created for the " + paraType + " parameter. "); m->mothurOutEndLine();
for (int i = 0; i < temp.size(); i++) {
m->mothurOut(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;
if ((num < 0) || (num > (temp.size()-1))) { m->mothurOut("Not a valid response, quitting."); m->mothurOutEndLine(); return true; }
else {
- parameters[it->first] = temp[num];
+ tempOption = temp[num];
}
//clears buffer so next command doesn't have error
string s;
getline(cin, s);
+ vector<string> 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 " + it->first + " file, but it seems mothur doesn't have a filename."); m->mothurOutEndLine();
+ 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[it->first] = temp[0];
+ tempOption = temp[0];
}
}
}
- options += it->first + "=" + parameters[it->first] + ", ";
+ options += it->first + "=" + tempOption + ", ";
}
//rip off extra comma
//sff.info command
string thisCommand = "sffinfo(sff=" + sffFile + ")";
- //commands.push_back(thisCommand);
+ commands.push_back(thisCommand);
//trim.seqs command
string fastaFile = m->getRootName(m->getSimpleName(sffFile)) + "fasta";
string qualFile = m->getRootName(m->getSimpleName(sffFile)) + "qual";
- //thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=" + qualFile + ")";
- //commands.push_back(thisCommand);
+ thisCommand = "trim.seqs(processors=" + toString(processors) + ", fasta=" + fastaFile + ", allfiles=T, maxambig=0, maxhomop=8, flip=T, bdiffs=1, pdiffs=2, qwindowaverage=35, qwindowsize=50, oligos=" + oligosFile + ", qfile=" + qualFile + ")";
+ commands.push_back(thisCommand);
//unique.seqs
string groupFile = m->getRootName(m->getSimpleName(fastaFile)) + "groups";