X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=shhhercommand.h;h=c787fe41d5c0f2a30975feb9461bdaa3194aae18;hp=03f171e8a85cf0ebe363381793fbaea7e69950ab;hb=d1c97b8c04bb75faca1e76ffad60b37a4d789d3d;hpb=f687723a8357916e86a05116978e6869b039ce36 diff --git a/shhhercommand.h b/shhhercommand.h index 03f171e..c787fe4 100644 --- a/shhhercommand.h +++ b/shhhercommand.h @@ -18,7 +18,6 @@ #include "sabundvector.hpp" #include "listvector.hpp" #include "cluster.hpp" -#include "sparsematrix.hpp" #include //********************************************************************************************************************** @@ -41,9 +40,10 @@ public: vector setParameters(); string getCommandName() { return "shhh.flows"; } string getCommandCategory() { return "Sequence Processing"; } - string getOutputFileNameTag(string, string); + string getHelpString(); - string getCitation() { return "http://www.mothur.org/wiki/Shhh.flows"; } + string getOutputPattern(string); + string getCitation() { return "Schloss PD, Gevers D, Westcott SL (2011). Reducing the effects of PCR amplification and sequencing artifacts on 16S rRNA-based studies. PLoS ONE. 6:e27310.\nQuince C, Lanzen A, Davenport RJ, Turnbaugh PJ (2011). Removing noise from pyrosequenced amplicons. BMC Bioinformatics 12:38.\nQuince C, Lanzén A, Curtis TP, Davenport RJ, Hall N, Head IM, Read LF, Sloan WT (2009). Accurate determination of microbial diversity from 454 pyrosequencing data. Nat. Methods 6:639.\nhttp://www.mothur.org/wiki/Shhh.flows"; } string getDescription() { return "shhh.flows"; } @@ -70,7 +70,7 @@ private: vector flowFileVector; vector parseFlowFiles(string); - int driver(vector, string, string, int, int); + int driver(vector, string, string); int createProcesses(vector); int getFlowData(string, vector&, vector&, vector&, map&, int&); int getUniques(int, int, vector&, vector&, vector&, vector&, vector&, vector&, vector&, vector&); @@ -167,7 +167,7 @@ private: }; -/**************************************************************************************************/ +/************************************************************************************************** //custom data structure for threads to use. // This is passed by void pointer so it can be any data type // that can be passed using a single void pointer (LPVOID). @@ -203,7 +203,7 @@ struct shhhFlowsData { } }; -/**************************************************************************************************/ +/************************************************************************************************** #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) #else static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ @@ -234,7 +234,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ int numFlowCells; //int numSeqs = getFlowData(flowFileName, seqNameVector, lengths, flowDataIntI, nameMap, numFlowCells); - /*****************************************************************************************************/ + /***************************************************************************************************** ifstream flowFile; // cout << "herethread " << flowFileName << '\t' << &flowFile << endl; @@ -279,13 +279,13 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } } // cout << "here" << endl; - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { return 0; } pDataArray->m->mothurOut("Identifying unique flowgrams...\n"); //int numUniques = getUniques(numSeqs, numFlowCells, uniqueFlowgrams, uniqueCount, uniqueLengths, mapSeqToUnique, mapUniqueToSeq, lengths, flowDataPrI, flowDataIntI); - /*****************************************************************************************************/ + /***************************************************************************************************** int numUniques = 0; uniqueFlowgrams.assign(numFlowCells * numSeqs, -1); uniqueCount.assign(numSeqs, 0); // anWeights @@ -364,7 +364,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } } - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { return 0; } @@ -374,7 +374,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ double begClock = clock(); //flowDistParentFork(numFlowCells, distFileName, numUniques, mapUniqueToSeq, mapSeqToUnique, lengths, flowDataPrI, flowDataIntI); - /*****************************************************************************************************/ + /***************************************************************************************************** ostringstream outStream; outStream.setf(ios::fixed, ios::floatfield); outStream.setf(ios::dec, ios::basefield); @@ -390,7 +390,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ for(int j=0;jm->mothurOut("\t" + toString((clock()-thisbegClock)/CLOCKS_PER_SEC)); pDataArray->m->mothurOutEndLine(); } - /*****************************************************************************************************/ + /***************************************************************************************************** pDataArray->m->mothurOutEndLine(); pDataArray->m->mothurOut("Total time: " + toString(time(NULL) - begTime) + '\t' + toString((clock() - begClock)/CLOCKS_PER_SEC) + '\n'); string namesFileName = flowFileName.substr(0,flowFileName.find_last_of('.')) + ".shhh.names"; //createNamesFile(numSeqs, numUniques, namesFileName, seqNameVector, mapSeqToUnique, mapUniqueToSeq); - /*****************************************************************************************************/ + /***************************************************************************************************** vector duplicateNames(numUniques, ""); for(int i=0;im->control_pressed) { return 0; } pDataArray->m->mothurOut("\nClustering flowgrams...\n"); string listFileName = flowFileName.substr(0,flowFileName.find_last_of('.')) + ".shhh.list"; //cluster(listFileName, distFileName, namesFileName); - /*****************************************************************************************************/ + /***************************************************************************************************** ReadMatrix* read = new ReadColumnMatrix(distFileName); read->setCutoff(pDataArray->cutoff); @@ -502,7 +502,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ listFileOut.close(); delete matrix; delete cluster; delete rabund; delete list; - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { return 0; } @@ -516,7 +516,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ //int numOTUs = getOTUData(numSeqs, listFileName, otuData, cumNumSeqs, nSeqsPerOTU, aaP, aaI, seqNumber, seqIndex, nameMap); - /*****************************************************************************************************/ + /***************************************************************************************************** ifstream listFile; pDataArray->m->openInputFile(listFileName, listFile); string label; @@ -596,7 +596,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ seqIndex = seqNumber; listFile.close(); - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { return 0; } @@ -643,7 +643,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ double cycClock = clock(); unsigned long long cycTime = time(NULL); //fill(numOTUs, seqNumber, seqIndex, cumNumSeqs, nSeqsPerOTU, aaP, aaI); - /*****************************************************************************************************/ + /***************************************************************************************************** int indexFill = 0; for(int i=0;im->control_pressed) { break; } //calcCentroidsDriver(numOTUs, cumNumSeqs, nSeqsPerOTU, seqIndex, change, centroids, singleTau, mapSeqToUnique, uniqueFlowgrams, flowDataIntI, lengths, numFlowCells, seqNumber); - /*****************************************************************************************************/ + /***************************************************************************************************** for(int i=0;im->control_pressed) { break; } @@ -708,7 +708,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ for(int k=0;km->control_pressed) { break; } //maxDelta = getNewWeights(numOTUs, cumNumSeqs, nSeqsPerOTU, singleTau, seqNumber, weight); - /*****************************************************************************************************/ + /***************************************************************************************************** double maxChange = 0; for(int i=0;i maxChange){ maxChange = difference; } } maxDelta = maxChange; - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { break; } //double nLL = getLikelihood(numSeqs, numOTUs, nSeqsPerOTU, seqNumber, cumNumSeqs, seqIndex, dist, weight); - /*****************************************************************************************************/ + /***************************************************************************************************** vector P(numSeqs, 0); int effNumOTUs = 0; @@ -804,12 +804,12 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } nLL = nLL -(double)numSeqs * log(pDataArray->sigma); - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { break; } //checkCentroids(numOTUs, centroids, weight); - /*****************************************************************************************************/ + /***************************************************************************************************** vector unique(numOTUs, 1); for(int i=0;im->control_pressed) { break; } //calcNewDistances(numSeqs, numOTUs, nSeqsPerOTU, dist, weight, change, centroids, aaP, singleTau, aaI, seqNumber, seqIndex, uniqueFlowgrams, flowDataIntI, numFlowCells, lengths); - /*****************************************************************************************************/ + /***************************************************************************************************** int total = 0; vector newTau(numOTUs,0); vector norms(numSeqs, 0); @@ -860,7 +860,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ if(weight[j] > MIN_WEIGHT && change[j] == 1){ //dist[indexOffset + j] = getDistToCentroid(centroids[j], i, lengths[i], uniqueFlowgrams, flowDataIntI, numFlowCells); - /*****************************************************************************************************/ + /***************************************************************************************************** int flowAValue = centroids[j] * numFlowCells; int flowBValue = i * numFlowCells; @@ -873,7 +873,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } dist[indexOffset + j] = distTemp / (double)lengths[i]; - /*****************************************************************************************************/ + /***************************************************************************************************** } @@ -917,7 +917,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } - /*****************************************************************************************************/ + /***************************************************************************************************** if (pDataArray->m->control_pressed) { break; } @@ -931,7 +931,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ pDataArray->m->mothurOut("\nFinalizing...\n"); //fill(numOTUs, seqNumber, seqIndex, cumNumSeqs, nSeqsPerOTU, aaP, aaI); - /*****************************************************************************************************/ + /***************************************************************************************************** int indexFill = 0; for(int i=0;im->control_pressed) { break; } //setOTUs(numOTUs, numSeqs, seqNumber, seqIndex, cumNumSeqs, nSeqsPerOTU, otuData, singleTau, dist, aaP, aaI); - /*****************************************************************************************************/ + /***************************************************************************************************** vector bigTauMatrix(numOTUs * numSeqs, 0.0000); for(int i=0;im->control_pressed) { break; } @@ -1017,7 +1017,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ for(int i=0;im->control_pressed) { break; } @@ -1062,7 +1062,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ for(int k=0;km->control_pressed) { break; } //writeQualities(numOTUs, numFlowCells, flowFileName, otuCounts, nSeqsPerOTU, seqNumber, singleTau, flowDataIntI, uniqueFlowgrams, cumNumSeqs, mapUniqueToSeq, seqNameVector, centroids, aaI); if (pDataArray->m->control_pressed) { break; } - /*****************************************************************************************************/ + /***************************************************************************************************** string thisOutputDir = pDataArray->outputDir; if (pDataArray->outputDir == "") { thisOutputDir += pDataArray->m->hasPath(flowFileName); } string qualityFileName = thisOutputDir + pDataArray->m->getRootName(pDataArray->m->getSimpleName(flowFileName)) + "shhh.qual"; @@ -1200,11 +1200,11 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } qualityFile.close(); pDataArray->outputNames.push_back(qualityFileName); - /*****************************************************************************************************/ + /***************************************************************************************************** // writeSequences(thisCompositeFASTAFileName, numOTUs, numFlowCells, flowFileName, otuCounts, uniqueFlowgrams, seqNameVector, aaI, centroids); if (pDataArray->m->control_pressed) { break; } - /*****************************************************************************************************/ + /***************************************************************************************************** thisOutputDir = pDataArray->outputDir; if (pDataArray->outputDir == "") { thisOutputDir += pDataArray->m->hasPath(flowFileName); } string fastaFileName = thisOutputDir + pDataArray->m->getRootName(pDataArray->m->getSimpleName(flowFileName)) + "shhh.fasta"; @@ -1243,11 +1243,11 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ pDataArray->m->appendFiles(fastaFileName, pDataArray->thisCompositeFASTAFileName); } - /*****************************************************************************************************/ + /***************************************************************************************************** //writeNames(thisCompositeNamesFileName, numOTUs, flowFileName, otuCounts, seqNameVector, aaI, nSeqsPerOTU); if (pDataArray->m->control_pressed) { break; } - /*****************************************************************************************************/ + /***************************************************************************************************** thisOutputDir = pDataArray->outputDir; if (pDataArray->outputDir == "") { thisOutputDir += pDataArray->m->hasPath(flowFileName); } string nameFileName = thisOutputDir + pDataArray->m->getRootName(pDataArray->m->getSimpleName(flowFileName)) + "shhh.names"; @@ -1275,11 +1275,11 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ if(pDataArray->thisCompositeNameFileName != ""){ pDataArray->m->appendFiles(nameFileName, pDataArray->thisCompositeNameFileName); } - /*****************************************************************************************************/ + /***************************************************************************************************** //writeClusters(flowFileName, numOTUs, numFlowCells,otuCounts, centroids, uniqueFlowgrams, seqNameVector, aaI, nSeqsPerOTU, lengths, flowDataIntI); if (pDataArray->m->control_pressed) { break; } - /*****************************************************************************************************/ + /***************************************************************************************************** thisOutputDir = pDataArray->outputDir; if (pDataArray->outputDir == "") { thisOutputDir += pDataArray->m->hasPath(flowFileName); } string otuCountsFileName = thisOutputDir + pDataArray->m->getRootName(pDataArray->m->getSimpleName(flowFileName)) + "shhh.counts"; @@ -1327,12 +1327,12 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } } otuCountsFile.close(); - pDataArray->outputNames.push_back(otuCountsFileName); - /*****************************************************************************************************/ + pDataArray->outputNames.push_back(otuCountsFileName) + /***************************************************************************************************** //writeGroups(flowFileName, numSeqs, seqNameVector); if (pDataArray->m->control_pressed) { break; } - /*****************************************************************************************************/ + /***************************************************************************************************** thisOutputDir = pDataArray->outputDir; if (pDataArray->outputDir == "") { thisOutputDir += pDataArray->m->hasPath(flowFileName); } string fileRoot = thisOutputDir + pDataArray->m->getRootName(pDataArray->m->getSimpleName(flowFileName)); @@ -1346,7 +1346,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } groupFile.close(); pDataArray->outputNames.push_back(groupFileName); - /*****************************************************************************************************/ + /***************************************************************************************************** pDataArray->m->mothurOut("Total time to process " + flowFileName + ":\t" + toString(time(NULL) - begTime) + '\t' + toString((clock() - begClock)/(double)CLOCKS_PER_SEC) + '\n'); } @@ -1362,7 +1362,7 @@ static DWORD WINAPI ShhhFlowsThreadFunction(LPVOID lpParam){ } } #endif - +*/ #endif