]> git.donarmstrong.com Git - mothur.git/blobdiff - treenode.h
adding treeclimber and unifrac pieces
[mothur.git] / treenode.h
index 8bd055931be0ead0d8dc8a2c08d9f8e9ba637aba..799595646268d40dbf64bb118774931ea4ae1098 100644 (file)
@@ -17,6 +17,7 @@ using namespace std;
 #include <fstream>
 #include <iomanip>
 #include <vector>
+#include <map>
 
 /* This class represents a node on a tree. */
 
@@ -27,25 +28,34 @@ class Node  {
                ~Node() {};
                
                void setName(string);
-               void setGroup(string);  //non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
+               void setGroup(string);  
                void setBranchLength(float);
                void setParent(int);
                void setChildren(int, int);             //leftchild, rightchild
                void setIndex(int);
                
                string getName();
-               vector<string> getGroup();    //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
+               string getGroup();  
                float getBranchLength();
                int getParent();
                int getLChild();
                int getRChild();
                int getIndex();
-               
                void printNode(ostream&);   //prints out the name and the branch length
                
+               
+               //pGroup is the parsimony group info.  i.e. for a leaf node it would contain 1 enter pGroup["groupname"] = 1;
+               //but for a branch node it may contain several entries so if the nodes children are from different groups it
+               //would have at least two entries pgroup["groupnameOfLeftChild"] = 1, pgroup["groupnameOfRightChild"] = 1.
+               //pCount is the nodes descendant group infomation.  i.e. pCount["black"] = 20 would mean that 20 of the nodes 
+               //descendant are from group black.
+
+               map<string, int> pGroups; //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
+               map<string, int> pcount;        
+                       
        private:
                string                  name;
-               vector<string>  group;
+               string                  group;
                float                   branchLength;
                int                             parent;
                int                             lchild;