From: westcott Date: Mon, 6 Dec 2010 22:35:06 +0000 (+0000) Subject: modified trim.seqs to speed up the append with multiple processors X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=3e2465c16d187247ce3befd29811c2d5dfc15ee8 modified trim.seqs to speed up the append with multiple processors --- diff --git a/helpcommand.cpp b/helpcommand.cpp index 24d587b..aeb7efc 100644 --- a/helpcommand.cpp +++ b/helpcommand.cpp @@ -62,6 +62,7 @@ int HelpCommand::execute(){ m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine(); m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n"); + return 0; } diff --git a/indicatorcommand.cpp b/indicatorcommand.cpp index 21c7032..9f96f35 100644 --- a/indicatorcommand.cpp +++ b/indicatorcommand.cpp @@ -301,8 +301,7 @@ int IndicatorCommand::GetIndicatorSpecies(Tree*& T){ ofstream out; m->openOutputFile(outputFileName, out); out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint); - out << "Node\tOTU#\tIndVal" << endl; - + string treeOutputDir = outputDir; if (outputDir == "") { treeOutputDir += m->hasPath(treefile); } string outputTreeFileName = treeOutputDir + m->getRootName(m->getSimpleName(treefile)) + "indicator.tre"; @@ -335,13 +334,6 @@ int IndicatorCommand::GetIndicatorSpecies(Tree*& T){ if (sharedfile != "") { vector< vector > groupings; - /*groupings.resize(1); - groupings[0].push_back(lookup[0]); - groupings[0].push_back(lookup[1]); - groupings[0].push_back(lookup[2]); - groupings[0].push_back(lookup[3]); - groupings[0].push_back(lookup[4]);*/ - //get nodes that will be a valid grouping //you are valid if you are not one of my descendants //AND your distToLeaf is <= mine @@ -444,15 +436,18 @@ int IndicatorCommand::GetIndicatorSpecies(Tree*& T){ if (m->control_pressed) { out.close(); return 0; } + /******************************************************/ //output indicator values to table form + label tree // /*****************************************************/ + out << (i+1) << '\t'; for (int j = 0; j < indicatorValues.size(); j++) { if (m->control_pressed) { out.close(); return 0; } - out << (i+1) << '\t' << (j+1) << '\t' << indicatorValues[j] << endl; + out << indicatorValues[j] << '\t'; } + out << endl; T->tree[i].setLabel((i+1)); @@ -587,14 +582,18 @@ map IndicatorCommand::getLengthToLeaf(Tree*& T){ try { map dists; + bool hasBranchLengths = false; + for (int i = 0; i < T->getNumNodes(); i++) { + if (T->tree[i].getBranchLength() > 0.0) { hasBranchLengths = true; break; } + } + for (int i = 0; i < T->getNumNodes(); i++) { int lc = T->tree[i].getLChild(); int rc = T->tree[i].getRChild(); //if you have no branch length, set it then calc - if (T->tree[i].getBranchLength() <= 0.0) { - + if (!hasBranchLengths) { if (lc == -1) { // you are a leaf //if you are a leaf set you priliminary length to 1.0, this may adjust later T->tree[i].setBranchLength(1.0); @@ -605,8 +604,8 @@ map IndicatorCommand::getLengthToLeaf(Tree*& T){ float rdist = dists[rc]; float greater = ldist; - if (rdist > greater) { greater = rdist; dists[i] = ldist; } - else { dists[i] = rdist; } + if (rdist > greater) { greater = rdist; dists[i] = ldist + 1.0; } + else { dists[i] = rdist + 1.0; } //branch length = difference + 1 T->tree[lc].setBranchLength((abs(ldist-greater) + 1.0)); diff --git a/mothur b/mothur index 3f9ed5f..a9d33c7 100755 Binary files a/mothur and b/mothur differ diff --git a/mothurout.cpp b/mothurout.cpp index e041582..eb452b1 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -1155,7 +1155,90 @@ vector > MothurOut::binomial(int maxOrder){ exit(1); } } - +/**************************************************************************************************/ +unsigned int MothurOut::fromBase36(string base36){ + try { + unsigned int num = 0; + + map converts; + converts['A'] = 0; + converts['a'] = 0; + converts['B'] = 1; + converts['b'] = 1; + converts['C'] = 2; + converts['c'] = 2; + converts['D'] = 3; + converts['d'] = 3; + converts['E'] = 4; + converts['e'] = 4; + converts['F'] = 5; + converts['f'] = 5; + converts['G'] = 6; + converts['g'] = 6; + converts['H'] = 7; + converts['h'] = 7; + converts['I'] = 8; + converts['i'] = 8; + converts['J'] = 9; + converts['j'] = 9; + converts['K'] = 10; + converts['k'] = 10; + converts['L'] = 11; + converts['l'] = 11; + converts['M'] = 12; + converts['m'] = 12; + converts['N'] = 13; + converts['n'] = 13; + converts['O'] = 14; + converts['o'] = 14; + converts['P'] = 15; + converts['p'] = 15; + converts['Q'] = 16; + converts['q'] = 16; + converts['R'] = 17; + converts['r'] = 17; + converts['S'] = 18; + converts['s'] = 18; + converts['T'] = 19; + converts['t'] = 19; + converts['U'] = 20; + converts['u'] = 20; + converts['V'] = 21; + converts['v'] = 21; + converts['W'] = 22; + converts['w'] = 22; + converts['X'] = 23; + converts['x'] = 23; + converts['Y'] = 24; + converts['y'] = 24; + converts['Z'] = 25; + converts['z'] = 25; + converts['0'] = 26; + converts['1'] = 27; + converts['2'] = 28; + converts['3'] = 29; + converts['4'] = 30; + converts['5'] = 31; + converts['6'] = 32; + converts['7'] = 33; + converts['8'] = 34; + converts['9'] = 35; + + int i = 0; + while (i < base36.length()) { + char c = base36[i]; + num = 36 * num + converts[c]; + i++; + } + + return num; + + } + catch(exception& e) { + errorOut(e, "MothurOut", "fromBase36"); + exit(1); + } +} /***********************************************************************/ int MothurOut::factorial(int num){ diff --git a/mothurout.h b/mothurout.h index efe1294..a1d9506 100644 --- a/mothurout.h +++ b/mothurout.h @@ -85,6 +85,7 @@ class MothurOut { vector > binomial(int); float ceilDist(float, int); float roundDist(float, int); + unsigned int fromBase36(string); int control_pressed; bool executing; diff --git a/sffinfocommand.cpp b/sffinfocommand.cpp index d0ec9e2..66409e8 100644 --- a/sffinfocommand.cpp +++ b/sffinfocommand.cpp @@ -515,6 +515,9 @@ int SffInfoCommand::readHeader(ifstream& in, Header& header){ if (header.name.length() > header.nameLength) { header.name = header.name.substr(0, header.nameLength); } delete[] tempBuffer; + //extract info from name + decodeName(header.timestamp, header.region, header.xy, header.name); + /* Pad to 8 chars */ unsigned long int spotInFile = in.tellg(); unsigned long int spot = (spotInFile + 7)& ~7; @@ -585,6 +588,43 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, i } } //********************************************************************************************************************** +int SffInfoCommand::decodeName(string& timestamp, string& region, string& xy, string name) { + try { + + string time = name.substr(0, 6); + unsigned int timeNum = m->fromBase36(time); + + int q1 = timeNum / 60; + int sec = timeNum - 60 * q1; + int q2 = q1 / 60; + int minute = q1 - 60 * q2; + int q3 = q2 / 24; + int hr = q2 - 24 * q3; + int q4 = q3 / 32; + int day = q3 - 32 * q4; + int q5 = q4 / 13; + int mon = q4 - 13 * q5; + int year = 2000 + q5; + + timestamp = toString(year) + "_" + toString(mon) + "_" + toString(day) + "_" + toString(hr) + "_" + toString(minute) + "_" + toString(sec); + + region = name.substr(7, 2); + + string xyNum = name.substr(9); + unsigned int myXy = m->fromBase36(xyNum); + int x = myXy >> 12; + int y = myXy & 4095; + + xy = toString(x) + "_" + toString(y); + + return 0; + } + catch(exception& e) { + m->errorOut(e, "SffInfoCommand", "decodeName"); + exit(1); + } +} +//********************************************************************************************************************** int SffInfoCommand::printCommonHeader(ofstream& out, CommonHeader& header) { try { @@ -612,9 +652,9 @@ int SffInfoCommand::printHeader(ofstream& out, Header& header) { try { out << ">" << header.name << endl; - out << "Run Prefix: " << endl; - out << "Region #: " << endl; - out << "XY Location: " << endl << endl; + out << "Run Prefix: " << header.timestamp << endl; + out << "Region #: " << header.region << endl; + out << "XY Location: " << header.xy << endl << endl; out << "Run Name: " << endl; out << "Analysis Name: " << endl; @@ -693,7 +733,7 @@ int SffInfoCommand::printFastaSeqData(ofstream& out, seqRead& read, Header& head } } - out << ">" << header.name << endl; + out << ">" << header.name << " xy=" << header.xy << endl; out << seq << endl; return 0; @@ -713,15 +753,15 @@ int SffInfoCommand::printQualSeqData(ofstream& out, seqRead& read, Header& heade out << "0\t0\t0\t0"; } else if((header.clipQualRight != 0) && ((header.clipQualRight-header.clipQualLeft) >= 0)){ - out << ">" << header.name << " length=" << (header.clipQualRight-header.clipQualLeft) << endl; + out << ">" << header.name << " xy=" << header.xy << " length=" << (header.clipQualRight-header.clipQualLeft) << endl; for (int i = (header.clipQualLeft-1); i < (header.clipQualRight-1); i++) { out << read.qualScores[i] << '\t'; } } else{ - out << ">" << header.name << " length=" << (header.clipQualRight-header.clipQualLeft) << endl; + out << ">" << header.name << " xy=" << header.xy << " length=" << (header.clipQualRight-header.clipQualLeft) << endl; for (int i = (header.clipQualLeft-1); i < read.qualScores.size(); i++) { out << read.qualScores[i] << '\t'; } } }else{ - out << ">" << header.name << " length=" << read.qualScores.size() << endl; + out << ">" << header.name << " xy=" << header.xy << " length=" << read.qualScores.size() << endl; for (int i = 0; i < read.qualScores.size(); i++) { out << read.qualScores[i] << '\t'; } } @@ -739,7 +779,7 @@ int SffInfoCommand::printQualSeqData(ofstream& out, seqRead& read, Header& heade int SffInfoCommand::printFlowSeqData(ofstream& out, seqRead& read, Header& header) { try { - out << ">" << header.name << endl; + out << ">" << header.name << " xy=" << header.xy << endl; for (int i = 0; i < read.flowgram.size(); i++) { out << setprecision(2) << (read.flowgram[i]/(float)100) << '\t'; } out << endl; diff --git a/sffinfocommand.h b/sffinfocommand.h index 7cf357e..d8eb853 100644 --- a/sffinfocommand.h +++ b/sffinfocommand.h @@ -40,6 +40,9 @@ struct Header { unsigned short clipAdapterLeft; unsigned short clipAdapterRight; string name; //length depends on nameLength + string timestamp; + string region; + string xy; Header() { headerLength=0; nameLength=0; numBases=0; clipQualLeft=0; clipQualRight=0; clipAdapterLeft=0; clipAdapterRight=0; } ~Header() { } @@ -80,6 +83,7 @@ private: int readCommonHeader(ifstream&, CommonHeader&); int readHeader(ifstream&, Header&); int readSeqData(ifstream&, seqRead&, int, int); + int decodeName(string&, string&, string&, string); int printCommonHeader(ofstream&, CommonHeader&); int printHeader(ofstream&, Header&); diff --git a/tree.cpp b/tree.cpp index 114b4de..c67f03d 100644 --- a/tree.cpp +++ b/tree.cpp @@ -420,6 +420,10 @@ int Tree::populateNewTree(vector& oldtree, int node, int& index) { tree[rc].setParent(index); tree[lc].setParent(index); + tree[index].setBranchLength(oldtree[node].getBranchLength()); + tree[rc].setBranchLength(oldtree[oldtree[node].getLChild()].getBranchLength()); + tree[lc].setBranchLength(oldtree[oldtree[node].getRChild()].getBranchLength()); + return (index++); }else { //you are a leaf int indexInNewTree = globaldata->gTreemap->getIndex(oldtree[node].getName()); diff --git a/trimseqscommand.cpp b/trimseqscommand.cpp index a09e402..fce4763 100644 --- a/trimseqscommand.cpp +++ b/trimseqscommand.cpp @@ -337,7 +337,7 @@ int TrimSeqsCommand::execute(){ outputNames.push_back(groupFile); outputTypes["group"].push_back(groupFile); getOligos(fastaFileNames, qualFileNames); } - + cout << fastaFileNames.size() << '\t' << qualFileNames.size() << endl; vector fastaFilePos; vector qFilePos; @@ -351,90 +351,21 @@ int TrimSeqsCommand::execute(){ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) if(processors == 1){ - driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qLines[0]); - - for (int j = 0; j < fastaFileNames.size(); j++) { - rename((fastaFileNames[j] + toString(getpid()) + ".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()); - } - } - }else{ 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;iappendFiles((trimSeqFile + toString(processIDS[i]) + ".temp"), trimSeqFile); - remove((trimSeqFile + toString(processIDS[i]) + ".temp").c_str()); - m->appendFiles((scrapSeqFile + toString(processIDS[i]) + ".temp"), scrapSeqFile); - remove((scrapSeqFile + toString(processIDS[i]) + ".temp").c_str()); - - m->appendFiles((trimQualFile + toString(processIDS[i]) + ".temp"), trimQualFile); - remove((trimQualFile + toString(processIDS[i]) + ".temp").c_str()); - m->appendFiles((scrapQualFile + toString(processIDS[i]) + ".temp"), scrapQualFile); - remove((scrapQualFile + toString(processIDS[i]) + ".temp").c_str()); - - m->appendFiles((groupFile + toString(processIDS[i]) + ".temp"), groupFile); - remove((groupFile + toString(processIDS[i]) + ".temp").c_str()); - for (int j = 0; j < fastaFileNames.size(); j++) { - m->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++) { - m->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 driverCreateTrim(fastaFile, qFileName, trimSeqFile, scrapSeqFile, trimQualFile, scrapQualFile, groupFile, fastaFileNames, qualFileNames, lines[0], qLines[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 - - + + if (m->control_pressed) { return 0; } + cout << "done with driver " << endl; for(int i=0;iisBlank(fastaFileNames[i])) { remove(fastaFileNames[i].c_str()); } - else if (filesToRemove.count(fastaFileNames[i]) > 0) { remove(fastaFileNames[i].c_str()); } + cout << fastaFileNames[i] << endl; + + if (m->isBlank(fastaFileNames[i])) { cout << fastaFileNames[i] << " was blank" << endl; remove(fastaFileNames[i].c_str()); } + else if (filesToRemove.count(fastaFileNames[i]) > 0) { cout << fastaFileNames[i] << " was on the remove list" << endl; remove(fastaFileNames[i].c_str()); } else { ifstream inFASTA; string seqName; @@ -451,7 +382,7 @@ int TrimSeqsCommand::execute(){ if(itCombo->second == i){ thisGroup = itCombo->first; combos.erase(itCombo); break; } } }else{ thisGroup = groupVector[i]; } - + cout << thisGroup << '\t' << i << '\t' << comboStarts << endl; while(!inFASTA.eof()){ if(inFASTA.get() == '>'){ inFASTA >> seqName; @@ -463,11 +394,12 @@ int TrimSeqsCommand::execute(){ inFASTA.close(); } } - + cout << "done with fastaFileNames " << endl; if(qFileName != ""){ for(int i=0;iisBlank(qualFileNames[i])) { remove(qualFileNames[i].c_str()); } - else if (filesToRemove.count(qualFileNames[i]) > 0) { remove(qualFileNames[i].c_str()); } + cout << qualFileNames[i] << endl; + if (m->isBlank(qualFileNames[i])) { cout << qualFileNames[i] << " was blank" << endl; remove(qualFileNames[i].c_str()); } + else if (filesToRemove.count(qualFileNames[i]) > 0) { cout << qualFileNames[i] << " was on the remove list" << endl; remove(qualFileNames[i].c_str()); } else { ifstream inQual; string seqName; @@ -487,7 +419,7 @@ int TrimSeqsCommand::execute(){ } } } - + cout << "done with qualFileNames " << endl; if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } @@ -533,38 +465,6 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string if (oligoFile != "") { m->openOutputFile(groupFile, outGroups); - for (int i = 0; i < fastaNames.size(); i++) { - - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - fastaNames[i] = (fastaNames[i] + toString(getpid()) + ".temp"); - //fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(getpid()) + ".temp").c_str(), ios::ate)); - //clear old file if it exists - ofstream temp; - m->openOutputFile(fastaNames[i], temp); - temp.close(); - if(qFileName != ""){ - qualNames[i] = (qualNames[i] + toString(getpid()) + ".temp"); - //qualFileNames.push_back(new ofstream((qualNames[i] + toString(getpid()) + ".temp").c_str(), ios::ate)); - //clear old file if it exists - ofstream temp2; - m->openOutputFile(qualNames[i], temp2); - temp2.close(); - } - #else - //fastaFileNames.push_back(new ofstream((fastaNames[i] + toString(i) + ".temp").c_str(), ios::ate)); - fastaNames[i] = (fastaNames[i] + toString(i) + ".temp"); - ofstream temp; - m->openOutputFile(fastaNames[i], temp); - temp.close(); - if(qFileName != ""){ - //qualFileNames.push_back(new ofstream((qualNames[i] + toString(i) + ".temp").c_str(), ios::ate)); - qualNames[i] = (qualNames[i] + toString(i) + ".temp"); - ofstream temp2; - m->openOutputFile(qualNames[i], temp2); - temp2.close(); - } - #endif - } } ifstream inFASTA; @@ -582,12 +482,9 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string if (m->control_pressed) { inFASTA.close(); outFASTA.close(); scrapFASTA.close(); if (oligoFile != "") { outGroups.close(); } - - //for(int i=0;iclose(); delete fastaFileNames[i]; } if(qFileName != ""){ qFile.close(); - //for(int i=0;iclose(); delete qualFileNames[i]; } } for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } @@ -747,18 +644,6 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string if (oligoFile != "") { outGroups.close(); } if(qFileName != "") { qFile.close(); scrapQual.close(); outQual.close(); } - //for(int i=0;iclose(); - // delete fastaFileNames[i]; - //} - - //if(qFileName != ""){ - //for(int i=0;iclose(); - //delete qualFileNames[i]; - //} - //} - return count; } catch(exception& e) { @@ -772,7 +657,7 @@ int TrimSeqsCommand::driverCreateTrim(string filename, string qFileName, string int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName, string trimFile, string scrapFile, string trimQFile, string scrapQFile, string groupFile, vector fastaNames, vector qualNames) { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - int process = 0; + int process = 1; int exitCommand = 1; processIDS.clear(); @@ -784,6 +669,21 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later process++; }else if (pid == 0){ + for (int i = 0; i < fastaNames.size(); i++) { + fastaNames[i] = (fastaNames[i] + toString(getpid()) + ".temp"); + //clear old file if it exists + ofstream temp; + m->openOutputFile(fastaNames[i], temp); + temp.close(); + if(qFileName != ""){ + qualNames[i] = (qualNames[i] + toString(getpid()) + ".temp"); + //clear old file if it exists + ofstream temp2; + m->openOutputFile(qualNames[i], temp2); + temp2.close(); + } + } + driverCreateTrim(filename, qFileName, (trimFile + toString(getpid()) + ".temp"), (scrapFile + toString(getpid()) + ".temp"), (trimQFile + toString(getpid()) + ".temp"), (scrapQFile + toString(getpid()) + ".temp"), (groupFile + toString(getpid()) + ".temp"), fastaNames, qualNames, lines[process], qLines[process]); exit(0); }else { @@ -793,12 +693,69 @@ int TrimSeqsCommand::createProcessesCreateTrim(string filename, string qFileName } } + //parent do my part + for (int i = 0; i < fastaNames.size(); i++) { + //clear old file if it exists + ofstream temp; + m->openOutputFile(fastaNames[i], temp); + temp.close(); + if(qFileName != ""){ + //clear old file if it exists + ofstream temp2; + m->openOutputFile(qualNames[i], temp2); + temp2.close(); + } + } + + driverCreateTrim(filename, qFileName, trimFile, scrapFile, trimQFile, scrapQFile, groupFile, fastaNames, qualNames, lines[0], qLines[0]); + + //force parent to wait until all the processes are done - for (int i=0;imothurOut("Appending files from process " + processIDS[i]); m->mothurOutEndLine(); + + m->appendFiles((trimFile + toString(processIDS[i]) + ".temp"), trimFile); + remove((trimFile + toString(processIDS[i]) + ".temp").c_str()); + m->appendFiles((scrapFile + toString(processIDS[i]) + ".temp"), scrapFile); + remove((scrapFile + toString(processIDS[i]) + ".temp").c_str()); + + m->mothurOut("Done with fasta files"); m->mothurOutEndLine(); + + if(qFileName != ""){ + m->appendFiles((trimQFile + toString(processIDS[i]) + ".temp"), trimQFile); + remove((trimQFile + toString(processIDS[i]) + ".temp").c_str()); + m->appendFiles((scrapQFile + toString(processIDS[i]) + ".temp"), scrapQFile); + remove((scrapQFile + toString(processIDS[i]) + ".temp").c_str()); + + m->mothurOut("Done with quality files"); m->mothurOutEndLine(); + } + + m->appendFiles((groupFile + toString(processIDS[i]) + ".temp"), groupFile); + remove((groupFile + toString(processIDS[i]) + ".temp").c_str()); + + m->mothurOut("Done with group file"); m->mothurOutEndLine(); + + for (int j = 0; j < fastaNames.size(); j++) { + m->appendFiles((fastaNames[j] + toString(processIDS[i]) + ".temp"), fastaNames[j]); + remove((fastaNames[j] + toString(processIDS[i]) + ".temp").c_str()); + } + + if(qFileName != ""){ + for (int j = 0; j < qualNames.size(); j++) { + m->appendFiles((qualNames[j] + toString(processIDS[i]) + ".temp"), qualNames[j]); + remove((qualNames[j] + toString(processIDS[i]) + ".temp").c_str()); + } + } + + if (allFiles) { m->mothurOut("Done with allfile"); m->mothurOutEndLine(); } + } + return exitCommand; #endif }