//**********************************************************************************************************************
vector<string> GetSAbundCommand::setParameters(){
try {
- CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(plist);
- CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(prabund);
- CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
- CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
- CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+ CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none","sabund",false,false, true); parameters.push_back(plist);
+ CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none","sabund",false,false, true); parameters.push_back(prabund);
+ CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
+ CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
+ CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
vector<string> myArray;
for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
exit(1);
}
}
-
+//**********************************************************************************************************************
+string GetSAbundCommand::getOutputPattern(string type) {
+ try {
+ string pattern = "";
+
+ if (type == "sabund") { pattern = "[filename],sabund"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
+
+ return pattern;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetRAbundCommand", "getOutputPattern");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
GetSAbundCommand::GetSAbundCommand(){
try {
try {
if (abort == true) { if (calledHelp) { return 0; } return 2; }
- filename = outputDir + m->getRootName(m->getSimpleName(inputfile)) + "sabund";
+ map<string, string> variables;
+ variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(inputfile));
+ filename = getOutputFileName("sabund", variables);
m->openOutputFile(filename, out);
input = new InputData(inputfile, format);
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
sabund->print(out);
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
sabund->print(out);
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
sabund->print(out);
delete sabund;
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete input; return 0; }
}
delete input;
m->mothurOutEndLine();
- m->mothurOut("Output File Name: "); m->mothurOutEndLine();
+ m->mothurOut("Output File Names: "); m->mothurOutEndLine();
m->mothurOut(filename); m->mothurOutEndLine(); outputNames.push_back(filename); outputTypes["sabund"].push_back(filename);
m->mothurOutEndLine();