X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=makelefsecommand.cpp;h=dd44249281fa90fa6d5c6dbefaa1380e5462a215;hp=8f2857e5e302b0587555a03e6a705082c47f9d45;hb=050a3ff02473a3d4c0980964e1a9ebe52e55d6b8;hpb=ad4f75fd7c938090d3b1ce4cfefcc21edf1869eb diff --git a/makelefsecommand.cpp b/makelefsecommand.cpp index 8f2857e..dd44249 100644 --- a/makelefsecommand.cpp +++ b/makelefsecommand.cpp @@ -7,6 +7,7 @@ // #include "makelefsecommand.h" +#include "designmap.h" //********************************************************************************************************************** vector MakeLefseCommand::setParameters(){ @@ -258,19 +259,22 @@ int MakeLefseCommand::runRelabund(map& consTax, vectoropenOutputFile(outputFile, out); - GroupMap* designMap = NULL; + DesignMap* designMap = NULL; if (designfile != "") { - designMap = new GroupMap(designfile); - designMap->readDesignMap(); + designMap = new DesignMap(designfile); + vector categories = designMap->getNamesOfCategories(); - 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'; } + for (int j = 0; j < categories.size(); j++) { + out << categories[j] << "\t"; + for (int i = 0; i < lookup.size(); 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'; } + } + out << endl; } - out << endl; } out << "group\t";