X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=otuhierarchycommand.cpp;fp=otuhierarchycommand.cpp;h=05d6443725be6028411573b6ee280220cb52ff0c;hb=aa9238c0a9e6e7aa0ed8b8b606b08ad4fd7dcfe3;hp=a8a3531a67e97dd8669bbc24b83d2e930356e98c;hpb=182db2b6f1747bc1e0b8cd3eceec8751abdd31d5;p=mothur.git diff --git a/otuhierarchycommand.cpp b/otuhierarchycommand.cpp index a8a3531..05d6443 100644 --- a/otuhierarchycommand.cpp +++ b/otuhierarchycommand.cpp @@ -110,6 +110,8 @@ int OtuHierarchyCommand::execute(){ //get listvectors that correspond to labels requested, (or use smart distancing to get closest listvector) vector lists = getListVectors(); + if (m->control_pressed) { return 0; } + //determine which is little and which is big, putting little first if (lists.size() == 2) { //if big is first swap them @@ -123,6 +125,9 @@ int OtuHierarchyCommand::execute(){ //map sequences to bin number in the "little" otu map littleBins; for (int i = 0; i < lists[0].getNumBins(); i++) { + + if (m->control_pressed) { return 0; } + string names = lists[0].get(i); //parse bin @@ -143,6 +148,8 @@ int OtuHierarchyCommand::execute(){ //go through each bin in "big" otu and output the bins in "little" otu which created it for (int i = 0; i < lists[1].getNumBins(); i++) { + if (m->control_pressed) { out.close(); remove(outputFileName.c_str()); return 0; } + string names = lists[1].get(i); //output column 1 @@ -174,6 +181,8 @@ int OtuHierarchyCommand::execute(){ out.close(); + if (m->control_pressed) { remove(outputFileName.c_str()); return 0; } + m->mothurOutEndLine(); m->mothurOut("Output File Name: "); m->mothurOutEndLine(); m->mothurOut(outputFileName); m->mothurOutEndLine(); @@ -216,6 +225,8 @@ vector OtuHierarchyCommand::getListVectors() { } while ((list != NULL) && (userLabels.size() != 0)) { + + if (m->control_pressed) { in.close(); delete list; return lists; } //is this a listvector that we want? if(labels.count(list->getLabel()) == 1){ @@ -264,7 +275,7 @@ vector OtuHierarchyCommand::getListVectors() { }else { list = NULL; } } - + if (m->control_pressed) { in.close(); return lists; } //output error messages about any remaining user labels set::iterator it; @@ -279,6 +290,8 @@ vector OtuHierarchyCommand::getListVectors() { } } + if (m->control_pressed) { in.close(); return lists; } + //run last label if you need to if (needToRun == true) { if (list != NULL) { delete list; } @@ -295,7 +308,7 @@ vector OtuHierarchyCommand::getListVectors() { } } - + in.close(); return lists; } catch(exception& e) {