]> git.donarmstrong.com Git - mothur.git/blobdiff - filterseqscommand.cpp
added checks for ^C to quit command instead of program
[mothur.git] / filterseqscommand.cpp
index 91d1181f3770b5010fcabd7e5c78e61b18186904..2fd172117fa71a06ab9cfb7b36792c0683a62698 100644 (file)
@@ -185,6 +185,9 @@ int FilterSeqsCommand::execute() {
                                openInputFile(fastafileNames[i], in);
                                
                                while(!in.eof()){       //read through and create the filter...
+                               
+                                       if (m->control_pressed) { in.close(); return 0; }
+                                       
                                        Sequence seq(in);
                                        if (seq.getName() != "") {
                                                if(trump != '*'){       F.doTrump(seq); }
@@ -224,6 +227,8 @@ int FilterSeqsCommand::execute() {
                        
                        
                        while(!in.eof()){
+                               if (m->control_pressed) { in.close(); outFASTA.close(); for(int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }  return 0; }
+                               
                                Sequence seq(in);
                                if (seq.getName() != "") {
                                        string align = seq.getAligned();
@@ -249,6 +254,9 @@ int FilterSeqsCommand::execute() {
                        if(filter[i] == '1'){   filteredLength++;       }
                }
                
+               if (m->control_pressed) {  for(int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }  return 0; }
+
+               
                m->mothurOutEndLine();
                m->mothurOut("Length of filtered alignment: " + toString(filteredLength)); m->mothurOutEndLine();
                m->mothurOut("Number of columns removed: " + toString((alignmentLength-filteredLength))); m->mothurOutEndLine();