+ for (int p = 0; p < inputFileNames.size(); p++) {
+ if (inputFileNames.size() > 1) {
+ m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
+ }
+
+ InputData input(inputFileNames[p], "sabund");
+ SAbundVector* sabund = input.getSAbundVector();
+ string lastLabel = sabund->getLabel();
+
+ set<string> processedLabels;
+ set<string> userLabels = labels;
+
+ string summaryfilename = outputDir + m->getRootName(m->getSimpleName(inputFileNames[p])) + "catchall.summary";
+ summaryfilename = m->getFullPathName(summaryfilename);
+
+ if (m->debug) { m->mothurOut("[DEBUG]: Input File = " + inputFileNames[p] + ".\n [DEBUG]: inputdata address = " + toString(&input) + ".\n [DEBUG]: sabund address = " + toString(&sabund) + ".\n"); }
+
+ ofstream out;
+ m->openOutputFile(summaryfilename, out);
+
+ out << "label\tmodel\testimate\tlci\tuci" << endl;
+
+ if (m->debug) { string open = "no"; if (out.is_open()) { open = "yes"; } m->mothurOut("[DEBUG]: output stream is open = " + open + ".\n"); }
+
+ //for each label the user selected
+ while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+
+
+ if(allLines == 1 || labels.count(sabund->getLabel()) == 1){
+ m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
+
+ //create catchall input file from mothur's inputfile
+ string filename = process(sabund, inputFileNames[p]);
+ string outputPath = m->getPathName(filename);
+
+ //create system command
+ string catchAllCommand = "";
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+ catchAllCommand += catchAllCommandExe + filename + " " + outputPath + " 1";
+ #else
+ if (outputPath.length() > 0) { outputPath = outputPath.substr(0, outputPath.length()-1); }
+ catchAllCommand += catchAllCommandExe + "\"" + filename + "\" \"" + outputPath + "\" 1";
+ //wrap entire string in ""
+ catchAllCommand = "\"" + catchAllCommand + "\"";
+ #endif
+
+ if (m->debug) { m->mothurOut("[DEBUG]: catchall command = " + catchAllCommand + ". About to call system.\n"); }
+
+ //run catchall
+ system(catchAllCommand.c_str());
+
+ if (m->debug) { m->mothurOut("[DEBUG]: back from system call. Keeping file: " + filename + ".\n"); }
+
+ if (!m->debug) { m->mothurRemove(filename); }