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(vector<SharedRAbundVector*> shared, int numSeqs, int numGroups){
28 data = estimate->getValues(shared); //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 = shared[0]->getGroupIndex();
34 group2Index = shared[1]->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 if (estimate->getMultiple() == true) {
52 groupData.resize((numGroupComb*data.size()), 0);
53 //is this the time its called with all values
54 if ((timesCalled % numGroupComb) == 0) {
56 pos = ((groupData.size()-1) * data.size());
58 //fills groupdata with datas info
59 for (int i = 0; i < data.size(); i++) {
60 groupData[pos+i] = data[i];
63 groupData.resize((numGroupComb*data.size()), 0);
64 //fills groupdata with datas info
65 for (int i = 0; i < data.size(); i++) {
66 groupData[pos+i] = data[i];
70 //when you get all your groups info then output
71 if ((timesCalled % numGroupComb) == 0) {
72 output->output(numSeqs, groupData);
76 void init(string s) { output->initFile(s); };
77 void reset() { output->resetFile(); };
78 void close() { output->resetFile(); };
79 bool isCalcMultiple() { return estimate->getMultiple(); }
84 int nSeqs, timesCalled, numGroupComb;
86 vector<double> groupData;
89 /***********************************************************************/