X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=parselistscommand.cpp;h=61cb2454b52ee9e05cf1027995906371b5463762;hb=1a5c2356c1b955c6ec024b2baf9f46377ee7c72e;hp=bb096d8646873f74c42bd8970b9eef9693a3252e;hpb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;p=mothur.git diff --git a/parselistscommand.cpp b/parselistscommand.cpp index bb096d8..61cb245 100644 --- a/parselistscommand.cpp +++ b/parselistscommand.cpp @@ -12,11 +12,11 @@ //********************************************************************************************************************** vector ParseListCommand::setParameters(){ try { - CommandParameter plist("list", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(plist); - CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pgroup); - 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", "", "", "none", "none", "none","list",false,true,true); parameters.push_back(plist); + CommandParameter pgroup("group", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(pgroup); + 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 myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } @@ -46,6 +46,21 @@ string ParseListCommand::getHelpString(){ } } //********************************************************************************************************************** +string ParseListCommand::getOutputPattern(string type) { + try { + string pattern = ""; + + if (type == "list") { pattern = "[filename],[group],list"; } + else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; } + + return pattern; + } + catch(exception& e) { + m->errorOut(e, "ParseListCommand", "getOutputPattern"); + exit(1); + } +} +//********************************************************************************************************************** ParseListCommand::ParseListCommand(){ try { abort = true; calledHelp = true; @@ -170,7 +185,8 @@ int ParseListCommand::execute(){ if (abort == true) { if (calledHelp) { return 0; } return 2; } //set fileroot - string fileroot = outputDir + m->getRootName(m->getSimpleName(listfile)); + map variables; + variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(listfile)); //fill filehandles with neccessary ofstreams int i; @@ -180,7 +196,8 @@ int ParseListCommand::execute(){ temp = new ofstream; filehandles[gGroups[i]] = temp; - string filename = fileroot + gGroups[i] + ".list"; + variables["[group]"] = gGroups[i]; + string filename = getOutputFileName("list",variables); outputNames.push_back(filename); outputTypes["list"].push_back(filename); m->openOutputFile(filename, *temp); }