X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=groupmap.h;h=d6984952188de368c765bf2997198f1fefb8bce5;hp=54085a19bab041d0caf17981c8c6c81f05a0c8b9;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=0746c58a680458c0bc874b3a5fc1334b12ed2f18 diff --git a/groupmap.h b/groupmap.h index 54085a1..d698495 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. @@ -17,16 +17,24 @@ class GroupMap { public: - GroupMap() {}; + GroupMap() { m = MothurOut::getInstance(); } GroupMap(string); ~GroupMap(); int readMap(); + int readMap(string); int readDesignMap(); + int readDesignMap(string); int getNumGroups(); bool isValidGroup(string); //return true if string is a valid group string getGroup(string); void setGroup(string, string); - vector namesOfGroups; + 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(); @@ -34,6 +42,7 @@ public: int getNumSeqs(string); //return the number of seqs in a given group private: + vector namesOfGroups; MothurOut* m; ifstream fileHandle; string groupFileName;