X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=getmetacommunitycommand.h;h=d84a65d640605734b51efd9dd32a4e78e4038e48;hp=d7b163e93f1003fdb0dcd73bdb5984de2eee208b;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=875ab4b2eec77b920e9fa0042f9a2aae2faff2b0 diff --git a/getmetacommunitycommand.h b/getmetacommunitycommand.h index d7b163e..d84a65d 100644 --- a/getmetacommunitycommand.h +++ b/getmetacommunitycommand.h @@ -12,6 +12,50 @@ #include "command.hpp" #include "inputdata.h" #include "qFinderDMM.h" +#include "pam.h" +#include "sharedsobscollectsummary.h" +#include "sharedchao1.h" +#include "sharedace.h" +#include "sharednseqs.h" +#include "sharedjabund.h" +#include "sharedsorabund.h" +#include "sharedjclass.h" +#include "sharedsorclass.h" +#include "sharedjest.h" +#include "sharedsorest.h" +#include "sharedthetayc.h" +#include "sharedthetan.h" +#include "sharedkstest.h" +#include "whittaker.h" +#include "sharedochiai.h" +#include "sharedanderbergs.h" +#include "sharedkulczynski.h" +#include "sharedkulczynskicody.h" +#include "sharedlennon.h" +#include "sharedmorisitahorn.h" +#include "sharedbraycurtis.h" +#include "sharedjackknife.h" +#include "whittaker.h" +#include "odum.h" +#include "canberra.h" +#include "structeuclidean.h" +#include "structchord.h" +#include "hellinger.h" +#include "manhattan.h" +#include "structpearson.h" +#include "soergel.h" +#include "spearman.h" +#include "structkulczynski.h" +#include "structchi2.h" +#include "speciesprofile.h" +#include "hamming.h" +#include "gower.h" +#include "memchi2.h" +#include "memchord.h" +#include "memeuclidean.h" +#include "mempearson.h" +#include "sharedjsd.h" +#include "sharedrjsd.h" /**************************************************************************************************/ @@ -40,18 +84,20 @@ private: unsigned long long end; linePair(unsigned long long i, unsigned long long j) : start(i), end(j) {} }; - bool abort, allLines; + bool abort, allLines, subsample; string outputDir; vector outputNames; - string sharedfile; - int minpartitions, maxpartitions, optimizegap, processors; - vector Groups; + string sharedfile, method, calc; + int minpartitions, maxpartitions, optimizegap, processors, iters, subsampleSize; + vector Groups, Estimators; set labels; + vector > generateDistanceMatrix(vector& lookup); + int driver(vector thisLookup, vector< vector >& calcDists, Calculator*); int processDriver(vector&, vector&, string, vector, vector, vector, int); int createProcesses(vector&); vector generateDesignFile(int, map); - int generateSummaryFile(int, map); + int generateSummaryFile(int, map, vector); }; @@ -63,111 +109,5 @@ struct summaryData { vector partMean, partLCI, partUCI; }; -/**************************************************************************************************/ - -struct metaCommunityData { - vector thislookup; - MothurOut* m; - string outputFileName; - vector relabunds, matrix, outputNames; - int minpartitions, maxpartitions, optimizegap; - vector parts; - int minPartition; - - metaCommunityData(){} - metaCommunityData(vector lu, MothurOut* mout, vector dp, string fit, vector rels, vector mat, int minp, int maxp, int opg) { - m = mout; - thislookup = lu; - parts = dp; - outputFileName = fit; - relabunds = rels; - matrix = mat; - minpartitions = minp; - maxpartitions = maxp; - optimizegap = opg; - minPartition = 0; - } -}; -/**************************************************************************************************/ -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) -#else -static DWORD WINAPI MyMetaCommunityThreadFunction(LPVOID lpParam){ - metaCommunityData* pDataArray; - pDataArray = (metaCommunityData*)lpParam; - - try { - - double minLaplace = 1e10; - - ofstream fitData; - pDataArray->m->openOutputFile(pDataArray->outputFileName, fitData); - fitData.setf(ios::fixed, ios::floatfield); - fitData.setf(ios::showpoint); - cout.setf(ios::fixed, ios::floatfield); - cout.setf(ios::showpoint); - - vector< vector > sharedMatrix; - for (int i = 0; i < pDataArray->thislookup.size(); i++) { sharedMatrix.push_back(pDataArray->thislookup[i]->getAbundances()); } - - pDataArray->m->mothurOut("K\tNLE\t\tlogDet\tBIC\t\tAIC\t\tLaplace\n"); - fitData << "K\tNLE\tlogDet\tBIC\tAIC\tLaplace" << endl; - - for(int i=0;iparts.size();i++){ - - int numPartitions = pDataArray->parts[i]; - - if (pDataArray->m->debug) { pDataArray->m->mothurOut("[DEBUG]: running partition " + toString(numPartitions) + "\n"); } - - if (pDataArray->m->control_pressed) { break; } - - qFinderDMM* findQ = new qFinderDMM(sharedMatrix, numPartitions); - - if (pDataArray->m->debug) { pDataArray->m->mothurOut("[DEBUG]: done finding Q " + toString(numPartitions) + "\n"); } - - double laplace = findQ->getLaplace(); - pDataArray->m->mothurOut(toString(numPartitions) + '\t'); - cout << setprecision (2) << findQ->getNLL() << '\t' << findQ->getLogDet() << '\t'; - pDataArray->m->mothurOutJustToLog(toString(findQ->getNLL()) + '\t' + toString(findQ->getLogDet()) + '\t'); - cout << findQ->getBIC() << '\t' << findQ->getAIC() << '\t' << laplace; - pDataArray->m->mothurOutJustToLog(toString(findQ->getBIC()) + '\t' + toString(findQ->getAIC()) + '\t' + toString(laplace)); - - fitData << numPartitions << '\t'; - fitData << setprecision (2) << findQ->getNLL() << '\t' << findQ->getLogDet() << '\t'; - fitData << findQ->getBIC() << '\t' << findQ->getAIC() << '\t' << laplace << endl; - - if(laplace < minLaplace){ - pDataArray->minPartition = numPartitions; - minLaplace = laplace; - pDataArray->m->mothurOut("***"); - } - pDataArray->m->mothurOutEndLine(); - - pDataArray->outputNames.push_back(pDataArray->relabunds[i]); - pDataArray->outputNames.push_back(pDataArray->matrix[i]); - - findQ->printZMatrix(pDataArray->matrix[i], pDataArray->m->getGroups()); - findQ->printRelAbund(pDataArray->relabunds[i], pDataArray->m->currentBinLabels); - - if(pDataArray->optimizegap != -1 && (numPartitions - pDataArray->minPartition) >= pDataArray->optimizegap && numPartitions >= pDataArray->minpartitions){ break; } - - delete findQ; - } - fitData.close(); - - //minPartition = 4; - - if (pDataArray->m->control_pressed) { return 0; } - - return 0; - - } - catch(exception& e) { - pDataArray->m->errorOut(e, "GetMetaCommunityCommand", "MyMetaCommunityThreadFunction"); - exit(1); - } -} -#endif - - #endif