//**********************************************************************************************************************
vector<string> ListOtuLabelsCommand::setParameters(){
try {
- CommandParameter pshared("shared", "InputTypes", "", "", "SharedRel", "SharedRel", "none",false,false); parameters.push_back(pshared);
- CommandParameter prelabund("relabund", "InputTypes", "", "", "SharedRel", "SharedRel", "none",false,false); parameters.push_back(prelabund);
- CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
- CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
+ CommandParameter pshared("shared", "InputTypes", "", "", "SharedRel", "SharedRel", "none","otulabels",false,false,true); parameters.push_back(pshared);
+ CommandParameter prelabund("relabund", "InputTypes", "", "", "SharedRel", "SharedRel", "none","otulabels",false,false); parameters.push_back(prelabund);
+ CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
+ CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
//every command must have inputdir and outputdir. This allows mothur users to redirect input and output files.
- CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
- CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+ 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); }
string ListOtuLabelsCommand::getHelpString(){
try {
string helpString = "";
- helpString += "The list.labels lists otu labels from shared or relabund file. The results can be used by the get.labels to select specific otus with the output from classify.otu, otu.association, or corr.axes.\n";
- helpString += "The list.labels parameters are: shared, relabund, label and groups.\n";
+ helpString += "The list.otulabels lists otu labels from shared or relabund file. The results can be used by the get.otulabels to select specific otus with the output from classify.otu, otu.association, or corr.axes.\n";
+ helpString += "The list.otulabels parameters are: shared, relabund, label and groups.\n";
helpString += "The label parameter is used to analyze specific labels in your input.\n";
helpString += "The groups parameter allows you to specify which of the groups you would like analyzed.\n";
- helpString += "The list.labels commmand should be in the following format: \n";
+ helpString += "The list.otulabels commmand should be in the following format: \n";
helpString += "list.otulabels(shared=yourSharedFile, groups=yourGroup1-yourGroup2)\n";
return helpString;
}
}
}
//**********************************************************************************************************************
+string ListOtuLabelsCommand::getOutputPattern(string type) {
+ try {
+ string pattern = "";
+
+ if (type == "otulabels") { pattern = "[filename],[distance],otulabels"; }
+ else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
+
+ return pattern;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ListOtuLabelsCommand", "getOutputPattern");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
ListOtuLabelsCommand::ListOtuLabelsCommand(){
try {
abort = true; calledHelp = true;
int ListOtuLabelsCommand::createList(vector<SharedRAbundVector*>& lookup){
try {
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(inputFileName)) + lookup[0]->getLabel() + ".otu.labels";
+ map<string, string> variables;
+ variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(inputFileName));
+ variables["[distance]"] = lookup[0]->getLabel();
+ string outputFileName = getOutputFileName("otulabels",variables);
outputNames.push_back(outputFileName); outputTypes["otulabels"].push_back(outputFileName);
ofstream out;
m->openOutputFile(outputFileName, out);
int ListOtuLabelsCommand::createList(vector<SharedRAbundFloatVector*>& lookup){
try {
-
- string outputFileName = outputDir + m->getRootName(m->getSimpleName(inputFileName)) + lookup[0]->getLabel() + ".otu.labels";
+ map<string, string> variables;
+ variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(inputFileName));
+ variables["[distance]"] = lookup[0]->getLabel();
+ string outputFileName = getOutputFileName("otulabels",variables);
outputNames.push_back(outputFileName); outputTypes["accnos"].push_back(outputFileName);
ofstream out;
m->openOutputFile(outputFileName, out);