+ if (bygroup) {
+ //clear out old files
+ ofstream outFasta; m->openOutputFile(newFastaFile, outFasta); outFasta.close();
+ ofstream outNames; m->openOutputFile(newNamesFile, outNames); outNames.close();
+
+ //parse fasta and name file by group
+ SequenceParser* parser;
+ if (namefile != "") { parser = new SequenceParser(groupfile, fastafile, namefile); }
+ else { parser = new SequenceParser(groupfile, fastafile); }
+
+ vector<string> groups = parser->getNamesOfGroups();
+
+ //precluster each group
+ for (int i = 0; i < groups.size(); i++) {
+
+ start = time(NULL);
+
+ if (m->control_pressed) { delete parser; m->mothurRemove(newFastaFile); m->mothurRemove(newNamesFile); return 0; }
+
+ m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[i] + ":"); m->mothurOutEndLine();
+
+ map<string, string> thisNameMap;
+ if (namefile != "") { thisNameMap = parser->getNameMap(groups[i]); }
+ vector<Sequence> thisSeqs = parser->getSeqs(groups[i]);
+
+ //fill alignSeqs with this groups info.
+ int numSeqs = loadSeqs(thisNameMap, thisSeqs);
+
+ if (m->control_pressed) { delete parser; m->mothurRemove(newFastaFile); m->mothurRemove(newNamesFile); return 0; }
+
+ if (diffs > length) { m->mothurOut("Error: diffs is greater than your sequence length."); m->mothurOutEndLine(); return 0; }
+
+ int count = process();
+
+ if (m->control_pressed) { delete parser; m->mothurRemove(newFastaFile); m->mothurRemove(newNamesFile); return 0; }
+
+ m->mothurOut("Total number of sequences before precluster was " + toString(alignSeqs.size()) + "."); m->mothurOutEndLine();
+ m->mothurOut("pre.cluster removed " + toString(count) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
+ printData(newFastaFile, newNamesFile);
+
+ m->mothurOut("It took " + toString(time(NULL) - start) + " secs to cluster " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
+
+ }
+
+ delete parser;
+
+ //run unique.seqs for deconvolute results
+ string inputString = "fasta=" + newFastaFile;
+ if (namefile != "") { inputString += ", name=" + newNamesFile; }
+ m->mothurOutEndLine();
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+ m->mothurOut("Running command: unique.seqs(" + inputString + ")"); m->mothurOutEndLine();
+
+ Command* uniqueCommand = new DeconvoluteCommand(inputString);
+ uniqueCommand->execute();
+
+ map<string, vector<string> > filenames = uniqueCommand->getOutputFiles();
+
+ delete uniqueCommand;
+
+ m->mothurOut("/******************************************/"); m->mothurOutEndLine();
+
+ newNamesFile = filenames["name"][0];
+ newFastaFile = filenames["fasta"][0];
+
+ }else {
+ if (namefile != "") { readNameFile(); }