- if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLookup[0]->getLabel()) != 1)) {
- cout << lastLookup[0]->getLabel() << '\t' << count << endl;
- processedLabels.insert(lastLookup[0]->getLabel());
- userLabels.erase(lastLookup[0]->getLabel());
-
- if (lastLookup.size() > 4) {
- cout << "Error: Too many groups chosen. You may use up to 4 groups with the venn command. I will use the first four groups in your groupfile." << endl;
- for (int i = lastLookup.size(); i > 4; i--) { lastLookup.pop_back(); } //no memmory leak because pop_back calls destructor
- }
- venn->getPic(lastLookup, vennCalculators);
+ if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ string saveLabel = lookup[0]->getLabel();
+
+ for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
+ lookup = input->getSharedRAbundVectors(lastLabel);
+
+ m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+ processedLabels.insert(lookup[0]->getLabel());
+ userLabels.erase(lookup[0]->getLabel());
+
+ if ((lookup.size() > 4) && (!perm)){
+ m->mothurOut("Error: Too many groups chosen. You may use up to 4 groups with the venn command. I will use the first four groups in your groupfile. If you set perm=t, I will find all possible combos of 4 groups."); m->mothurOutEndLine();
+ 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]); } }
+
+ }else if ((lookup.size() > 4) && (perm)) {
+ set< set<int> >::iterator it3;
+ set<int>::iterator it2;
+ for (it3 = combosOfFour.begin(); it3 != combosOfFour.end(); it3++) {
+
+ set<int> poss = *it3;
+ vector<SharedRAbundVector*> subset;
+ 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]); } }
+ }
+ }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]); } }
+ }
+
+ //restore real lastlabel to save below
+ lookup[0]->setLabel(saveLabel);