]> git.donarmstrong.com Git - mothur.git/blobdiff - pairwiseseqscommand.cpp
added check to make sure shhh.flows child processes finish properly. added subsamplin...
[mothur.git] / pairwiseseqscommand.cpp
index ed11dfbdd56e0ff480bfd281b944dcaa1fab34eb..a4ccbf8f33b34b5dd8eccebf91242249cc465f28 100644 (file)
@@ -203,12 +203,15 @@ PairwiseSeqsCommand::PairwiseSeqsCommand(string option)  {
                        
                        temp = validParameter.validFile(parameters, "mismatch", false);         if (temp == "not found"){       temp = "-1.0";                  }
                        m->mothurConvert(temp, misMatch);  
+            if (misMatch > 0) { m->mothurOut("[ERROR]: mismatch must be negative.\n"); abort=true; }
                        
                        temp = validParameter.validFile(parameters, "gapopen", false);          if (temp == "not found"){       temp = "-2.0";                  }
                        m->mothurConvert(temp, gapOpen);  
+            if (gapOpen > 0) { m->mothurOut("[ERROR]: gapopen must be negative.\n"); abort=true; }
                        
                        temp = validParameter.validFile(parameters, "gapextend", false);        if (temp == "not found"){       temp = "-1.0";                  }
                        m->mothurConvert(temp, gapExtend); 
+            if (gapExtend > 0) { m->mothurOut("[ERROR]: gapextend must be negative.\n"); abort=true; }
                        
                        temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = m->getProcessors();      }
                        m->setProcessors(temp);
@@ -393,7 +396,7 @@ int PairwiseSeqsCommand::execute(){
                                        if (output != "square"){ driverMPI(start, end, (outputFile + toString(pid) + ".temp"), size); }
                                        else { driverMPI(start, end, (outputFile + toString(pid) + ".temp"), size, output); }
                                        
-                                       if (m->control_pressed) { delete distCalculator;  return 0; }
+                                       if (m->control_pressed) {  return 0; }
                                
                                        //tell parent you are done.
                                        MPI_Send(&size, 1, MPI_LONG, 0, tag, MPI_COMM_WORLD);
@@ -402,7 +405,7 @@ int PairwiseSeqsCommand::execute(){
                        MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
        #else           
                                        
-               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+               //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                        //if you don't need to fork anything
                        if(processors == 1){
                                if (output != "square") {  driver(0, numSeqs, outputFile, cutoff); }
@@ -494,7 +497,7 @@ void PairwiseSeqsCommand::createProcesses(string filename) {
         int process = 1;
                processIDS.clear();
         
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                
                
                //loop through and create all the processes you want
@@ -991,6 +994,22 @@ int PairwiseSeqsCommand::driverMPI(int startLine, int endLine, string file, unsi
                        alignment = new NeedlemanOverlap(gapOpen, match, misMatch, longestBase);
                }
                
+        ValidCalculators validCalculator;
+        Dist* distCalculator;
+        if (countends) {
+            if (validCalculator.isValidCalculator("distance", Estimators[0]) == true) { 
+                if (Estimators[0] == "nogaps")                 {       distCalculator = new ignoreGaps();      }
+                else if (Estimators[0] == "eachgap")   {       distCalculator = new eachGapDist();     }
+                else if (Estimators[0] == "onegap")            {       distCalculator = new oneGapDist();      }
+            }
+        }else {
+            if (validCalculator.isValidCalculator("distance", Estimators[0]) == true) { 
+                if (Estimators[0] == "nogaps")         {       distCalculator = new ignoreGaps();                                      }
+                else if (Estimators[0] == "eachgap"){  distCalculator = new eachGapIgnoreTermGapDist();        }
+                else if (Estimators[0] == "onegap")    {       distCalculator = new oneGapIgnoreTermGapDist();         }
+            }
+        }
+        
                string outputString = "";
                size = 0;