]> git.donarmstrong.com Git - mothur.git/blobdiff - collectdisplay.h
changes while testing
[mothur.git] / collectdisplay.h
index 4fe358800dba8dd40a1132f8330ca7ebe5671956..781cea1824dc77cb445819c94aed3173786baa94 100644 (file)
@@ -15,6 +15,8 @@ class CollectDisplay : public Display {
 public:
        CollectDisplay(Calculator* calc, FileOutput* file) : estimate(calc), output(file) {timesCalled = 0;};
        ~CollectDisplay()       {       delete estimate; delete output;         }
+       
+       
        void update(SAbundVector* rank){
                nSeqs=rank->getNumSeqs();
                data = estimate->getValues(rank);
@@ -28,8 +30,12 @@ public:
                //figure out what groups are being compared in getValues
                //because we randomizes the order we need to put the results in the correct column in the output file
                int group1Index, group2Index, pos;
-               group1Index = shared[0]->getGroupIndex();
-               group2Index = shared[1]->getGroupIndex();
+               
+               vector<string> mGroups = m->getGroups();
+               for (int i = 0; i < mGroups.size(); i++) {
+                       if (shared[0]->getGroup() == mGroups[i]) { group1Index = i; }
+                       if (shared[1]->getGroup() == mGroups[i]) { group2Index = i; }
+               }
                
                numGroupComb = 0;
                int n = 1;
@@ -44,8 +50,8 @@ public:
                        }
                        n++;
                }
-               
-               if (estimate->getMultiple() == true) { 
+                       
+               if ((estimate->getMultiple() == true) && all) { 
                        numGroupComb++; 
                        groupData.resize((numGroupComb*data.size()), 0);
                        //is this the time its called with all values
@@ -70,18 +76,33 @@ public:
                        output->output(numSeqs, groupData);     
                }
        };
-       
+                                                                       
        void init(string s)             {       output->initFile(s);    };
        void reset()                    {       output->resetFile();    };
        void close()                    {       output->resetFile();    };
-       bool isCalcMultiple() { return estimate->getMultiple(); }
+       void setAll(bool a)             {       all = a;                                }
+       bool getAll()                   {       return all;                             }
+       
+       
+       bool isCalcMultiple()   { return estimate->getMultiple(); }
+       bool calcNeedsAll()     { return estimate->getNeedsAll(); }
+       bool hasLciHci()        {
+               if (estimate->getCols() == 3) { return true; } 
+               else{ return false; } 
+       }
+       
+       string getName()        {  return estimate->getName();  }
+       
        
 private:
+       
        Calculator* estimate;
        FileOutput* output;
        int nSeqs, timesCalled, numGroupComb;
        vector<double> data;
        vector<double> groupData;
+       bool all;
+       
 };
 
 /***********************************************************************/