]> git.donarmstrong.com Git - mothur.git/blobdiff - treenode.cpp
unifrac.weighted
[mothur.git] / treenode.cpp
index b31fefd43a2806f19dc691b51ee802fe996a5385..cf7192e12e8c0d4e3b435b80e6cdefe8663f471c 100644 (file)
@@ -23,8 +23,7 @@ Node::Node() {
 /****************************************************************/
 void Node::setName(string Name) {  name = Name; }
 /****************************************************************/
-//non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
-void Node::setGroup(string groups)  { group.push_back(groups); }
+void Node::setGroup(string groups)  { group =groups; }
 /****************************************************************/
 void Node::setBranchLength(float l) { branchLength = l; }
 /****************************************************************/
@@ -36,7 +35,7 @@ void Node::setChildren(int lc, int rc) { lchild = lc; rchild = rc; }  //leftchild
 /****************************************************************/
 string Node::getName() { return name; }
 /****************************************************************/
-vector<string> Node::getGroup() { return group; }
+string Node::getGroup() { return group; }
 /****************************************************************/
 float Node::getBranchLength() { return branchLength; }
 /****************************************************************/
@@ -49,14 +48,24 @@ int Node::getRChild() { return rchild; }
 int Node::getIndex() { return vectorIndex; }
 /****************************************************************/
 //to be used by printTree in the Tree class to print the leaf info                     
-void Node::printNode(ostream& out) {
+void Node::printNode() {
        try{
-               out << name;
-               
+               cout << parent << ' ' << lchild << ' ' << rchild << ' ' << group;
                //there is a branch length
                if (branchLength != -1) { 
-                       out << ":" << setprecision(4) << branchLength; 
+                       cout << ' ' << setprecision(4) << branchLength; 
+               }
+               cout << " |";
+               map<string, int>::iterator it;
+               for(it=pGroups.begin();it!=pGroups.end();it++){
+                       cout << ' ' << it->first << ':' << it->second;
                }
+               cout << " |";
+               for(it=pcount.begin();it!=pcount.end();it++){
+                       cout << ' ' << it->first << ':' << it->second;
+               }
+               cout << endl; 
+               
                
        }
        catch(exception& e) {