X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=groupmap.h;h=5397e02e7c158e5074a7f8e626d813561cc6d9b6;hp=20048a59a5f5aaa3658dd5697f26e3f255a978e1;hb=ef4c1b4dfeecc17a0ad5c1c114c748a0443a88ac;hpb=7e0cf6431e287072c40b2c10c9e08199fce29ef4 diff --git a/groupmap.h b/groupmap.h index 20048a5..5397e02 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,31 +10,53 @@ */ #include "mothur.h" -#include "utilities.hpp" +#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() {}; + 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); 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; + } + vector getNamesSeqs(); + void setNamesOfGroups(vector sn) { namesOfGroups = sn; } + int getNumSeqs() { return groupmap.size(); } + 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 + int getCopy(GroupMap*); + int renameSeq(string, string); + int print(ofstream&); + int print(ofstream&, vector); //print certain groups + + + map groupIndex; //groupname, vectorIndex in namesOfGroups. - used by collectdisplays and libshuff commands. + private: + vector namesOfGroups; + MothurOut* m; ifstream fileHandle; string groupFileName; - int index; + 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