]> git.donarmstrong.com Git - mothur.git/blobdiff - pairwiseseqscommand.cpp
fixed metastats, added resize to cluster.classic, added code to kill children if...
[mothur.git] / pairwiseseqscommand.cpp
index 560d54dc98fc198369e832fad43ee9414a646cae..18412fdeac778159551d32e8573edd1dddc321bf 100644 (file)
@@ -61,6 +61,7 @@ vector<string> PairwiseSeqsCommand::getRequiredFiles(){
 //**********************************************************************************************************************
 PairwiseSeqsCommand::PairwiseSeqsCommand(){    
        try {
+               abort = true;
                //initialize outputTypes
                vector<string> tempOutNames;
                outputTypes["phylip"] = tempOutNames;
@@ -134,7 +135,9 @@ PairwiseSeqsCommand::PairwiseSeqsCommand(string option)  {
                                                if (m->getDefaultPath() != "") { //default path is set
                                                        string tryPath = m->getDefaultPath() + m->getSimpleName(fastaFileNames[i]);
                                                        m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
-                                                       ableToOpen = m->openInputFile(tryPath, in, "noerror");
+                                                       ifstream in2;
+                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                       in2.close();
                                                        fastaFileNames[i] = tryPath;
                                                }
                                        }
@@ -144,7 +147,9 @@ PairwiseSeqsCommand::PairwiseSeqsCommand(string option)  {
                                                if (m->getOutputDir() != "") { //default path is set
                                                        string tryPath = m->getOutputDir() + m->getSimpleName(fastaFileNames[i]);
                                                        m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying output directory " + tryPath); m->mothurOutEndLine();
-                                                       ableToOpen = m->openInputFile(tryPath, in, "noerror");
+                                                       ifstream in2;
+                                                       ableToOpen = m->openInputFile(tryPath, in2, "noerror");
+                                                       in2.close();
                                                        fastaFileNames[i] = tryPath;
                                                }
                                        }
@@ -531,7 +536,11 @@ void PairwiseSeqsCommand::createProcesses(string filename) {
                                if (output != "square") {  driver(lines[process]->start, lines[process]->end, filename + toString(getpid()) + ".temp", cutoff); }
                                else { driver(lines[process]->start, lines[process]->end, filename + toString(getpid()) + ".temp", "square"); }
                                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 (map<int, int>::iterator it = processIDS.begin(); it != processIDS.end(); it++) { int temp = it->second; kill (temp, SIGINT); }
+                               exit(0);
+                       }
                }
        
                //force parent to wait until all the processes are done