+ }else{
+ setLines(fastaFile, lines);
+ if(qFileName == "") { qLines = lines; }
+
+ createProcessesCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames);
+
+ rename((trimSeqFile + toString(processIDS[0]) + ".temp").c_str(), trimSeqFile.c_str());
+ rename((scrapSeqFile + toString(processIDS[0]) + ".temp").c_str(), scrapSeqFile.c_str());
+ rename((groupFile + toString(processIDS[0]) + ".temp").c_str(), groupFile.c_str());
+
+ if(qFileName != ""){
+ rename((trimQualFile + toString(processIDS[0]) + ".temp").c_str(), trimQualFile.c_str());
+ rename((scrapQualFile + toString(processIDS[0]) + ".temp").c_str(), scrapQualFile.c_str());
+ }
+
+
+ for (int j = 0; j < fastaFileNames.size(); j++) {
+ rename((fastaFileNames[j] + toString(processIDS[0]) + ".temp").c_str(), fastaFileNames[j].c_str());
+ }
+ if(qFileName != ""){
+ for (int j = 0; j < qualFileNames.size(); j++) {
+ rename((qualFileNames[j] + toString(getpid()) + ".temp").c_str(), qualFileNames[j].c_str());
+ }
+ }
+
+ //append files
+ for(int i=1;i<processors;i++){
+ appendFiles((trimSeqFile + toString(processIDS[i]) + ".temp"), trimSeqFile);
+ remove((trimSeqFile + toString(processIDS[i]) + ".temp").c_str());
+ appendFiles((scrapSeqFile + toString(processIDS[i]) + ".temp"), scrapSeqFile);
+ remove((scrapSeqFile + toString(processIDS[i]) + ".temp").c_str());
+
+ appendFiles((trimQualFile + toString(processIDS[i]) + ".temp"), trimQualFile);
+ remove((trimQualFile + toString(processIDS[i]) + ".temp").c_str());
+ appendFiles((scrapQualFile + toString(processIDS[i]) + ".temp"), scrapQualFile);
+ remove((scrapQualFile + toString(processIDS[i]) + ".temp").c_str());
+
+ appendFiles((groupFile + toString(processIDS[i]) + ".temp"), groupFile);
+ remove((groupFile + toString(processIDS[i]) + ".temp").c_str());
+ for (int j = 0; j < fastaFileNames.size(); j++) {
+ appendFiles((fastaFileNames[j] + toString(processIDS[i]) + ".temp"), fastaFileNames[j]);
+ remove((fastaFileNames[j] + toString(processIDS[i]) + ".temp").c_str());
+ }
+
+ if(qFileName != ""){
+ for (int j = 0; j < qualFileNames.size(); j++) {
+ appendFiles((qualFileNames[j] + toString(processIDS[i]) + ".temp"), qualFileNames[j]);
+ remove((qualFileNames[j] + toString(processIDS[i]) + ".temp").c_str());
+ }
+ }
+
+
+ }
+ }
+
+ if (m->control_pressed) { return 0; }
+ #else
+ ifstream inFASTA;
+ int numSeqs;
+ openInputFile(fastaFile, inFASTA);
+ getNumSeqs(inFASTA, numSeqs);
+ inFASTA.close();
+
+ lines.push_back(new linePair(0, numSeqs));
+
+ driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], lines[0]);
+
+ for (int j = 0; j < fastaFileNames.size(); j++) {
+ rename((fastaFileNames[j] + toString(j) + ".temp").c_str(), fastaFileNames[j].c_str());
+ }
+ if(qFileName != ""){
+ for (int j = 0; j < qualFileNames.size(); j++) {
+ rename((qualFileNames[j] + toString(j) + ".temp").c_str(), qualFileNames[j].c_str());
+ }
+ }
+
+ if (m->control_pressed) { return 0; }
+ #endif
+
+
+ for(int i=0;i<fastaFileNames.size();i++){
+ if (isBlank(fastaFileNames[i])) { remove(fastaFileNames[i].c_str()); }
+ else if (filesToRemove.count(fastaFileNames[i]) > 0) { remove(fastaFileNames[i].c_str()); }
+ else {
+ ifstream inFASTA;
+ string seqName;
+ openInputFile(fastaFileNames[i], inFASTA);
+ ofstream outGroups;
+ string outGroupFilename = outputDir + getRootName(getSimpleName(fastaFileNames[i])) + "groups";
+ openOutputFile(outGroupFilename, outGroups);
+ outputNames.push_back(outGroupFilename);
+
+ string thisGroup = "";
+ if (i > comboStarts) {
+ map<string, int>::iterator itCombo;
+ for(itCombo=combos.begin();itCombo!=combos.end(); itCombo++){
+ if(itCombo->second == i){ thisGroup = itCombo->first; combos.erase(itCombo); break; }
+ }
+ }else{ thisGroup = groupVector[i]; }
+
+ while(!inFASTA.eof()){
+ if(inFASTA.get() == '>'){
+ inFASTA >> seqName;
+ outGroups << seqName << '\t' << thisGroup << endl;
+ }
+ while (!inFASTA.eof()) { char c = inFASTA.get(); if (c == 10 || c == 13){ break; } }
+ }
+ outGroups.close();
+ inFASTA.close();