+ if (inputFileNames.size() > 1) {
+ m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
+ }
+
+ ValidCalculators validCalculator;
+
+ for (int i=0; i<Estimators.size(); i++) {
+ if (validCalculator.isValidCalculator("single", Estimators[i]) == true) {
+ if (Estimators[i] == "sobs") {
+ cDisplays.push_back(new CollectDisplay(new Sobs(), new OneColumnFile(getOutputFileName("sobs", variables))));
+ outputNames.push_back(getOutputFileName("sobs", variables)); outputTypes["sobs"].push_back(getOutputFileName("sobs", variables));
+ }else if (Estimators[i] == "chao") {
+ cDisplays.push_back(new CollectDisplay(new Chao1(), new ThreeColumnFile(getOutputFileName("chao", variables))));
+ outputNames.push_back(getOutputFileName("chao", variables)); outputTypes["chao"].push_back(getOutputFileName("chao", variables));
+ }else if (Estimators[i] == "nseqs") {
+ cDisplays.push_back(new CollectDisplay(new NSeqs(), new OneColumnFile(getOutputFileName("nseqs", variables))));
+ outputNames.push_back(getOutputFileName("nseqs", variables)); outputTypes["nseqs"].push_back(getOutputFileName("nseqs", variables));
+ }else if (Estimators[i] == "coverage") {
+ cDisplays.push_back(new CollectDisplay(new Coverage(), new OneColumnFile(getOutputFileName("coverage", variables))));
+ outputNames.push_back(getOutputFileName("coverage", variables)); outputTypes["coverage"].push_back(getOutputFileName("coverage", variables));
+ }else if (Estimators[i] == "ace") {
+ cDisplays.push_back(new CollectDisplay(new Ace(abund), new ThreeColumnFile(getOutputFileName("ace", variables))));
+ outputNames.push_back(getOutputFileName("ace", variables)); outputTypes["ace"].push_back(getOutputFileName("ace", variables));
+ }else if (Estimators[i] == "jack") {
+ cDisplays.push_back(new CollectDisplay(new Jackknife(), new ThreeColumnFile(getOutputFileName("jack", variables))));
+ outputNames.push_back(getOutputFileName("jack", variables)); outputTypes["jack"].push_back(getOutputFileName("jack", variables));
+ }else if (Estimators[i] == "shannon") {
+ cDisplays.push_back(new CollectDisplay(new Shannon(), new ThreeColumnFile(getOutputFileName("shannon", variables))));
+ outputNames.push_back(getOutputFileName("shannon", variables)); outputTypes["shannon"].push_back(getOutputFileName("shannon", variables));
+ }else if (Estimators[i] == "shannoneven") {
+ cDisplays.push_back(new CollectDisplay(new ShannonEven(), new OneColumnFile(getOutputFileName("shannoneven", variables))));
+ outputNames.push_back(getOutputFileName("shannoneven", variables)); outputTypes["shannoneven"].push_back(getOutputFileName("shannoneven", variables));
+ }else if (Estimators[i] == "npshannon") {
+ cDisplays.push_back(new CollectDisplay(new NPShannon(), new OneColumnFile(getOutputFileName("npshannon", variables))));
+ outputNames.push_back(getOutputFileName("npshannon", variables)); outputTypes["npshannon"].push_back(getOutputFileName("npshannon", variables));
+ }else if (Estimators[i] == "heip") {
+ cDisplays.push_back(new CollectDisplay(new Heip(), new OneColumnFile(getOutputFileName("heip", variables))));
+ outputNames.push_back(getOutputFileName("heip", variables)); outputTypes["heip"].push_back(getOutputFileName("heip", variables));
+ }else if (Estimators[i] == "smithwilson") {
+ cDisplays.push_back(new CollectDisplay(new SmithWilson(), new OneColumnFile(getOutputFileName("smithwilson", variables))));
+ outputNames.push_back(getOutputFileName("smithwilson", variables)); outputTypes["smithwilson"].push_back(getOutputFileName("smithwilson", variables));
+ }else if (Estimators[i] == "simpson") {
+ cDisplays.push_back(new CollectDisplay(new Simpson(), new ThreeColumnFile(getOutputFileName("simpson", variables))));
+ outputNames.push_back(getOutputFileName("simpson", variables)); outputTypes["simpson"].push_back(getOutputFileName("simpson", variables));
+ }else if (Estimators[i] == "simpsoneven") {
+ cDisplays.push_back(new CollectDisplay(new SimpsonEven(), new OneColumnFile(getOutputFileName("simpsoneven", variables))));
+ outputNames.push_back(getOutputFileName("simpsoneven", variables)); outputTypes["simpsoneven"].push_back(getOutputFileName("simpsoneven", variables));
+ }else if (Estimators[i] == "invsimpson") {
+ cDisplays.push_back(new CollectDisplay(new InvSimpson(), new ThreeColumnFile(getOutputFileName("invsimpson", variables))));
+ outputNames.push_back(getOutputFileName("invsimpson", variables)); outputTypes["invsimpson"].push_back(getOutputFileName("invsimpson", variables));
+ }else if (Estimators[i] == "bootstrap") {
+ cDisplays.push_back(new CollectDisplay(new Bootstrap(), new OneColumnFile(getOutputFileName("bootstrap", variables))));
+ outputNames.push_back(getOutputFileName("bootstrap", variables)); outputTypes["bootstrap"].push_back(getOutputFileName("bootstrap", variables));
+ }else if (Estimators[i] == "geometric") {
+ cDisplays.push_back(new CollectDisplay(new Geom(), new OneColumnFile(getOutputFileName("geometric", variables))));
+ outputNames.push_back(getOutputFileName("geometric", variables)); outputTypes["geometric"].push_back(getOutputFileName("geometric", variables));
+ }else if (Estimators[i] == "qstat") {
+ cDisplays.push_back(new CollectDisplay(new QStat(), new OneColumnFile(getOutputFileName("qstat", variables))));
+ outputNames.push_back(getOutputFileName("qstat", variables)); outputTypes["qstat"].push_back(getOutputFileName("qstat", variables));
+ }else if (Estimators[i] == "logseries") {
+ cDisplays.push_back(new CollectDisplay(new LogSD(), new OneColumnFile(getOutputFileName("logseries", variables))));
+ outputNames.push_back(getOutputFileName("logseries", variables)); outputTypes["logseries"].push_back(getOutputFileName("logseries", variables));
+ }else if (Estimators[i] == "bergerparker") {
+ cDisplays.push_back(new CollectDisplay(new BergerParker(), new OneColumnFile(getOutputFileName("bergerparker", variables))));
+ outputNames.push_back(getOutputFileName("bergerparker", variables)); outputTypes["bergerparker"].push_back(getOutputFileName("bergerparker", variables));
+ }else if (Estimators[i] == "bstick") {
+ cDisplays.push_back(new CollectDisplay(new BStick(), new ThreeColumnFile(getOutputFileName("bstick", variables))));
+ outputNames.push_back(getOutputFileName("bstick", variables)); outputTypes["bstick"].push_back(getOutputFileName("bstick", variables));
+ }else if (Estimators[i] == "goodscoverage") {
+ cDisplays.push_back(new CollectDisplay(new GoodsCoverage(), new OneColumnFile(getOutputFileName("goodscoverage", variables))));
+ outputNames.push_back(getOutputFileName("goodscoverage", variables)); outputTypes["goodscoverage"].push_back(getOutputFileName("goodscoverage", variables));
+ }else if (Estimators[i] == "efron") {
+ cDisplays.push_back(new CollectDisplay(new Efron(size), new OneColumnFile(getOutputFileName("efron", variables))));
+ outputNames.push_back(getOutputFileName("efron", variables)); outputTypes["efron"].push_back(getOutputFileName("efron", variables));
+ }else if (Estimators[i] == "boneh") {
+ cDisplays.push_back(new CollectDisplay(new Boneh(size), new OneColumnFile(getOutputFileName("boneh", variables))));
+ outputNames.push_back(getOutputFileName("boneh", variables)); outputTypes["boneh"].push_back(getOutputFileName("boneh", variables));
+ }else if (Estimators[i] == "solow") {
+ cDisplays.push_back(new CollectDisplay(new Solow(size), new OneColumnFile(getOutputFileName("solow", variables))));
+ outputNames.push_back(getOutputFileName("solow", variables)); outputTypes["solow"].push_back(getOutputFileName("solow", variables));
+ }else if (Estimators[i] == "shen") {
+ cDisplays.push_back(new CollectDisplay(new Shen(size, abund), new OneColumnFile(getOutputFileName("shen", variables))));
+ outputNames.push_back(getOutputFileName("shen", variables)); outputTypes["shen"].push_back(getOutputFileName("shen", variables));
+ }
+ }
+ }
+
+ //if the users entered no valid calculators don't execute command
+ if (cDisplays.size() == 0) { return 0; }
+
+ input = new InputData(inputFileNames[p], format);
+ order = input->getOrderVector();
+ string lastLabel = order->getLabel();
+
+ //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
+ set<string> processedLabels;
+ set<string> userLabels = labels;
+
+ if (m->control_pressed) {
+ for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
+ delete input;
+ delete order;
+ m->clearGroups();
+ return 0;
+ }
+
+
+ while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+
+ if (m->control_pressed) {
+ for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
+ delete input;
+ delete order;
+ m->clearGroups();
+ return 0;
+ }
+
+
+ if(allLines == 1 || labels.count(order->getLabel()) == 1){
+
+ m->mothurOut(order->getLabel()); m->mothurOutEndLine();
+ cCurve = new Collect(order, cDisplays);
+ cCurve->getCurve(freq);
+ delete cCurve;
+
+ processedLabels.insert(order->getLabel());
+ userLabels.erase(order->getLabel());
+
+
+ }
+ //you have a label the user want that is smaller than this label and the last label has not already been processed
+ if ((m->anyLabelsToProcess(order->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ string saveLabel = order->getLabel();
+
+ delete order;
+ order = (input->getOrderVector(lastLabel));
+
+ m->mothurOut(order->getLabel()); m->mothurOutEndLine();
+ cCurve = new Collect(order, cDisplays);
+ cCurve->getCurve(freq);
+ delete cCurve;
+
+
+ processedLabels.insert(order->getLabel());
+ userLabels.erase(order->getLabel());
+
+ //restore real lastlabel to save below
+ order->setLabel(saveLabel);
+ }
+
+ lastLabel = order->getLabel();
+
+ delete order;
+ order = (input->getOrderVector());
+ }