]> git.donarmstrong.com Git - mothur.git/blobdiff - sensspeccommand.cpp
added sff.multiple command. fixed issue with windows paralellization in chimera...
[mothur.git] / sensspeccommand.cpp
index 82922ededbff38fd76909d1694742c6adac7666b..cfa1f5b6dc0649925ff4762abdef070e93fd7688 100644 (file)
@@ -19,7 +19,7 @@ vector<string> SensSpecCommand::setParameters(){
                CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
                CommandParameter pcutoff("cutoff", "Number", "", "-1.00", "", "", "",false,false); parameters.push_back(pcutoff);
                CommandParameter pprecision("precision", "Number", "", "100", "", "", "",false,false); parameters.push_back(pprecision);
-               CommandParameter phard("hard", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(phard);
+               CommandParameter phard("hard", "Boolean", "", "T", "", "", "",false,false); parameters.push_back(phard);
                CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
                CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
                
@@ -45,6 +45,26 @@ string SensSpecCommand::getHelpString(){
        }
 }
 //**********************************************************************************************************************
+string SensSpecCommand::getOutputFileNameTag(string type, string inputName=""){        
+       try {
+        string outputFileName = "";
+               map<string, vector<string> >::iterator it;
+        
+        //is this a type this command creates
+        it = outputTypes.find(type);
+        if (it == outputTypes.end()) {  m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
+        else {
+            if (type == "sensspec")            {   outputFileName =  "sensspec";   }
+            else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true;  }
+        }
+        return outputFileName;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "SensSpecCommand", "getOutputFileNameTag");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
 SensSpecCommand::SensSpecCommand(){    
        try {
                abort = true; calledHelp = true; 
@@ -197,7 +217,7 @@ SensSpecCommand::SensSpecCommand(string option)  {
                                else { allLines = 1;  }
                        }
                        
-                       sensSpecFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + "sensspec";
+                       sensSpecFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + getOutputFileNameTag("sensspec");
                }
        }
        catch(exception& e) {
@@ -256,7 +276,9 @@ int SensSpecCommand::processPhylip(){
                
                while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
-                       if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        m->mothurRemove(outputNames[i]);  }  delete list;  return 0;  }
+                       if(m->control_pressed){
+                for (int i = 0; i < outputNames.size(); i++){  m->mothurRemove(outputNames[i]);  }  delete list;  return 0;
+            }
                        
                        if(allLines == 1 || labels.count(list->getLabel()) == 1){                       
                                
@@ -324,7 +346,9 @@ int SensSpecCommand::processPhylip(){
                exit(1);
        }
 }
+
 //***************************************************************************************************************
+
 int SensSpecCommand::fillSeqMap(map<string, int>& seqMap, ListVector*& list){
        try {
                //for each otu
@@ -387,7 +411,7 @@ int SensSpecCommand::fillSeqPairSet(set<string>& seqPairSet, ListVector*& list){
                return numSeqs;
        }
        catch(exception& e) {
-               m->errorOut(e, "SensSpecCommand", "fillSeqMap");
+               m->errorOut(e, "SensSpecCommand", "fillSeqPairSet");
                exit(1);
        }
 }
@@ -401,7 +425,7 @@ int SensSpecCommand::process(map<string, int>& seqMap, string label, bool& getCu
                ifstream phylipFile;
                m->openInputFile(distFile, phylipFile);
                phylipFile >> pNumSeqs;
-               if(pNumSeqs != lNumSeqs){       m->mothurOut("numSeq mismatch!\n"); m->control_pressed = true; }
+               if(pNumSeqs != lNumSeqs){       m->mothurOut("numSeq mismatch!\n"); /*m->control_pressed = true;*/ }
                
                string seqName;
                double distance;
@@ -426,7 +450,7 @@ int SensSpecCommand::process(map<string, int>& seqMap, string label, bool& getCu
                
                m->mothurOut(label); m->mothurOutEndLine();
                
-               for(int i=0;i<lNumSeqs;i++){
+               for(int i=0;i<pNumSeqs;i++){
                        
                        if (m->control_pressed) { return 0; }