X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=groupmap.h;h=d6984952188de368c765bf2997198f1fefb8bce5;hp=75e0fdcf8a7f9f69df01245f6e09e1e9038bde93;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=20a2d0350a737a434c89f303662d64a8eeea7b05 diff --git a/groupmap.h b/groupmap.h index 75e0fdc..d698495 100644 --- a/groupmap.h +++ b/groupmap.h @@ -2,38 +2,55 @@ #define GROUPMAP_H /* * groupmap.h - * Dotur + * Mothur * * Created by Sarah Westcott on 12/1/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. + * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved. * */ -#include -#include -#include -#include -#include -#include "utilities.hpp" +#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. */ class GroupMap { public: + GroupMap() { m = MothurOut::getInstance(); } GroupMap(string); ~GroupMap(); - void readMap(); + 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); - vector namesOfGroups; - - + void setGroup(string, string); + 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 numGroups; + 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 \ No newline at end of file +#endif