X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=chimerauchimecommand.h;h=a5b42751dfd74ea3eb1fc3dc4ccf9bfa5bb9822b;hb=cc19310422f125d6628980bd1148e1e816792382;hp=659d1ea39963f05a245cda03acf56f3b6e3d10e9;hpb=01f8d2c7d982a6209211f5abbcf2a086fdf60d0a;p=mothur.git diff --git a/chimerauchimecommand.h b/chimerauchimecommand.h index 659d1ea..a5b4275 100644 --- a/chimerauchimecommand.h +++ b/chimerauchimecommand.h @@ -47,7 +47,7 @@ private: int driver(string, string, string, string, int&); int createProcesses(string, string, string, string, int&); - bool abort, useAbskew, chimealns, useMinH, useMindiv, useXn, useDn, useXa, useChunks, useMinchunk, useIdsmoothwindow, useMinsmoothid, useMaxp, skipgaps, skipgaps2, useMinlen, useMaxlen, ucl, useQueryfract, hasCount, hasName; + bool abort, useAbskew, chimealns, useMinH, useMindiv, useXn, useDn, useXa, useChunks, useMinchunk, useIdsmoothwindow, useMinsmoothid, useMaxp, skipgaps, skipgaps2, useMinlen, useMaxlen, ucl, useQueryfract, hasCount, hasName, dups; string fastafile, groupfile, templatefile, outputDir, namefile, countfile, abskew, minh, mindiv, xn, dn, xa, chunks, minchunk, idsmoothwindow, minsmoothid, maxp, minlen, maxlen, queryfract, uchimeLocation; int processors; @@ -64,6 +64,7 @@ private: int deconvoluteResults(map&, string, string, string); int driverGroups(string, string, string, string, int, int, vector); int createProcessesGroups(string, string, string, string, vector, string, string, string); + int prepFile(string filename, string); }; @@ -189,7 +190,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ if (pDataArray->hasCount) { error = cparser->getSeqs(pDataArray->groups[i], pDataArray->filename, true); if ((error == 1) || pDataArray->m->control_pressed) { delete cparser; return 0; } }else { - error = cparser->getSeqs(pDataArray->groups[i], pDataArray->filename, true); if ((error == 1) || pDataArray->m->control_pressed) { delete parser; return 0; } + error = parser->getSeqs(pDataArray->groups[i], pDataArray->filename, true); if ((error == 1) || pDataArray->m->control_pressed) { delete parser; return 0; } } //int numSeqs = driver((outputFName + groups[i]), filename, (accnos+ groups[i]), (alns+ groups[i]), numChimeras); @@ -524,16 +525,31 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){ strncat(tempUchime, uchimeCommand.c_str(), uchimeCommand.length()); cPara.push_back(tempUchime); - char* tempIn = new char[8]; - *tempIn = '\0'; strncat(tempIn, "--input", 7); - //strcpy(tempIn, "--input"); - cPara.push_back(tempIn); - char* temp = new char[filename.length()+1]; - *temp = '\0'; strncat(temp, filename.c_str(), filename.length()); - //strcpy(temp, filename.c_str()); - cPara.push_back(temp); - - //add reference file + string outputFileName = filename.substr(1, filename.length()-2) + ".uchime_formatted"; + //prepFile(filename.substr(1, filename.length()-2), outputFileName); + //prepFile(filename, outputFileName); + /******************************************/ + ifstream in23; + pDataArray->m->openInputFile((filename.substr(1, filename.length()-2)), in23); + + ofstream out23; + pDataArray->m->openOutputFile(outputFileName, out23); + + while (!in23.eof()) { + if (pDataArray->m->control_pressed) { break; } + + Sequence seq(in23); pDataArray->m->gobble(in23); + + if (seq.getName() != "") { seq.printSequence(out23); } + } + in23.close(); + out23.close(); + /******************************************/ + + filename = outputFileName; + filename = "\"" + filename + "\""; + + //add reference file char* tempRef = new char[5]; //strcpy(tempRef, "--db"); *tempRef = '\0'; strncat(tempRef, "--db", 4); @@ -542,6 +558,15 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){ //strcpy(tempR, templatefile.c_str()); *tempR = '\0'; strncat(tempR, templatefile.c_str(), templatefile.length()); cPara.push_back(tempR); + + char* tempIn = new char[8]; + *tempIn = '\0'; strncat(tempIn, "--input", 7); + //strcpy(tempIn, "--input"); + cPara.push_back(tempIn); + char* temp = new char[filename.length()+1]; + *temp = '\0'; strncat(temp, filename.c_str(), filename.length()); + //strcpy(temp, filename.c_str()); + cPara.push_back(temp); char* tempO = new char[12]; *tempO = '\0'; strncat(tempO, "--uchimeout", 11); @@ -733,6 +758,8 @@ static DWORD WINAPI MyUchimeSeqsThreadFunction(LPVOID lpParam){ for (int j = 0; j < cPara.size(); j++) { uchimeParameters[j] = cPara[j]; commandString += toString(cPara[j]) + " "; } //int numArgs = cPara.size(); + commandString = "\"" + commandString + "\""; + //uchime_main(numArgs, uchimeParameters); //cout << "commandString = " << commandString << endl; if (pDataArray->m->debug) { pDataArray->m->mothurOut("[DEBUG]: uchime command = " + commandString + ".\n"); }