X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=normalizesharedcommand.cpp;h=43c8e2260c4e678bbd2e7718a6313b15d97eed8b;hb=65e21482d022d12f7a78a8d436fb51f322603e41;hp=bcec00a0bc6dd47e15ddcf72000dc4a9dbec9469;hpb=763d07b1c215b1bdc9d5d63431f78cfecc60acf5;p=mothur.git diff --git a/normalizesharedcommand.cpp b/normalizesharedcommand.cpp index bcec00a..43c8e22 100644 --- a/normalizesharedcommand.cpp +++ b/normalizesharedcommand.cpp @@ -632,6 +632,7 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector& thisl //for each bin vector newBinLabels; + string snumBins = toString(thislookup[0]->getNumBins()); for (int i = 0; i < thislookup[0]->getNumBins(); i++) { if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } return 0; } @@ -647,7 +648,13 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector& thisl newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup()); } //if there is a bin label use it otherwise make one - string binLabel = "Otu" + toString(i+1); + 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; if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } newBinLabels.push_back(binLabel); @@ -681,6 +688,7 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector& //for each bin vector newBinLabels; + string snumBins = toString(thislookup[0]->getNumBins()); for (int i = 0; i < thislookup[0]->getNumBins(); i++) { if (m->control_pressed) { for (int j = 0; j < newLookup.size(); j++) { delete newLookup[j]; } return 0; } @@ -696,7 +704,13 @@ int NormalizeSharedCommand::eliminateZeroOTUS(vector& newLookup[j]->push_back(thislookup[j]->getAbundance(i), thislookup[j]->getGroup()); } //if there is a bin label use it otherwise make one - string binLabel = "Otu" + toString(i+1); + 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; if (i < m->currentBinLabels.size()) { binLabel = m->currentBinLabels[i]; } newBinLabels.push_back(binLabel);