]> git.donarmstrong.com Git - mothur.git/blobdiff - groupmap.h
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / groupmap.h
index 20048a59a5f5aaa3658dd5697f26e3f255a978e1..d6984952188de368c765bf2997198f1fefb8bce5 100644 (file)
@@ -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.
  */
 
 #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<string> namesOfGroups;
-       map<string, int> groupIndex;  //groupname, vectorIndex in namesOfGroups. - used by collectdisplays.
-               
+       vector<string> 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<string> sn) { namesOfGroups = sn; }
+       map<string, int> groupIndex;  //groupname, vectorIndex in namesOfGroups. - used by collectdisplays and libshuff commands.
+       int getNumSeqs()  {  return groupmap.size();  }
+       vector<string> getNamesSeqs();
+       vector<string> getNamesSeqs(vector<string>); //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<string> namesOfGroups;
+       MothurOut* m;
        ifstream fileHandle;
        string groupFileName;
        int index;
        map<string, string>::iterator it;
        void setNamesOfGroups(string); 
        map<string, string> groupmap; //sequence name and groupname
+       map<string, int> seqsPerGroup;  //maps groupname to number of seqs in that group
 };
 
 #endif