]> git.donarmstrong.com Git - mothur.git/blob - treemap.h
added errorchecking and help info on new unifrac and treeclimber code
[mothur.git] / treemap.h
1 #ifndef TREEMAP_H
2 #define TREEMAP_H
3 /*
4  *  treemap.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 1/26/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 #include <map>
13 #include <string>
14 #include <iostream>
15 #include <fstream>
16 #include "utilities.hpp"
17
18 /* This class is used by the read.tree command to build the tree container. */
19
20 struct GroupIndex {
21         string  groupname;
22         int             vectorIndex;
23 };
24
25
26
27 class TreeMap {
28 public:
29         TreeMap() {};
30         TreeMap(string);
31         ~TreeMap();
32         void readMap();
33         int getNumGroups();
34         int getNumSeqs();
35         void setIndex(string, int);  //sequencename, index
36         int getIndex(string);           //returns vector index of sequence
37         bool isValidGroup(string);  //return true if string is a valid group
38         string getGroup(string);
39         vector<string> namesOfGroups;
40         vector<string> namesOfSeqs;
41     map<string,int> seqsPerGroup;       //groupname, number of seqs in that group.
42         map<string, GroupIndex> treemap; //sequence name and <groupname, vector index>
43         void print(ostream&);
44         
45 private:
46         ifstream fileHandle;
47         string groupFileName;
48         int numGroups;
49         map<string, GroupIndex>::iterator it;
50         map<string, int>::iterator it2;
51         void setNamesOfGroups(string); 
52         
53 };
54
55 #endif