+//**********************************************************************************************************************
+vector<string> PCACommand::setParameters(){
+ try {
+ CommandParameter pshared("shared", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(pshared);
+ CommandParameter prelabund("relabund", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(prelabund);
+ CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
+ CommandParameter pmetric("metric", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(pmetric);
+ 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<string> myArray;
+ for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PCACommand", "setParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string PCACommand::getHelpString(){
+ try {
+ string helpString = "";
+ helpString += "The pca command parameters are shared, relabund, label, groups and metric. shared or relabund is required unless you have a valid current file.";
+ helpString += "The label parameter is used to analyze specific labels in your input. Default is the first label in your shared or relabund file. Multiple labels may be separated by dashes.\n";
+ helpString += "The groups parameter allows you to specify which groups you would like analyzed. Groupnames are separated by dashes.\n";
+ helpString += "The metric parameter allows you to indicate if would like the pearson correlation coefficient calculated. Default=True";
+ helpString += "Example pca(groups=yourGroups).\n";
+ helpString += "Example pca(groups=A-B-C).\n";
+ helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n";
+ return helpString;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PCACommand", "getHelpString");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+string PCACommand::getOutputFileNameTag(string type, string inputName=""){
+ try {
+ string outputFileName = "";
+ map<string, vector<string> >::iterator it;
+
+ //is this a type this command creates
+ it = outputTypes.find(type);
+ if (it == outputTypes.end()) { m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
+ else {
+ if (type == "pca") { outputFileName = "pca.axes"; }
+ else if (type == "loadings") { outputFileName = "pca.loadings"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; }
+ }
+ return outputFileName;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PCACommand", "getOutputFileNameTag");
+ exit(1);
+ }
+}
+
+//**********************************************************************************************************************
+PCACommand::PCACommand(){
+ try {
+ abort = true; calledHelp = true;
+ setParameters();
+ vector<string> tempOutNames;
+ outputTypes["pca"] = tempOutNames;
+ outputTypes["loadings"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "PCACommand", "PCACommand");
+ exit(1);
+ }
+}