X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=treenode.cpp;h=59fb630ef11373b671f48dfc72459dbc1fa78ad7;hb=477e76a8a79b60f6cd4253324dd830bdea25e3e9;hp=ae7d0e4ec6731a78967a46004aed02e61ceaf984;hpb=d037597badc8d18e235c59f0c1114180edb7f98f;p=mothur.git diff --git a/treenode.cpp b/treenode.cpp index ae7d0e4..59fb630 100644 --- a/treenode.cpp +++ b/treenode.cpp @@ -18,6 +18,7 @@ Node::Node() { parent = -1; lchild = -1; rchild = -1; + length2leaf = 0.0; } /****************************************************************/ @@ -27,6 +28,8 @@ void Node::setGroup(string groups) { group =groups; } /****************************************************************/ void Node::setBranchLength(float l) { branchLength = l; } /****************************************************************/ +void Node::setLengthToLeaves(float l) { length2leaf = l; } +/****************************************************************/ void Node::setParent(int p) { parent = p; } /****************************************************************/ void Node::setIndex(int i) { vectorIndex = i; } @@ -39,6 +42,8 @@ string Node::getGroup() { return group; } /****************************************************************/ float Node::getBranchLength() { return branchLength; } /****************************************************************/ +float Node::getLengthToLeaves() { return length2leaf; } +/****************************************************************/ int Node::getParent() { return parent; } /****************************************************************/ int Node::getLChild() { return lchild; } @@ -48,14 +53,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::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) {