using namespace std;
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <vector>
+#include "mothur.h"
/* This class represents a node on a tree. */
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(string);
void setBranchLength(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.
+ string getGroup();
float getBranchLength();
+ float getLengthToLeaves();
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;
+ string group;
+ float branchLength, length2leaf;
int parent;
int lchild;
int rchild;