+vector<string> PreClusterCommand::setParameters(){
+ try {
+ CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta-name",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", "none", "none","count",false,false,true); parameters.push_back(pcount);
+ CommandParameter pgroup("group", "InputTypes", "", "", "CountGroup", "none", "none","",false,false,true); parameters.push_back(pgroup);
+ CommandParameter pdiffs("diffs", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pdiffs);
+ CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors);
+ CommandParameter ptopdown("topdown", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(ptopdown);
+
+ 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, "PreClusterCommand", "setParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string PreClusterCommand::getHelpString(){
+ try {
+ string helpString = "";
+ helpString += "The pre.cluster command groups sequences that are within a given number of base mismatches.\n";
+ helpString += "The pre.cluster command outputs a new fasta and name file.\n";
+ helpString += "The pre.cluster command parameters are fasta, name, group, count, topdown, processors and diffs. The fasta parameter is required. \n";
+ helpString += "The name parameter allows you to give a list of seqs that are identical. This file is 2 columns, first column is name or representative sequence, second column is a list of its identical sequences separated by commas.\n";
+ helpString += "The group parameter allows you to provide a group file so you can cluster by group. \n";
+ helpString += "The count parameter allows you to provide a count file so you can cluster by group. \n";
+ helpString += "The diffs parameter allows you to specify maximum number of mismatched bases allowed between sequences in a grouping. The default is 1.\n";
+ helpString += "The topdown parameter allows you to specify whether to cluster from largest abundance to smallest or smallest to largest. Default=T, meaning largest to smallest.\n";
+ helpString += "The pre.cluster command should be in the following format: \n";
+ helpString += "pre.cluster(fasta=yourFastaFile, names=yourNamesFile, diffs=yourMaxDiffs) \n";
+ helpString += "Example pre.cluster(fasta=amazon.fasta, diffs=2).\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, "PreClusterCommand", "getHelpString");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string PreClusterCommand::getOutputPattern(string type) {
+ try {
+ string pattern = "";
+
+ if (type == "fasta") { pattern = "[filename],precluster,[extension]"; }
+ else if (type == "name") { pattern = "[filename],precluster.names"; }
+ else if (type == "count") { pattern = "[filename],precluster.count_table"; }
+ else if (type == "map") { pattern = "[filename],precluster.map"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
+
+ return pattern;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PreClusterCommand", "getOutputPattern");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+PreClusterCommand::PreClusterCommand(){
+ try {
+ abort = true; calledHelp = true;
+ setParameters();
+ vector<string> tempOutNames;
+ outputTypes["fasta"] = tempOutNames;
+ outputTypes["name"] = tempOutNames;
+ outputTypes["count"] = tempOutNames;
+ outputTypes["map"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PreClusterCommand", "PreClusterCommand");
+ exit(1);
+ }
+}