X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=removeotulabelscommand.cpp;h=18322f1bcb46d0eeeb698b3e759c885e8b923437;hb=250e3b11b1c9c1e1ad458ab6c7e71ac2e67e11d9;hp=a882f6bdd3cc1a5588fa4cc18476eca09e6f2153;hpb=499f4ac6e321f9f03d4c3aa25c3b6880892c8b83;p=mothur.git diff --git a/removeotulabelscommand.cpp b/removeotulabelscommand.cpp index a882f6b..18322f1 100644 --- a/removeotulabelscommand.cpp +++ b/removeotulabelscommand.cpp @@ -518,23 +518,16 @@ int RemoveOtuLabelsCommand::readList(){ newList.setLabel(list->getLabel()); int removedCount = 0; bool wroteSomething = false; - string snumBins = toString(list->getNumBins()); + vector binLabels = list->getLabels(); + vector newLabels; for (int i = 0; i < list->getNumBins(); i++) { if (m->control_pressed) { delete list; return 0;} - //create a label for this otu - string otuLabel = "Otu"; - string sbinNumber = toString(i+1); - if (sbinNumber.length() < snumBins.length()) { - int diff = snumBins.length() - sbinNumber.length(); - for (int h = 0; h < diff; h++) { otuLabel += "0"; } - } - otuLabel += sbinNumber; - - if (labels.count(m->getSimpleLabel(otuLabel)) == 0) { + if (labels.count(m->getSimpleLabel(binLabels[i])) == 0) { newList.push_back(list->get(i)); + newLabels.push_back(binLabels[i]); }else { removedCount++; } } @@ -552,6 +545,8 @@ int RemoveOtuLabelsCommand::readList(){ //print new listvector if (newList.getNumBins() != 0) { wroteSomething = true; + newList.setLabels(newLabels); + newList.printHeaders(out); newList.print(out); } out.close();