+//**********************************************************************************************************************
+vector<string> SplitGroupCommand::setParameters(){
+ try {
+ CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta",false,true,true); parameters.push_back(pfasta);
+ CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname);
+ CommandParameter pcount("count", "InputTypes", "", "", "NameCount-CountGroup", "CountGroup", "none","count",false,false,true); parameters.push_back(pcount);
+ CommandParameter pgroup("group", "InputTypes", "", "", "CountGroup", "CountGroup", "none","group",false,false,true); parameters.push_back(pgroup);
+ CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
+ 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); }
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SplitGroupCommand", "setParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string SplitGroupCommand::getHelpString(){
+ try {
+ string helpString = "";
+ helpString += "The split.groups command reads a group or count file, and parses your fasta and names or count files by groups. \n";
+ helpString += "The split.groups command parameters are fasta, name, group, count and groups.\n";
+ helpString += "The fasta and group or count parameters are required.\n";
+ helpString += "The groups parameter allows you to select groups to create files for. \n";
+ helpString += "For example if you set groups=A-B-C, you will get a .A.fasta, .A.names, .B.fasta, .B.names, .C.fasta, .C.names files. \n";
+ helpString += "If you want .fasta and .names files for all groups, set groups=all. \n";
+ helpString += "The split.groups command should be used in the following format: split.group(fasta=yourFasta, group=yourGroupFile).\n";
+ helpString += "Example: split.groups(fasta=abrecovery.fasta, group=abrecovery.groups).\n";
+ helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
+ return helpString;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SplitGroupCommand", "getHelpString");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string SplitGroupCommand::getOutputPattern(string type) {
+ try {
+ string pattern = "";
+
+ if (type == "fasta") { pattern = "[filename],[group],fasta"; }
+ else if (type == "name") { pattern = "[filename],[group],names"; }
+ else if (type == "count") { pattern = "[filename],[group],count_table"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
+
+ return pattern;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SplitGroupCommand", "getOutputPattern");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+SplitGroupCommand::SplitGroupCommand(){
+ try {
+ abort = true; calledHelp = true;
+ setParameters();
+ vector<string> tempOutNames;
+ outputTypes["fasta"] = tempOutNames;
+ outputTypes["name"] = tempOutNames;
+ outputTypes["count"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SplitGroupCommand", "SplitGroupCommand");
+ exit(1);
+ }
+}