]> git.donarmstrong.com Git - mothur.git/blobdiff - treenode.h
fixes while testing 1.33.0
[mothur.git] / treenode.h
index 8bd055931be0ead0d8dc8a2c08d9f8e9ba637aba..029cee9419cf7adf88344d1635e5709196bd5c73 100644 (file)
  *
  */
 
-using namespace std;
-
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <vector>
+#include "mothur.h"
+#include "mothurout.h"
 
 /* This class represents a node on a tree. */
 
@@ -24,33 +19,47 @@ using namespace std;
 class Node  {
        public:
                Node();  //pass it the sequence name
-               ~Node() {};
+               ~Node() { pGroups.clear(); pcount.clear(); };
                
                void setName(string);
-               void setGroup(string);  //non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
+               void setGroup(vector<string>);  
                void setBranchLength(float);
+               void setLabel(float);
                void setParent(int);
                void setChildren(int, int);             //leftchild, rightchild
                void setIndex(int);
+               void setLengthToLeaves(float);
                
                string getName();
-               vector<string> getGroup();    //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
+               vector<string> getGroup();  
                float getBranchLength();
+               float getLengthToLeaves();
+               float getLabel();
                int getParent();
                int getLChild();
                int getRChild();
                int getIndex();
+               void printNode();   //prints out the name and the branch length
                
-               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;
-               float                   branchLength;
+               vector<string>  group; 
+               float                   branchLength, length2leaf, label;
                int                             parent;
                int                             lchild;
                int                             rchild;
                int                             vectorIndex;
+               MothurOut* m;
 };             
 
 #endif