X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=groupmap.h;h=29c174134eee5689e5210775dbde2f220010d551;hb=8dd3c225255d7084e3aff8740aa4f1f1cabb367a;hp=d69699d382530f688a0f6023f90b1ffed1bdfffe;hpb=c5c7502f435e1413c19e373dab1dfebcaa67588d;p=mothur.git diff --git a/groupmap.h b/groupmap.h index d69699d..29c1741 100644 --- a/groupmap.h +++ b/groupmap.h @@ -2,7 +2,7 @@ #define GROUPMAP_H /* * groupmap.h - * Dotur + * Mothur * * Created by Sarah Westcott on 12/1/08. * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved. @@ -10,6 +10,7 @@ */ #include "mothur.h" +#include "mothurout.h" /* This class is a representation of the groupfile. It is used by all the shared commands to determine what group a certain sequence belongs to. */ @@ -19,21 +20,35 @@ public: GroupMap() {}; GroupMap(string); ~GroupMap(); - void readMap(); + int readMap(); + int readDesignMap(); int getNumGroups(); bool isValidGroup(string); //return true if string is a valid group string getGroup(string); void setGroup(string, string); - vector namesOfGroups; - map groupIndex; //groupname, vectorIndex in namesOfGroups. - used by collectdisplays. - + vector getNamesOfGroups() { + sort(namesOfGroups.begin(), namesOfGroups.end()); + groupIndex.clear(); + for (int i = 0; i < namesOfGroups.size(); i++) { groupIndex[namesOfGroups[i]] = i; } + return namesOfGroups; + } + void setNamesOfGroups(vector sn) { namesOfGroups = sn; } + map groupIndex; //groupname, vectorIndex in namesOfGroups. - used by collectdisplays and libshuff commands. + int getNumSeqs() { return groupmap.size(); } + vector getNamesSeqs(); + vector getNamesSeqs(vector); //get names of seqs belonging to a group or set of groups + int getNumSeqs(string); //return the number of seqs in a given group + private: + vector namesOfGroups; + MothurOut* m; ifstream fileHandle; string groupFileName; int index; map::iterator it; void setNamesOfGroups(string); map groupmap; //sequence name and groupname + map seqsPerGroup; //maps groupname to number of seqs in that group }; #endif