+//**********************************************************************************************************************
+int RemoveGroupsCommand::readDesign(){
+ try {
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(designfile); }
+ string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(designfile)) + "pick" + m->getExtension(designfile);
+
+ ofstream out;
+ m->openOutputFile(outputFileName, out);
+
+ ifstream in;
+ m->openInputFile(designfile, in);
+ string name, group;
+
+ bool wroteSomething = false;
+ int removedCount = 0;
+
+ while(!in.eof()){
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
+
+ in >> name; //read from first column
+ in >> group; //read from second column
+
+ //if this name is in the accnos file
+ if (!(m->inUsersGroups(name, Groups))) {
+ wroteSomething = true;
+ out << name << '\t' << group << endl;
+ }else { removedCount++; }
+
+ m->gobble(in);
+ }
+ in.close();
+ out.close();
+
+ if (wroteSomething == false) { m->mothurOut("Your file contains only groups from the groups you wish to remove."); m->mothurOutEndLine(); }
+ outputTypes["design"].push_back(outputFileName); outputNames.push_back(outputFileName);
+
+ m->mothurOut("Removed " + toString(removedCount) + " groups from your design file."); m->mothurOutEndLine();
+
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "RemoveGroupsCommand", "readDesign");
+ exit(1);
+ }
+}
+