]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerauchimecommand.cpp
working on current change
[mothur.git] / chimerauchimecommand.cpp
index a47aed0ca840197331cdf251ef48bcb68cf9df56..375964c306651e93c07966d464b02cf24acb187c 100644 (file)
@@ -209,6 +209,8 @@ ChimeraUchimeCommand::ChimeraUchimeCommand(string option)  {
                                                        //erase from file list
                                                        fastaFileNames.erase(fastaFileNames.begin()+i);
                                                        i--;
+                                               }else {
+                                                       m->setFastaFile(fastaFileNames[i]);
                                                }
                                        }
                                }
@@ -283,6 +285,8 @@ ChimeraUchimeCommand::ChimeraUchimeCommand(string option)  {
                                                        //erase from file list
                                                        nameFileNames.erase(nameFileNames.begin()+i);
                                                        i--;
+                                               }else {
+                                                       m->setNameFile(nameFileNames[i]);
                                                }
                                        }
                                }
@@ -309,9 +313,11 @@ ChimeraUchimeCommand::ChimeraUchimeCommand(string option)  {
                                        
                                        templatefile = validParameter.validFile(parameters, "reference", true);
                                        if (templatefile == "not open") { abort = true; }
-                                       else if (templatefile == "not found") { templatefile = "";  m->mothurOut("reference is a required parameter for the chimera.slayer command."); m->mothurOutEndLine(); abort = true;  }  
+                                       else if (templatefile == "not found") { templatefile = "";  m->mothurOut("reference is a required parameter for the chimera.uchime command."); m->mothurOutEndLine(); abort = true;  }  
                                }
-                       }
+                       }else if (hasName) {  templatefile = "self"; }
+                       else { templatefile = "";  m->mothurOut("reference is a required parameter for the chimera.uchime command, unless you have a namefile."); m->mothurOutEndLine(); abort = true;  }       
+
                        
                        string temp = validParameter.validFile(parameters, "processors", false);        if (temp == "not found"){       temp = m->getProcessors();      }
                        m->setProcessors(temp);
@@ -370,7 +376,7 @@ int ChimeraUchimeCommand::execute(){
                        int start = time(NULL); 
                        string nameFile = "";
                        
-                       if (templatefile == "self") { //you want to run slayer with a refernce template
+                       if (templatefile == "self") { //you want to run uchime with a refernce template
                                
                                #ifdef USE_MPI  
                                        int pid; 
@@ -694,6 +700,8 @@ int ChimeraUchimeCommand::driver(string outputFName, string filename, string acc
                for(int i = 0; i < cPara.size(); i++)  {  delete[] cPara[i];  }
                delete[] uchimeParameters; 
                
+               if (m->control_pressed) { return 0; }
+               
                //create accnos file from uchime results
                ifstream in; 
                m->openInputFile(outputFName, in);
@@ -711,7 +719,7 @@ int ChimeraUchimeCommand::driver(string outputFName, string filename, string acc
                        in >> chimeraFlag >> name;
                        
                        //fix name if needed
-                       if (templatefile != "self") { 
+                       if (templatefile == "self") { 
                                name = name.substr(0, name.length()-1); //rip off last /
                                name = name.substr(0, name.find_last_of('/'));
                        }
@@ -740,7 +748,7 @@ int ChimeraUchimeCommand::createProcesses(string outputFileName, string filename
                processIDS.clear();
                int process = 1;
                int num = 0;
-               
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)          
                //break up file into multiple files
                vector<string> files;
                m->divideFile(filename, processors, files);
@@ -848,7 +856,7 @@ int ChimeraUchimeCommand::createProcesses(string outputFileName, string filename
 #endif         
                //get rid of the file pieces.
                for (int i = 0; i < files.size(); i++) { remove(files[i].c_str()); }
-               
+#endif         
                return num;     
        }
        catch(exception& e) {