- out << "treatment\t";
- for (int i = 0; i < lookup.size(); i++) {
- string treatment = designMap->getGroup(lookup[i]->getGroup());
- if (treatment == "not found") {
- m->mothurOut("[ERROR]: " + lookup[i]->getGroup() + " is not in your design file, please correct.\n");
- }else { out << treatment << '\t'; }
+ if (categories.size() > 3) { m->mothurOut("\n[NOTE]: LEfSe input files allow for a class, subclass and subject. More than 3 categories can cause formatting errors.\n\n"); }
+
+ for (int j = 0; j < categories.size(); j++) {
+ out << categories[j] << "\t";
+ for (int i = 0; i < lookup.size()-1; i++) {
+ if (m->control_pressed) { out.close(); delete designMap; return 0; }
+ string value = designMap->get(lookup[i]->getGroup(), categories[j]);
+ if (value == "not found") {
+ m->mothurOut("[ERROR]: " + lookup[i]->getGroup() + " is not in your design file, please correct.\n"); m->control_pressed = true;
+ }else { out << value << '\t'; }
+ }
+ string value = designMap->get(lookup[lookup.size()-1]->getGroup(), categories[j]);
+ if (value == "not found") {
+ m->mothurOut("[ERROR]: " + lookup[lookup.size()-1]->getGroup() + " is not in your design file, please correct.\n"); m->control_pressed = true;
+ }else { out << value; }
+ out << endl;