2 * sharedsobscollectsummary.cpp
5 * Created by Sarah Westcott on 2/12/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "sharedsobscollectsummary.h"
12 /***********************************************************************/
13 //This returns the number of shared species observed in several groups.
14 //The shared vector is each groups sharedrabundvector.
16 EstOutput SharedSobsCS::getValues(vector<SharedRAbundVector*> shared){
20 int numGroups = shared.size();
22 for (int i = 0; i < shared[0]->getNumBins(); 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; }
30 if (sharedByAll == true) { observed++; }
37 m->errorOut(e, "SharedSobsCS", "getValues");
41 /***********************************************************************/
42 //This returns the number of shared species observed in several groups.
43 //The shared vector is each groups sharedrabundvector.
45 EstOutput SharedSobsCS::getValues(vector<SharedRAbundVector*> shared, vector<string>& labels){
49 int numGroups = shared.size();
52 for (int i = 0; i < shared[0]->getNumBins(); i++) {
53 //get bin values and set sharedByAll
54 bool sharedByAll = true;
55 for (int j = 0; j < numGroups; j++) {
56 if (shared[j]->getAbundance(i) == 0) { sharedByAll = false; }
60 if (sharedByAll == true) { observed++; labels.push_back(m->currentBinLabels[i]); }
67 m->errorOut(e, "SharedSobsCS", "getValues");
72 /***********************************************************************/