]> git.donarmstrong.com Git - mothur.git/blobdiff - knn.cpp
added checks for ^C to quit command instead of program
[mothur.git] / knn.cpp
diff --git a/knn.cpp b/knn.cpp
index c11626a082ac9003785fd937e87b922e3bf8025a..93a7aa33faa6e2e1d9cb43c0505464056cbb1f08 100644 (file)
--- a/knn.cpp
+++ b/knn.cpp
@@ -20,6 +20,8 @@ string Knn::getTaxonomy(Sequence* seq) {
                //use database to find closest seq
 
                vector<int> closest = database->findClosestSequences(seq, num);
+               
+               if (m->control_pressed) { return tax; }
 
                vector<string> closestNames;
                for (int i = 0; i < closest.size(); i++) {
@@ -59,6 +61,7 @@ string Knn::findCommonTaxonomy(vector<string> closest)  {
                int smallest = 100;
                
                for (int i = 0; i < closest.size(); i++) {
+                       if (m->control_pressed) { return "control"; }
                
                        string tax = taxonomy[closest[i]];  //we know its there since we checked in getTaxonomy
                
@@ -73,6 +76,7 @@ string Knn::findCommonTaxonomy(vector<string> closest)  {
                //start at the highest level all the closest seqs have
                string common = "";
                for (int i = (smallest-1); i >= 0; i--) {
+                       if (m->control_pressed) { return "control"; }
 
                        string thistax = taxons[0][i];
                        int num = 0;