+ if (itNames == nameMap.end()) {
+ mothurOut(name + " is not in your name file please correct."); mothurOutEndLine(); exit(1);
+ }else{
+ for (int i = 0; i < itNames->second; i++) {
+ taxaBrowser.addSeqToTree(name+toString(i), taxon); //add it as many times as there are identical seqs
+ }
+ }
+ }else { taxaBrowser.addSeqToTree(name, taxon); } //add it once
+ }
+ in.close();
+
+ taxaBrowser.assignHeirarchyIDs(0);
+
+ taxaBrowser.binUnclassified();
+
+ remove(tempTaxonomyFile.c_str());
+
+ //print summary file
+ ofstream outTaxTree;
+ openOutputFile(taxSummary, outTaxTree);
+ taxaBrowser.print(outTaxTree);
+ outTaxTree.close();
+
+ //output taxonomy with the unclassified bins added
+ ifstream inTax;
+ openInputFile(newTaxonomyFile, inTax);
+
+ ofstream outTax;
+ string unclass = newTaxonomyFile + ".unclass.temp";
+ openOutputFile(unclass, outTax);
+
+ //get maxLevel from phylotree so you know how many 'unclassified's to add
+ int maxLevel = taxaBrowser.getMaxLevel();
+
+ //read taxfile - this reading and rewriting is done to preserve the confidence sscores.
+ while (!inTax.eof()) {
+ inTax >> name >> taxon; gobble(inTax);
+
+ string newTax = addUnclassifieds(taxon, maxLevel);
+
+ outTax << name << '\t' << newTax << endl;
+ }
+ inTax.close();
+ outTax.close();