X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sharedsobs.cpp;h=f9b5eddcd919acdd409c9b0792294034dbcb7391;hp=14f5bf59d6552303d664e275e7c4173643a36179;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=20a2d0350a737a434c89f303662d64a8eeea7b05 diff --git a/sharedsobs.cpp b/sharedsobs.cpp index 14f5bf5..f9b5edd 100644 --- a/sharedsobs.cpp +++ b/sharedsobs.cpp @@ -13,29 +13,25 @@ //This returns the number of unique species observed in several groups. //The shared vector is each groups sharedrabundvector. -EstOutput SharedSobs::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2){ +EstOutput SharedSobs::getValues(vector shared){ try { data.resize(1,0); - int observed = 0;; + double observed = 0; //loop through the species in each group - for (int k = 0; k < shared1->size(); k++) { + for (int k = 0; k < shared[0]->getNumBins(); k++) { //if you have found a new species - if (shared1->getAbundance(k) != 0) { observed++; } - else if ((shared1->getAbundance(k) == 0) && (shared2->getAbundance(k) != 0)) { observed++; } + if (shared[0]->getAbundance(k) != 0) { observed++; } + else if ((shared[0]->getAbundance(k) == 0) && (shared[1]->getAbundance(k) != 0)) { observed++; } } data[0] = observed; return data; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the SharedSobs class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "SharedSobs", "getValues"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the SharedSobs class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/