X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=collectdisplay.h;fp=collectdisplay.h;h=fc405dfa0d7dbfd8885d5c21ec9b1d879f2f4126;hb=44c1323a88b2a697c7047df1b3bb8c59eadd15b1;hp=367a188dfb8de90c2e464cb70cc4a7b1b826ccfe;hpb=b2dca66a02f8f82aa5528e531eace60fbbd2967b;p=mothur.git diff --git a/collectdisplay.h b/collectdisplay.h index 367a188..fc405df 100644 --- a/collectdisplay.h +++ b/collectdisplay.h @@ -23,17 +23,40 @@ public: output->output(nSeqs, data); }; - void update(SharedRAbundVector* shared1, SharedRAbundVector* shared2, int numSeqs, int numGroupComb){ + void update(SharedRAbundVector* shared1, SharedRAbundVector* shared2, int numSeqs, int numGroups){ timesCalled++; data = estimate->getValues(shared1, shared2); //passes estimators a shared vector from each group to be compared + + //figure out what groups are being compared in getValues + //because the jumble parameter randomizes the order we need to put the results in the correct column in the output file + int group1Index, group2Index, pos; + group1Index = shared1->getGroupIndex(); + group2Index = shared2->getGroupIndex(); + + numGroupComb = 0; + int n = 1; + for (int i = 0; i < (numGroups - 1); i++) { + for (int l = n; l < numGroups; l++) { + if ((group1Index == i) && (group2Index == l)) { + pos = numGroupComb; //pos tells you which column in the output file you are in + }else if ((group1Index == l) && (group2Index == i)) { + pos = numGroupComb; + } + numGroupComb++; + } + n++; + } + + groupData.resize((numGroupComb*data.size()), 0); + //fills groupdata with datas info for (int i = 0; i < data.size(); i++) { - groupData.push_back(data[i]); + groupData[pos+i] = data[i]; } + //when you get all your groups info then output if ((timesCalled % numGroupComb) == 0) { output->output(numSeqs, groupData); - groupData.clear(); } }; @@ -44,7 +67,7 @@ public: private: Calculator* estimate; FileOutput* output; - int nSeqs, timesCalled; + int nSeqs, timesCalled, numGroupComb; vector data; vector groupData; };