]> git.donarmstrong.com Git - mothur.git/blob - sharedsobscollectsummary.cpp
modified calculators to use doubles, added numotu and fontsize parameters to heatmap...
[mothur.git] / sharedsobscollectsummary.cpp
1 /*
2  *  sharedsobscollectsummary.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 2/12/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "sharedsobscollectsummary.h"
11
12 /***********************************************************************/
13 //This returns the number of shared species observed in several groups.  
14 //The shared vector is each groups sharedrabundvector.
15
16 EstOutput SharedSobsCS::getValues(vector<SharedRAbundVector*> shared){
17         try {
18                 data.resize(1,0);
19                 double observed = 0;
20                 int numGroups = shared.size();
21
22                 for (int i = 0; i < shared[0]->size(); i++) {
23                         //get bin values and set sharedByAll 
24                         bool sharedByAll = true;
25                         for (int j = 0; j < numGroups; j++) {
26                                 if (shared[j]->getAbundance(i) == 0) { sharedByAll = false; }
27                         }
28                         
29                         //they are shared
30                         if (sharedByAll == true) {  observed++;  }
31                 }
32
33                 data[0] = observed;
34                 return data;
35         }
36         catch(exception& e) {
37                 m->errorOut(e, "SharedSobsCS", "getValues");
38                 exit(1);
39         }
40 }
41
42 /***********************************************************************/