+#include "reportfile.h"
+#include "qualityscores.h"
+#include "refchimeratest.h"
+#include "myPerseus.h"
+#include "filterseqscommand.h"
+
+
+//**********************************************************************************************************************
+
+vector<string> SeqErrorCommand::setParameters(){
+ try {
+ CommandParameter pquery("fasta", "InputTypes", "", "", "none", "none", "none","errorType",false,true,true); parameters.push_back(pquery);
+ CommandParameter preference("reference", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(preference);
+ CommandParameter pqfile("qfile", "InputTypes", "", "", "none", "none", "QualReport","",false,false); parameters.push_back(pqfile);
+ CommandParameter preport("report", "InputTypes", "", "", "none", "none", "QualReport","",false,false); parameters.push_back(preport);
+ CommandParameter pname("name", "InputTypes", "", "", "namecount", "none", "none","",false,false,true); parameters.push_back(pname);
+ CommandParameter pcount("count", "InputTypes", "", "", "namecount", "none", "none","",false,false,true); parameters.push_back(pcount);
+ CommandParameter pignorechimeras("ignorechimeras", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(pignorechimeras);
+ CommandParameter pthreshold("threshold", "Number", "", "1.0", "", "", "","",false,false); parameters.push_back(pthreshold);
+ CommandParameter paligned("aligned", "Boolean", "", "T", "", "", "","",false,false); parameters.push_back(paligned);
+ CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors);
+ CommandParameter psave("save", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(psave);
+ 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, "SeqErrorCommand", "setParameters");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+string SeqErrorCommand::getHelpString(){
+ try {
+ string helpString = "";
+ helpString += "The seq.error command reads a query alignment file and a reference alignment file and creates .....\n";
+ helpString += "The fasta parameter...\n";
+ helpString += "The reference parameter...\n";
+ helpString += "The qfile parameter...\n";
+ helpString += "The report parameter...\n";
+ helpString += "The name parameter allows you to provide a name file associated with the fasta file.\n";
+ helpString += "The count parameter allows you to provide a count file associated with the fasta file.\n";
+ helpString += "The ignorechimeras parameter...\n";
+ helpString += "The threshold parameter...\n";
+ helpString += "The processors parameter...\n";
+ helpString += "If the save parameter is set to true the reference sequences will be saved in memory, to clear them later you can use the clear.memory command. Default=f.";
+ helpString += "Example seq.error(...).\n";
+ helpString += "Note: No spaces between parameter labels (i.e. fasta), '=' and parameters (i.e.yourFasta).\n";
+ helpString += "For more details please check out the wiki http://www.mothur.org/wiki/seq.error .\n";
+ return helpString;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "getHelpString");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+string SeqErrorCommand::getOutputPattern(string type) {
+ try {
+ string pattern = "";
+
+ if (type == "errorsummary") { pattern = "[filename],error.summary"; }
+ else if (type == "errorseq") { pattern = "[filename],error.seq"; }
+ else if (type == "errorquality") { pattern = "[filename],error.quality"; }
+ else if (type == "errorqualforward") { pattern = "[filename],error.qual.forward"; }
+ else if (type == "errorqualreverse") { pattern = "[filename],error.qual.reverse"; }
+ else if (type == "errorforward") { pattern = "[filename],error.seq.forward"; }
+ else if (type == "errorreverse") { pattern = "[filename],error.seq.reverse"; }
+ else if (type == "errorcount") { pattern = "[filename],error.count"; }
+ else if (type == "errormatrix") { pattern = "[filename],error.matrix"; }
+ else if (type == "errorchimera") { pattern = "[filename],error.chimera"; }
+ else if (type == "errorref-query") { pattern = "[filename],error.ref-query"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
+
+ return pattern;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "getOutputPattern");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+
+SeqErrorCommand::SeqErrorCommand(){
+ try {
+ abort = true; calledHelp = true;
+ setParameters();
+ vector<string> tempOutNames;
+ outputTypes["errorsummary"] = tempOutNames;
+ outputTypes["errorseq"] = tempOutNames;
+ outputTypes["errorquality"] = tempOutNames;
+ outputTypes["errorqualforward"] = tempOutNames;
+ outputTypes["errorqualreverse"] = tempOutNames;
+ outputTypes["errorforward"] = tempOutNames;
+ outputTypes["errorreverse"] = tempOutNames;
+ outputTypes["errorcount"] = tempOutNames;
+ outputTypes["errormatrix"] = tempOutNames;
+ outputTypes["errorchimera"] = tempOutNames;
+ outputTypes["errorref-query"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "SeqErrorCommand");
+ exit(1);
+ }
+}