]> git.donarmstrong.com Git - mothur.git/blobdiff - phylotree.cpp
worked on hcluster. made .single command run using a sharedfile. and various other...
[mothur.git] / phylotree.cpp
index 8d03607820955f6f4474a78f0505fad9de93ad81..a07cfde3b20aefe619b6c4638383c31655f82745 100644 (file)
@@ -17,6 +17,7 @@ PhyloTree::PhyloTree(){
                numSeqs = 0;
                tree.push_back(TaxNode("Root"));
                tree[0].heirarchyID = "0";
+               maxLevel = 0;
        }
        catch(exception& e) {
                errorOut(e, "PhyloTree", "PhyloTree");
@@ -219,6 +220,25 @@ void PhyloTree::binUnclassified(){
        }
 }
 /**************************************************************************************************/
+string PhyloTree::getFullTaxonomy(string seqName) {
+       try {
+               string tax = "";
+               
+               int currentNode = name2Taxonomy[seqName];
+               
+               while (tree[currentNode].parent != -1) {
+                       tax = tree[currentNode].name + ";" + tax;
+                       currentNode = tree[currentNode].parent;
+               }
+               
+               return tax;
+       }
+       catch(exception& e) {
+               errorOut(e, "PhyloTree", "getFullTaxonomy");
+               exit(1);
+       }
+}
+/**************************************************************************************************/
 
 void PhyloTree::print(ofstream& out){
        try {