X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=chimerauchimecommand.h;h=659d1ea39963f05a245cda03acf56f3b6e3d10e9;hb=01f8d2c7d982a6209211f5abbcf2a086fdf60d0a;hp=5423a171d5698bda82c5869401e3509e1f059439;hpb=6ede3bf5c0a9eedb23f24577a97da81ab3e1f7df;p=mothur.git diff --git a/chimerauchimecommand.h b/chimerauchimecommand.h index 5423a17..659d1ea 100644 --- a/chimerauchimecommand.h +++ b/chimerauchimecommand.h @@ -14,6 +14,8 @@ #include "mothur.h" #include "command.hpp" #include "sequenceparser.h" +#include "counttable.h" +#include "sequencecountparser.h" /***********************************************************/ @@ -45,11 +47,12 @@ 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; - string fastafile, groupfile, templatefile, outputDir, namefile, abskew, minh, mindiv, xn, dn, xa, chunks, minchunk, idsmoothwindow, minsmoothid, maxp, minlen, maxlen, queryfract, uchimeLocation; + bool abort, useAbskew, chimealns, useMinH, useMindiv, useXn, useDn, useXa, useChunks, useMinchunk, useIdsmoothwindow, useMinsmoothid, useMaxp, skipgaps, skipgaps2, useMinlen, useMaxlen, ucl, useQueryfract, hasCount, hasName; + string fastafile, groupfile, templatefile, outputDir, namefile, countfile, abskew, minh, mindiv, xn, dn, xa, chunks, minchunk, idsmoothwindow, minsmoothid, maxp, minlen, maxlen, queryfract, uchimeLocation; int processors; - + SequenceParser* sparser; + SequenceCountParser* cparser; vector outputNames; vector fastaFileNames; vector nameFileNames; @@ -58,9 +61,9 @@ private: string getNamesFile(string&); int readFasta(string, map&); int printFile(vector&, string); - int deconvoluteResults(SequenceParser&, string, string, string); - int driverGroups(SequenceParser&, string, string, string, string, int, int, vector); - int createProcessesGroups(SequenceParser&, string, string, string, string, vector, string, string, string); + 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); }; @@ -81,7 +84,7 @@ struct uchimeData { int end; int threadID, count, numChimeras; vector groups; - bool useAbskew, chimealns, useMinH, useMindiv, useXn, useDn, useXa, useChunks, useMinchunk, useIdsmoothwindow, useMinsmoothid, useMaxp, skipgaps, skipgaps2, useMinlen, useMaxlen, ucl, useQueryfract; + bool useAbskew, chimealns, useMinH, useMindiv, useXn, useDn, useXa, useChunks, useMinchunk, useIdsmoothwindow, useMinsmoothid, useMaxp, skipgaps, skipgaps2, useMinlen, useMaxlen, ucl, useQueryfract, hasCount; string abskew, minh, mindiv, xn, dn, xa, chunks, minchunk, idsmoothwindow, minsmoothid, maxp, minlen, maxlen, queryfract; uchimeData(){} @@ -103,7 +106,7 @@ struct uchimeData { numChimeras = 0; uchimeLocation = uloc; } - void setBooleans(bool Abskew, bool calns, bool MinH, bool Mindiv, bool Xn, bool Dn, bool Xa, bool Chunks, bool Minchunk, bool Idsmoothwindow, bool Minsmoothid, bool Maxp, bool skipgap, bool skipgap2, bool Minlen, bool Maxlen, bool uc, bool Queryfract) { + void setBooleans(bool Abskew, bool calns, bool MinH, bool Mindiv, bool Xn, bool Dn, bool Xa, bool Chunks, bool Minchunk, bool Idsmoothwindow, bool Minsmoothid, bool Maxp, bool skipgap, bool skipgap2, bool Minlen, bool Maxlen, bool uc, bool Queryfract, bool hc) { useAbskew = Abskew; chimealns = calns; useMinH = MinH; @@ -122,6 +125,7 @@ struct uchimeData { useMaxlen = Maxlen; ucl = uc; useQueryfract = Queryfract; + hasCount = hc; } void setVariables(string abske, string min, string mindi, string x, string d, string xa2, string chunk, string minchun, string idsmoothwindo, string minsmoothi, string max, string minle, string maxle, string queryfrac) { @@ -163,16 +167,30 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ //parse fasta and name file by group SequenceParser* parser; - if (pDataArray->namefile != "") { parser = new SequenceParser(pDataArray->groupfile, pDataArray->fastafile, pDataArray->namefile); } - else { parser = new SequenceParser(pDataArray->groupfile, pDataArray->fastafile); } + SequenceCountParser* cparser; + if (pDataArray->hasCount) { + CountTable* ct = new CountTable(); + ct->readTable(pDataArray->namefile); + cparser = new SequenceCountParser(pDataArray->fastafile, *ct); + delete ct; + }else { + if (pDataArray->namefile != "") { parser = new SequenceParser(pDataArray->groupfile, pDataArray->fastafile, pDataArray->namefile); } + else { parser = new SequenceParser(pDataArray->groupfile, pDataArray->fastafile); } + } int totalSeqs = 0; int numChimeras = 0; for (int i = pDataArray->start; i < pDataArray->end; i++) { - int start = time(NULL); if (pDataArray->m->control_pressed) { delete parser; return 0; } + int start = time(NULL); if (pDataArray->m->control_pressed) { if (pDataArray->hasCount) { delete cparser; } { delete parser; } return 0; } - int error = parser->getSeqs(pDataArray->groups[i], pDataArray->filename, true); if ((error == 1) || pDataArray->m->control_pressed) { delete parser; return 0; } + + int error; + 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; } + } //int numSeqs = driver((outputFName + groups[i]), filename, (accnos+ groups[i]), (alns+ groups[i]), numChimeras); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -410,7 +428,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ filename = filename.substr(1, filename.length()-2); alns = alns.substr(1, alns.length()-2); - if (pDataArray->m->control_pressed) { delete parser; return 0; } + if (pDataArray->m->control_pressed) { if (pDataArray->hasCount) { delete cparser; } { delete parser; } return 0; } //create accnos file from uchime results ifstream in; @@ -447,7 +465,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ totalSeqs += num; pDataArray->numChimeras += numChimeras; - if (pDataArray->m->control_pressed) { delete parser; return 0; } + if (pDataArray->m->control_pressed) { if (pDataArray->hasCount) { delete cparser; } { delete parser; } return 0; } //remove file made for uchime pDataArray->m->mothurRemove(filename); @@ -462,7 +480,7 @@ static DWORD WINAPI MyUchimeThreadFunction(LPVOID lpParam){ } pDataArray->count = totalSeqs; - delete parser; + if (pDataArray->hasCount) { delete cparser; } { delete parser; } return totalSeqs; }