]> git.donarmstrong.com Git - mothur.git/blobdiff - treenode.cpp
added help for heatmap.sim
[mothur.git] / treenode.cpp
index 6cd99f9bbb7234e1276d6c292474ac692bb0eff4..fc6ea3a595ac752e943151a84ce6a538f6d66670 100644 (file)
@@ -18,16 +18,21 @@ Node::Node() {
        parent = -1;
        lchild = -1;
        rchild = -1;
+       length2leaf = 0.0;
+       label = -1;
        
 }
 /****************************************************************/
 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; }
 /****************************************************************/
+void Node::setLabel(float l) { label = l; }
+/****************************************************************/
+void Node::setLengthToLeaves(float l) { length2leaf = l; }
+/****************************************************************/
 void Node::setParent(int p)  { parent = p; }
 /****************************************************************/
 void Node::setIndex(int i)  { vectorIndex = i; }
@@ -36,10 +41,14 @@ 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; }
 /****************************************************************/
+float Node::getLabel() { return label; }
+/****************************************************************/
+float Node::getLengthToLeaves() { return length2leaf; }
+/****************************************************************/
 int Node::getParent() { return parent; }
 /****************************************************************/
 int Node::getLChild() { return lchild; }
@@ -49,14 +58,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) {
@@ -68,4 +87,4 @@ void Node::printNode(ostream& out) {
                exit(1);
        }               
 }
-/****************************************************************/     
\ No newline at end of file
+/****************************************************************/