]> git.donarmstrong.com Git - mothur.git/blobdiff - screenseqscommand.cpp
changes to dist.seqs and pairwise.seqs and cluster.classic no longer resizes
[mothur.git] / screenseqscommand.cpp
index 5845b8f86ae7c718c0dbc25fe351d493faff57c3..bdc665881fca22a7451d691812889572430724af 100644 (file)
@@ -26,6 +26,7 @@ vector<string> ScreenSeqsCommand::getValidParameters(){
 //**********************************************************************************************************************
 ScreenSeqsCommand::ScreenSeqsCommand(){        
        try {
+               abort = true;
                //initialize outputTypes
                vector<string> tempOutNames;
                outputTypes["fasta"] = tempOutNames;
@@ -506,13 +507,13 @@ int ScreenSeqsCommand::screenNameGroupFile(set<string> badSeqNames){
                outputNames.push_back(goodNameFile);  outputTypes["name"].push_back(goodNameFile);
                
                ofstream goodNameOut;   m->openOutputFile(goodNameFile, goodNameOut);
-       
+               
                while(!inputNames.eof()){
                        if (m->control_pressed) { goodNameOut.close();  inputNames.close(); remove(goodNameFile.c_str());  return 0; }
 
                        inputNames >> seqName >> seqList;
                        it = badSeqNames.find(seqName);
-                       
+                               
                        if(it != badSeqNames.end()){
                                badSeqNames.erase(it);
                                
@@ -557,7 +558,7 @@ int ScreenSeqsCommand::screenNameGroupFile(set<string> badSeqNames){
                                if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); remove(goodNameFile.c_str());  remove(goodGroupFile.c_str()); return 0; }
 
                                inputGroups >> seqName >> group;
-
+                               
                                it = badSeqGroups.find(seqName);
                                
                                if(it != badSeqGroups.end()){
@@ -579,7 +580,8 @@ int ScreenSeqsCommand::screenNameGroupFile(set<string> badSeqNames){
                                }
                        }
                }
-                       
+               
+               
                return 0;
        
        }
@@ -720,7 +722,11 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector<int>& startPosition,
                                out.close();
                                
                                exit(0);
-                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+                       }else { 
+                               m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine(); 
+                               for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+                               exit(0);
+                       }
                }
                
                num = driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, fastafile, lines[0]);
@@ -1006,6 +1012,9 @@ int ScreenSeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File&
                                        delete buf3;
                                }
                        }
+                       
+                       //report progress
+                       if((i) % 100 == 0){     m->mothurOut("Processing sequence: " + toString(i)); m->mothurOutEndLine();             }
                }
                                
                return 1;
@@ -1042,7 +1051,11 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st
                                out.close();
                                
                                exit(0);
-                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+                       }else { 
+                               m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine(); 
+                               for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+                               exit(0);
+                       }
                }
                
                //force parent to wait until all the processes are done