]> git.donarmstrong.com Git - mothur.git/blob - readtree.h
working on readtree
[mothur.git] / readtree.h
1 #ifndef READTREE_H
2 #define READTREE_H
3 /*
4  *  readtree.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 1/22/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 using namespace std;
13
14 #include "globaldata.hpp"
15 #include "utilities.hpp"
16 #include "tree.h"
17
18 #define MAX_LINE                513
19 #define SKIPLINE(f,c)   {while((c=f.get())!=EOF && ((c) != '\n')){}}
20
21 class Tree;
22
23 /****************************************************************************/
24
25 class ReadTree {
26         public:
27                 ReadTree(); 
28                 ~ReadTree() {};
29                 
30                 virtual void read() {};
31                 int readSpecialChar(istream&, char, string);
32                 int readNodeChar(istream& f);
33                 float readBranchLength(istream& f);
34                 
35         protected:
36                 GlobalData* globaldata;
37                 int numNodes, numLeaves;
38                 
39 };
40
41 /****************************************************************************/
42
43 class ReadNewickTree : public ReadTree {
44         
45 public:
46         ReadNewickTree(string file) : treeFile(file) { openInputFile(file, filehandle); } 
47         ~ReadNewickTree() {};
48         void read();
49         
50 private:
51         Tree* T;
52         int readNewickInt(istream&, int&, Tree*);
53         void readTreeString();
54         void nexusTranslation();
55         ifstream filehandle;
56         string treeFile;
57         string holder;
58 };
59
60 /****************************************************************************/
61
62 #endif