+/***********************************************************************/
+
+void ListVector::setLabels(vector<string> labels){
+ try {
+ binLabels = labels;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ListVector", "setLabels");
+ exit(1);
+ }
+}
+
+/***********************************************************************/
+//could potentially end up with duplicate binlabel names with code below.
+//we don't currently use them in a way that would do that.
+//if you had a listfile that had been subsampled and then added to it, dup names would be possible.
+vector<string> ListVector::getLabels(){
+ try {
+
+ string tagHeader = "Otu";
+ if (m->sharedHeaderMode == "tax") { tagHeader = "PhyloType"; }
+
+ if (binLabels.size() < data.size()) {
+ string snumBins = toString(numBins);
+
+ for (int i = 0; i < numBins; i++) {
+ string binLabel = tagHeader;
+
+ if (i < binLabels.size()) { //label exists, check leading zeros length
+ string sbinNumber = m->getSimpleLabel(binLabels[i]);
+ if (sbinNumber.length() < snumBins.length()) {
+ int diff = snumBins.length() - sbinNumber.length();
+ for (int h = 0; h < diff; h++) { binLabel += "0"; }
+ }
+ binLabel += sbinNumber;
+ binLabels[i] = binLabel;
+ }else{
+ 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;
+ binLabels.push_back(binLabel);
+ }
+ }
+ }
+ return binLabels;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ListVector", "getLabels");
+ exit(1);
+ }
+}