X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readotucommand.cpp;h=8683fc3fa80154729ea5228fcaa38fb03726603a;hb=0e40e23448c2ee274268d85e0d0e65cb9eaeee6f;hp=5b9cde8c84b10e0d4f6dd938dbf68191000930f4;hpb=284fd95c611ccc3b1a7875c4dacfca06d1f50ed6;p=mothur.git diff --git a/readotucommand.cpp b/readotucommand.cpp index 5b9cde8..8683fc3 100644 --- a/readotucommand.cpp +++ b/readotucommand.cpp @@ -9,6 +9,55 @@ #include "readotucommand.h" +//********************************************************************************************************************** +vector ReadOtuCommand::getValidParameters(){ + try { + string Array[] = {"list","order","shared","relabund","label","group","sabund", "rabund","groups","ordergroup","outputdir","inputdir"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "ReadOtuCommand", "getValidParameters"); + exit(1); + } +} +//********************************************************************************************************************** +ReadOtuCommand::ReadOtuCommand(){ + try { + abort = true; + //initialize outputTypes + vector tempOutNames; + outputTypes["rabund"] = tempOutNames; + outputTypes["shared"] = tempOutNames; + } + catch(exception& e) { + m->errorOut(e, "ReadOtuCommand", "ReadOtuCommand"); + exit(1); + } +} +//********************************************************************************************************************** +vector ReadOtuCommand::getRequiredParameters(){ + try { + string Array[] = {"list","shared","relabund","sabund","rabund","or"}; + vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); + return myArray; + } + catch(exception& e) { + m->errorOut(e, "ChopSeqsCommand", "getRequiredParameters"); + exit(1); + } +} +//********************************************************************************************************************** +vector ReadOtuCommand::getRequiredFiles(){ + try { + vector myArray; + return myArray; + } + catch(exception& e) { + m->errorOut(e, "ReadOtuCommand", "getRequiredFiles"); + exit(1); + } +} //********************************************************************************************************************** ReadOtuCommand::ReadOtuCommand(string option) { try { @@ -34,7 +83,12 @@ ReadOtuCommand::ReadOtuCommand(string option) { for (it = parameters.begin(); it != parameters.end(); it++) { if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } - + + //initialize outputTypes + vector tempOutNames; + outputTypes["rabund"] = tempOutNames; + outputTypes["shared"] = tempOutNames; + globaldata->newRead(); //if the user changes the input directory command factory will send this info to us in the output parameter @@ -45,7 +99,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("list"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["list"] = inputDir + it->second; } } @@ -53,7 +107,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("order"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["order"] = inputDir + it->second; } } @@ -61,7 +115,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("shared"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["shared"] = inputDir + it->second; } } @@ -69,7 +123,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("group"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["group"] = inputDir + it->second; } } @@ -77,7 +131,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("sabund"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["sabund"] = inputDir + it->second; } } @@ -85,7 +139,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("rabund"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["rabund"] = inputDir + it->second; } } @@ -93,7 +147,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("ordergroup"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["ordergroup"] = inputDir + it->second; } } @@ -101,7 +155,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { it = parameters.find("relabund"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["relabund"] = inputDir + it->second; } } @@ -159,7 +213,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { groups = validParameter.validFile(parameters, "groups", false); if (groups == "not found") { groups = ""; } else { - splitAtDash(groups, Groups); + m->splitAtDash(groups, Groups); globaldata->Groups = Groups; } @@ -176,7 +230,7 @@ ReadOtuCommand::ReadOtuCommand(string option) { label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { - if(label != "all") { splitAtDash(label, labels); allLines = 0; } + if(label != "all") { m->splitAtDash(label, labels); allLines = 0; } else { allLines = 1; } globaldata->labels = labels; } @@ -255,6 +309,8 @@ int ReadOtuCommand::execute(){ //m->mothurOutEndLine(); } + outputTypes = shared->getOutputFiles(); + delete shared; } return 0;