+ if (m->control_pressed) {
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } }
+ delete read; delete heatmap; return 0;
+ }
+
+ //output error messages about any remaining user labels
+ set<string>::iterator it;
+ bool needToRun = false;
+ for (it = userLabels.begin(); it != userLabels.end(); it++) {
+ m->mothurOut("Your file does not include the label " + *it);
+ if (processedLabels.count(lastLabel) != 1) {
+ m->mothurOut(". I will use " + lastLabel + "."); m->mothurOutEndLine();
+ needToRun = true;
+ }else {
+ m->mothurOut(". Please refer to " + lastLabel + "."); m->mothurOutEndLine();
+ }
+ }
+
+ //run last label if you need to
+ if (needToRun == true) {
+
+ if (rabund != NULL) { delete rabund; }
+ rabund = input->getRAbundVector(lastLabel);
+ m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
+
+ outputNames.push_back(heatmap->getPic(rabund));
+ delete rabund; globaldata->rabund = NULL;
+ }
+
+ }else {
+
+ //as long as you are not at the end of the file or done wih the lines you want
+ while((lookupFloat[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
+ if (m->control_pressed) {
+ for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; }
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } }
+ globaldata->Groups.clear();
+ delete read; delete heatmap; return 0;
+ }
+
+ if(allLines == 1 || labels.count(lookupFloat[0]->getLabel()) == 1){
+
+ m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
+ outputNames.push_back(heatmap->getPic(lookupFloat));
+
+ processedLabels.insert(lookupFloat[0]->getLabel());
+ userLabels.erase(lookupFloat[0]->getLabel());
+ }
+
+ if ((m->anyLabelsToProcess(lookupFloat[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
+ string saveLabel = lookupFloat[0]->getLabel();
+
+ for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; }
+ lookupFloat = input->getSharedRAbundFloatVectors(lastLabel);
+ m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
+
+ outputNames.push_back(heatmap->getPic(lookupFloat));
+
+ processedLabels.insert(lookupFloat[0]->getLabel());
+ userLabels.erase(lookupFloat[0]->getLabel());
+
+ //restore real lastlabel to save below
+ lookupFloat[0]->setLabel(saveLabel);
+ }
+
+ lastLabel = lookupFloat[0]->getLabel();
+ //prevent memory leak
+ for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; lookupFloat[i] = NULL; }
+
+ //get next line to process
+ lookupFloat = input->getSharedRAbundFloatVectors();
+ }
+
+
+ if (m->control_pressed) {
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } }
+ globaldata->Groups.clear();
+ delete read; delete heatmap; return 0;
+ }
+