1 #ifndef NSEQS_H 2 #define NSEQS_H 3 4 /* 5 * nseqs.h 6 * Mothur 7 * 8 * Created by Sarah Westcott on 3/16/09. 9 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. 10 * 11 */ 12 13 14 15 #include "calculator.h" 16 17 /***********************************************************************/ 18 19 class NSeqs : public Calculator { 20 21 public: NSeqs()22 NSeqs() : Calculator("nseqs", 1, false) {}; getValues(SAbundVector * rank)23 EstOutput getValues(SAbundVector* rank){ 24 data.resize(1,0); 25 data[0] = (double)rank->getNumSeqs(); 26 return data; 27 } 28 getValues(vector<SharedRAbundVector * > shared)29 EstOutput getValues(vector<SharedRAbundVector*> shared) { //return number of sequences in the sharedotus 30 31 int numGroups = shared.size(); 32 data.clear(); data.resize(numGroups,0); 33 34 for (int i = 0; i < shared[0]->getNumBins(); i++) { 35 //get bin values and set sharedByAll 36 bool sharedByAll = true; 37 for (int j = 0; j < numGroups; j++) { 38 if (shared[j]->get(i) == 0) { sharedByAll = false; } 39 } 40 41 //they are shared 42 if (sharedByAll ) { for (int j = 0; j < numGroups; j++) { data[j] += shared[j]->get(i); } } 43 } 44 45 return data; 46 } getCitation()47 string getCitation() { return "http://www.mothur.org/wiki/Nseqs"; } 48 }; 49 50 /***********************************************************************/ 51 52 #endif 53