X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=classifyotucommand.cpp;h=ef41ee1bab8853f6741938005f775076b60723ab;hb=e0ce7cbc93d7d2fbb753ca694182db092a0ea0e7;hp=e28961b74888ee5bdefb9eb022fd11afe328e07f;hpb=0ca63a8165baa0afa459e644ebe140ba496d5ba0;p=mothur.git diff --git a/classifyotucommand.cpp b/classifyotucommand.cpp index e28961b..ef41ee1 100644 --- a/classifyotucommand.cpp +++ b/classifyotucommand.cpp @@ -182,7 +182,7 @@ ClassifyOtuCommand::ClassifyOtuCommand(string option) { else if (refTaxonomy == "not open") { abort = true; } namefile = validParameter.validFile(parameters, "name", true); - if (namefile == "not open") { abort = true; } + if (namefile == "not open") { namefile = ""; abort = true; } else if (namefile == "not found") { namefile = ""; } else { m->setNameFile(namefile); } @@ -214,6 +214,11 @@ ClassifyOtuCommand::ClassifyOtuCommand(string option) { if ((cutoff < 51) || (cutoff > 100)) { m->mothurOut("cutoff must be above 50, and no greater than 100."); m->mothurOutEndLine(); abort = true; } + if (namefile == ""){ + vector files; files.push_back(taxfile); + parser.getNameFile(files); + } + } } catch(exception& e) { @@ -470,6 +475,9 @@ vector ClassifyOtuCommand::findConsensusTaxonomy(int bin, ListVector* th } } + + //phylotree adds an extra unknown so we want to remove that + if (bestChild.name == "unknown") { bestChildSize--; } //is this taxonomy above cutoff int consensusConfidence = ceil((bestChildSize / (float) size) * 100); @@ -536,7 +544,9 @@ int ClassifyOtuCommand::process(ListVector* processList) { taxaSum = new PhyloSummary(groupfile); } + //for each bin in the list vector + string snumBins = toString(processList->getNumBins()); for (int i = 0; i < processList->getNumBins(); i++) { if (m->control_pressed) { break; } @@ -547,7 +557,15 @@ int ClassifyOtuCommand::process(ListVector* processList) { if (m->control_pressed) { out.close(); return 0; } //output to new names file - out << (i+1) << '\t' << size << '\t' << conTax << endl; + string binLabel = "Otu"; + string sbinNumber = toString(i+1); + if (sbinNumber.length() < snumBins.length()) { + int diff = snumBins.length() - sbinNumber.length(); + for (int h = 0; h < diff; h++) { binLabel += "0"; } + } + binLabel += sbinNumber; + + out << binLabel << '\t' << size << '\t' << conTax << endl; string noConfidenceConTax = conTax; m->removeConfidences(noConfidenceConTax);