1 #ifndef COLLECTDISPLAY_H
2 #define COLLECTDISPLAY_H
4 #include "sabundvector.hpp"
5 #include "sharedsabundvector.h"
6 #include "calculator.h"
7 #include "fileoutput.h"
11 /***********************************************************************/
13 class CollectDisplay : public Display {
16 CollectDisplay(Calculator* calc, FileOutput* file) : estimate(calc), output(file) {timesCalled = 0;};
17 ~CollectDisplay() { delete estimate; delete output; }
18 void update(SAbundVector* rank){
19 nSeqs=rank->getNumSeqs();
20 data = estimate->getValues(rank);
21 output->output(nSeqs, data);
24 void update(vector<SharedRAbundVector*> shared, int numSeqs, int numGroups){
26 data = estimate->getValues(shared); //passes estimators a shared vector from each group to be compared
28 //figure out what groups are being compared in getValues
29 //because we randomizes the order we need to put the results in the correct column in the output file
30 int group1Index, group2Index, pos;
31 group1Index = shared[0]->getGroupIndex();
32 group2Index = shared[1]->getGroupIndex();
36 for (int i = 0; i < (numGroups - 1); i++) {
37 for (int l = n; l < numGroups; l++) {
38 if ((group1Index == i) && (group2Index == l)) {
39 pos = numGroupComb; //pos tells you which column in the output file you are in
40 }else if ((group1Index == l) && (group2Index == i)) {
48 if (estimate->getMultiple() == true) {
50 groupData.resize((numGroupComb*data.size()), 0);
51 //is this the time its called with all values
52 if ((timesCalled % numGroupComb) == 0) {
54 pos = ((groupData.size()-1) * data.size());
56 //fills groupdata with datas info
57 for (int i = 0; i < data.size(); i++) {
58 groupData[pos+i] = data[i];
61 groupData.resize((numGroupComb*data.size()), 0);
62 //fills groupdata with datas info
63 for (int i = 0; i < data.size(); i++) {
64 groupData[pos+i] = data[i];
68 //when you get all your groups info then output
69 if ((timesCalled % numGroupComb) == 0) {
70 output->output(numSeqs, groupData);
74 void init(string s) { output->initFile(s); };
75 void reset() { output->resetFile(); };
76 void close() { output->resetFile(); };
77 bool isCalcMultiple() { return estimate->getMultiple(); }
79 string getName() { return estimate->getName(); }
85 int nSeqs, timesCalled, numGroupComb;
87 vector<double> groupData;
90 /***********************************************************************/