+ }*/
+
+ string conTax;
+
+ //create a tree containing sequences from this bin
+ PhyloTree* p = new PhyloTree();
+
+ for (int i = 0; i < closest.size(); i++) {
+ p->addSeqToTree(closest[i], taxonomy[closest[i]]);
+ }
+
+ //build tree
+ p->assignHeirarchyIDs(0);
+
+ TaxNode currentNode = p->get(0);
+
+ //at each level
+ while (currentNode.children.size() != 0) { //you still have more to explore
+
+ TaxNode bestChild;
+ int bestChildSize = 0;
+
+ //go through children
+ for (map<string, int>::iterator itChild = currentNode.children.begin(); itChild != currentNode.children.end(); itChild++) {
+
+ TaxNode temp = p->get(itChild->second);
+
+ //select child with largest accessions - most seqs assigned to it
+ if (temp.accessions.size() > bestChildSize) {
+ bestChild = p->get(itChild->second);
+ bestChildSize = temp.accessions.size();
+ }
+
+ }
+
+ if (bestChildSize == closest.size()) { //if yes, add it
+ conTax += bestChild.name + ";";
+ }else{ //if no, quit
+ break;
+ }
+
+ //move down a level
+ currentNode = bestChild;