+ }
+
+ newNamesOutput.close();
+ return 0;
+
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetOTURepCommand", "process");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+int GetOTURepCommand::processNames(string filename, string label) {
+ try{
+
+ //create output file
+ if (outputDir == "") { outputDir += hasPath(listfile); }
+ string outputFileName = outputDir + getRootName(getSimpleName(listfile)) + label + ".rep.fasta";
+ openOutputFile(outputFileName, out);
+ vector<repStruct> reps;
+ outputNames.push_back(outputFileName);
+
+ ifstream in;
+ openInputFile(filename, in);
+
+ int i = 0;
+ while (!in.eof()) {
+ string rep, binnames;
+ in >> rep >> binnames; gobble(in);
+
+ vector<string> names;
+ splitAtComma(binnames, names);
+ int binsize = names.size();
+
+ //if you have a groupfile
+ string group = "";
+ if (groupfile != "") {
+ map<string, string> groups;
+ map<string, string>::iterator groupIt;
+
+ //find the groups that are in this bin
+ for (size_t i = 0; i < names.size(); i++) {
+ string groupName = groupMap->getGroup(names[i]);
+ if (groupName == "not found") {
+ m->mothurOut(names[i] + " is missing from your group file. Please correct. "); m->mothurOutEndLine();
+ groupError = true;
+ } else {
+ groups[groupName] = groupName;
+ }
+ }
+
+ //turn the groups into a string
+ for (groupIt = groups.begin(); groupIt != groups.end(); groupIt++) {
+ group += groupIt->first + "-";
+ }
+ //rip off last dash
+ group = group.substr(0, group.length()-1);
+ }else{ group = ""; }