X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=phylotree.cpp;h=a07cfde3b20aefe619b6c4638383c31655f82745;hb=2397df97b12cd5d21ea10dc4248c18a5803ddd41;hp=8d03607820955f6f4474a78f0505fad9de93ad81;hpb=d5bf2c1354d0811a33394d918b15620606560d58;p=mothur.git diff --git a/phylotree.cpp b/phylotree.cpp index 8d03607..a07cfde 100644 --- a/phylotree.cpp +++ b/phylotree.cpp @@ -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 {