X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=nseqs.h;h=e82684b645041a10095c681061d4b16fa6929a9f;hb=8dd3c225255d7084e3aff8740aa4f1f1cabb367a;hp=0a7b0c355dec5eaf4cddc1206bf9b0339d2781e2;hpb=9ca2caadbeac83bb84b3330d9204b1b659d62941;p=mothur.git diff --git a/nseqs.h b/nseqs.h index 0a7b0c3..e82684b 100644 --- a/nseqs.h +++ b/nseqs.h @@ -19,13 +19,32 @@ class NSeqs : public Calculator { public: - NSeqs() : Calculator("NSeqs", 1) {}; + NSeqs() : Calculator("nseqs", 1, false) {}; EstOutput getValues(SAbundVector* rank){ data.resize(1,0); data[0] = (double)rank->getNumSeqs(); return data; } - EstOutput getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) {return data;}; + + EstOutput getValues(vector shared) { //return number of sequences in the sharedotus + + int numGroups = shared.size(); + data.clear(); data.resize(numGroups,0); + + for (int i = 0; i < shared[0]->size(); i++) { + //get bin values and set sharedByAll + bool sharedByAll = true; + for (int j = 0; j < numGroups; j++) { + if (shared[j]->getAbundance(i) == 0) { sharedByAll = false; } + } + + //they are shared + if (sharedByAll == true) { for (int j = 0; j < numGroups; j++) { data[j] += shared[j]->getAbundance(i); } } + } + + return data; + } + string getCitation() { return "http://www.mothur.org/wiki/Nseqs"; } }; /***********************************************************************/