]> git.donarmstrong.com Git - mothur.git/blob - treenode.h
camberra fix
[mothur.git] / treenode.h
1 #ifndef TREENODE_H
2 #define TREENODE_H
3
4 /*
5  *  treenode.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 1/23/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14 #include "mothurout.h"
15
16 /* This class represents a node on a tree. */
17
18
19 class Node  {
20         public:
21                 Node();  //pass it the sequence name
22                 ~Node() { pGroups.clear(); pcount.clear(); };
23                 
24                 void setName(string);
25                 void setGroup(vector<string>);  
26                 void setBranchLength(float);
27                 void setLabel(float);
28                 void setParent(int);
29                 void setChildren(int, int);             //leftchild, rightchild
30                 void setIndex(int);
31                 void setLengthToLeaves(float);
32                 
33                 string getName();
34                 vector<string> getGroup();  
35                 float getBranchLength();
36                 float getLengthToLeaves();
37                 float getLabel();
38                 int getParent();
39                 int getLChild();
40                 int getRChild();
41                 int getIndex();
42                 void printNode();   //prints out the name and the branch length
43                 
44                 
45                 //pGroup is the parsimony group info.  i.e. for a leaf node it would contain 1 enter pGroup["groupname"] = 1;
46                 //but for a branch node it may contain several entries so if the nodes children are from different groups it
47                 //would have at least two entries pgroup["groupnameOfLeftChild"] = 1, pgroup["groupnameOfRightChild"] = 1.
48                 //pCount is the nodes descendant group infomation.  i.e. pCount["black"] = 20 would mean that 20 of the nodes 
49                 //descendant are from group black.
50
51                 map<string, int> pGroups; //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
52                 map<string, int> pcount;        
53                         
54         private:
55                 string                  name;
56                 vector<string>  group; 
57                 float                   branchLength, length2leaf, label;
58                 int                             parent;
59                 int                             lchild;
60                 int                             rchild;
61                 int                             vectorIndex;
62                 MothurOut* m;
63 };              
64
65 #endif