X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=phylotree.cpp;h=2e3136e1f42e1a93d15fcab921b2e612f55f3997;hp=b9bab4ec2934a4121305f87111cf2d238f5ec4d5;hb=fe08eacea5a2d34cd4bd27e8451fd2872102a80a;hpb=6b32d112bb60e9f7eb6d4407a4eed4c49b67bced diff --git a/phylotree.cpp b/phylotree.cpp index b9bab4e..2e3136e 100644 --- a/phylotree.cpp +++ b/phylotree.cpp @@ -233,6 +233,48 @@ string PhyloTree::getNextTaxon(string& heirarchy, string seqname){ exit(1); } } +/**************************************************************************************************/ + +vector PhyloTree::getSeqs(string seqTaxonomy){ + try { + string taxCopy = seqTaxonomy; + vector names; + map::iterator childPointer; + + int currentNode = 0; + + m->removeConfidences(seqTaxonomy); + + string taxon; + while(seqTaxonomy != ""){ + + if (m->control_pressed) { return names; } + + taxon = getNextTaxon(seqTaxonomy, ""); + + if (m->debug) { m->mothurOut(taxon +'\n'); } + + if (taxon == "") { m->mothurOut(taxCopy + " has an error in the taxonomy. This may be due to a ;;"); m->mothurOutEndLine(); break; } + + childPointer = tree[currentNode].children.find(taxon); + + if(childPointer != tree[currentNode].children.end()){ //if the node already exists, move on + currentNode = childPointer->second; + } + else{ //otherwise, error this taxonomy is not in tree + m->mothurOut("[ERROR]: " + taxCopy + " is not in taxonomy tree, please correct."); m->mothurOutEndLine(); m->control_pressed = true; return names; + } + + if (seqTaxonomy == "") { names = tree[currentNode].accessions; } + } + + return names; + } + catch(exception& e) { + m->errorOut(e, "PhyloTree", "getSeqs"); + exit(1); + } +} /**************************************************************************************************/