#include "nseqs.h"
+//**********************************************************************************************************************
+vector<string> VennCommand::getValidParameters(){
+ try {
+ string Array[] = {"groups","label","calc","permute", "abund","nseqs","outputdir","inputdir"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "VennCommand", "getValidParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+VennCommand::VennCommand(){
+ try {
+ abort = true; calledHelp = true;
+ vector<string> tempOutNames;
+ outputTypes["svg"] = tempOutNames;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "VennCommand", "VennCommand");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> VennCommand::getRequiredParameters(){
+ try {
+ vector<string> myArray;
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "VennCommand", "getRequiredParameters");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+vector<string> VennCommand::getRequiredFiles(){
+ try {
+ string Array[] = {"list","shared","or"};
+ vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ return myArray;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "VennCommand", "getRequiredFiles");
+ exit(1);
+ }
+}
//**********************************************************************************************************************
VennCommand::VennCommand(string option) {
try {
globaldata = GlobalData::getInstance();
- abort = false;
+ abort = false; calledHelp = false;
allLines = 1;
labels.clear();
//allow user to run help
- if(option == "help") { help(); abort = true; }
+ if(option == "help") { help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
int VennCommand::execute(){
try {
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
string lastLabel;
- vector<string> outputNames;
if (format == "sharedfile") {
//you have groups
for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}else if ((lookup.size() > 4) && (perm)) {
set< set<int> >::iterator it3;
for (it2 = poss.begin(); it2 != poss.end(); it2++) { subset.push_back(lookup[*it2]); }
vector<string> outfilenames = venn->getPic(subset, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
}else {
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
}
for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}else if ((lookup.size() > 4) && (perm)) {
set< set<int> >::iterator it3;
for (it2 = poss.begin(); it2 != poss.end(); it2++) { subset.push_back(lookup[*it2]); }
vector<string> outfilenames = venn->getPic(subset, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
}else {
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
//restore real lastlabel to save below
for (int i = lookup.size(); i > 4; i--) { lookup.pop_back(); } //no memmory leak because pop_back calls destructor
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}else if ((lookup.size() > 4) && (perm)) {
set< set<int> >::iterator it3;
for (it2 = poss.begin(); it2 != poss.end(); it2++) { subset.push_back(lookup[*it2]); }
vector<string> outfilenames = venn->getPic(subset, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
}else {
vector<string> outfilenames = venn->getPic(lookup, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
}
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
processedLabels.insert(sabund->getLabel());
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
processedLabels.insert(sabund->getLabel());
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
vector<string> outfilenames = venn->getPic(sabund, vennCalculators);
- for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); } }
+ for(int i = 0; i < outfilenames.size(); i++) { if (outfilenames[i] != "control" ) { outputNames.push_back(outfilenames[i]); outputTypes["svg"].push_back(outfilenames[i]); } }
delete sabund;