1 #ifndef COLLECTDISPLAY_H
2 #define COLLECTDISPLAY_H
4 #include "sabundvector.hpp"
5 #include "sharedsabundvector.h"
6 #include "calculator.h"
7 #include "fileoutput.h"
13 /***********************************************************************/
15 class CollectDisplay : public Display {
18 CollectDisplay(Calculator* calc, FileOutput* file) : estimate(calc), output(file) {timesCalled = 0;};
19 ~CollectDisplay() { delete estimate; delete output; }
20 void update(SAbundVector* rank){
21 nSeqs=rank->getNumSeqs();
22 data = estimate->getValues(rank);
23 output->output(nSeqs, data);
26 void update(SharedRAbundVector* shared1, SharedRAbundVector* shared2, int numSeqs, int numGroups){
28 data = estimate->getValues(shared1, shared2); //passes estimators a shared vector from each group to be compared
30 //figure out what groups are being compared in getValues
31 //because the jumble parameter randomizes the order we need to put the results in the correct column in the output file
32 int group1Index, group2Index, pos;
33 group1Index = shared1->getGroupIndex();
34 group2Index = shared2->getGroupIndex();
38 for (int i = 0; i < (numGroups - 1); i++) {
39 for (int l = n; l < numGroups; l++) {
40 if ((group1Index == i) && (group2Index == l)) {
41 pos = numGroupComb; //pos tells you which column in the output file you are in
42 }else if ((group1Index == l) && (group2Index == i)) {
50 groupData.resize((numGroupComb*data.size()), 0);
52 //fills groupdata with datas info
53 for (int i = 0; i < data.size(); i++) {
54 groupData[pos+i] = data[i];
57 //when you get all your groups info then output
58 if ((timesCalled % numGroupComb) == 0) {
59 output->output(numSeqs, groupData);
63 void init(string s) { output->initFile(s); };
64 void reset() { output->resetFile(); };
65 void close() { output->resetFile(); };
70 int nSeqs, timesCalled, numGroupComb;
72 vector<double> groupData;
75 /***********************************************************************/