]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerauchimecommand.cpp
descriptions
[mothur.git] / chimerauchimecommand.cpp
index a47aed0ca840197331cdf251ef48bcb68cf9df56..f757fb956858ff6b244132bd44c0b83d8b9e16db 100644 (file)
@@ -65,7 +65,7 @@ string ChimeraUchimeCommand::getHelpString(){
                helpString += "The abskew parameter can only be used with template=self. Minimum abundance skew. Default 1.9. Abundance skew is: min [ abund(parent1), abund(parent2) ] / abund(query).\n";
                helpString += "The chimealns parameter allows you to indicate you would like a file containing multiple alignments of query sequences to parents in human readable format. Alignments show columns with differences that support or contradict a chimeric model.\n";
                helpString += "The minh parameter - mininum score to report chimera. Default 0.3. Values from 0.1 to 5 might be reasonable. Lower values increase sensitivity but may report more false positives. If you decrease xn you may need to increase minh, and vice versa.\n";
-               helpString += "The mindiv parameter - minimum divergence ratio, default 0.5. Div ratio is 100%% - %%identity between query sequence and the closest candidate for being a parent. If you don't care about very close chimeras, then you could increase mindiv to, say, 1.0 or 2.0, and also decrease --min h, say to 0.1, to increase sensitivity. How well this works will depend on your data. Best is to tune parameters on a good benchmark.\n";
+               helpString += "The mindiv parameter - minimum divergence ratio, default 0.5. Div ratio is 100%% - %%identity between query sequence and the closest candidate for being a parent. If you don't care about very close chimeras, then you could increase mindiv to, say, 1.0 or 2.0, and also decrease minh, say to 0.1, to increase sensitivity. How well this works will depend on your data. Best is to tune parameters on a good benchmark.\n";
                helpString += "The xn parameter - weight of a no vote. Default 8.0. Decreasing this weight to around 3 or 4 may give better performance on denoised data.\n";
                helpString += "The dn parameter - pseudo-count prior on number of no votes. Default 1.4. Probably no good reason to change this unless you can retune to a good benchmark for your data. Reasonable values are probably in the range from 0.2 to 2.\n";
                helpString += "The xa parameter - weight of an abstain vote. Default 1. So far, results do not seem to be very sensitive to this parameter, but if you have a good training set might be worth trying. Reasonable values might range from 0.1 to 2.\n";
@@ -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 reference template
                                
                                #ifdef USE_MPI  
                                        int pid; 
@@ -428,7 +434,7 @@ int ChimeraUchimeCommand::execute(){
                                
                                sort(nameMapCount.begin(), nameMapCount.end(), compareSeqPriorityNodes);
                                
-                               string newFasta = fastaFileNames[s] + ".temp";
+                               string newFasta = m->getRootName(fastaFileNames[s]) + "temp";
                                ofstream out;
                                m->openOutputFile(newFasta, out);
                                
@@ -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) {