X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sharedordervector.h;h=7d383ac84f431830e2324cd51d4777d80a3390e0;hb=250e3b11b1c9c1e1ad458ab6c7e71ac2e67e11d9;hp=b1b4a653dd51fb0280a5ea1189d690cf090614a4;hpb=58cf1d08fee8c64334979075fa57bcafb035a2ed;p=mothur.git diff --git a/sharedordervector.h b/sharedordervector.h index b1b4a65..7d383ac 100644 --- a/sharedordervector.h +++ b/sharedordervector.h @@ -2,7 +2,7 @@ #define SHAREDORDER_H /* * sharedorder.h - * Dotur + * Mothur * * Created by Sarah Westcott on 12/9/08. * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved. @@ -15,20 +15,34 @@ the group it is in and the abundance is equal to the OTU number. */ -using namespace std; - #include "datavector.hpp" struct individual { string group; int bin; int abundance; + bool operator()(const individual& i1, const individual& i2) { + return (i1.abundance > i2.abundance); + } + individual() { group = ""; bin = 0; abundance = 0; } }; +struct individualFloat { + string group; + int bin; + float abundance; + bool operator()(const individual& i1, const individual& i2) { + return (i1.abundance > i2.abundance); + } + individualFloat() { group = ""; bin = 0; abundance = 0.0; } +}; + + #include "sabundvector.hpp" #include "rabundvector.hpp" #include "sharedrabundvector.h" #include "sharedsabundvector.h" +#include "groupmap.h" class SharedOrderVector : public DataVector { @@ -38,18 +52,19 @@ public: SharedOrderVector(const SharedOrderVector& ov) : DataVector(ov.label), data(ov.data), maxRank(ov.maxRank), numBins(ov.numBins), numSeqs(ov.numSeqs), needToUpdate(ov.needToUpdate) {if(needToUpdate == 1){ updateStats();}}; SharedOrderVector(string, vector); -// SharedOrderVector(ifstream&); + SharedOrderVector(ifstream&); ~SharedOrderVector(){}; - void set(int, int, int, string); //index, OTU, abundance, group + individual get(int); - void push_back(int, int, string); //OTU, abundance, group void resize(int); int size(); void print(ostream&); vector::iterator begin(); vector::iterator end(); - + void push_back(int, int, string); //OTU, abundance, group MUST CALL UPDATE STATS AFTER PUSHBACK!!! + void updateStats(); + void clear(); int getNumBins(); int getNumSeqs(); @@ -61,15 +76,18 @@ public: SharedOrderVector getSharedOrderVector(); SharedRAbundVector getSharedRAbundVector(string); //get the sharedRabundvector for a sepecific group SharedSAbundVector getSharedSAbundVector(string); //get the sharedSabundvector for a sepecific group + vector getSharedRAbundVector(); //returns sharedRabundVectors for all the users groups private: + GroupMap* groupmap; vector data; map< int, vector >::iterator it; int maxRank; int numBins; int numSeqs; bool needToUpdate; - void updateStats(); + void set(int, int, int, string); //index, OTU, abundance, group + }; #endif